From owner-freebsd-hackers@FreeBSD.ORG Wed Jan 16 06:30:44 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6A9BC88F; Wed, 16 Jan 2013 06:30:44 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by mx1.freebsd.org (Postfix) with ESMTP id DCF73B55; Wed, 16 Jan 2013 06:30:43 +0000 (UTC) Received: by mail-wg0-f43.google.com with SMTP id e12so606245wge.34 for ; Tue, 15 Jan 2013 22:30:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=/8uS09CjKBm65kRjO6rRQGIsaPrzoU5E9d/xMY5BKmE=; b=N6rA4sae8eN2PRwo1AZRg4qpzsF6DkP6pU6a7FwBWob9cCjlbWSPbC/omO9zDSVvoG giOQfiq/uvK25ikLRlz220kXAo0kt1qQIz7ehOGIfQa2yJnPTKgrrDyqpu3gbpME44qw hUbN1mb5SZR95EAmaxAhEr4/4dvgs60g0UgOTDkXR0yRUAXlHFJ/j8aPWk8f7ALRyXWI jO3KSmOG8nstmezlq8jsByQMMW72CHS0VuvORweS1JgR+W9PFfDciZ3adOiwWzvPjq0O iRXzKuiV5sCy5nJVlmKCjXcnqu0lf78BRhsgEdTFl++cLlmPLt1nQ5zXMQcc+MypB3Cs weVw== MIME-Version: 1.0 Received: by 10.195.13.67 with SMTP id ew3mr58373093wjd.59.1358317837316; Tue, 15 Jan 2013 22:30:37 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.217.57.9 with HTTP; Tue, 15 Jan 2013 22:30:37 -0800 (PST) In-Reply-To: References: Date: Tue, 15 Jan 2013 22:30:37 -0800 X-Google-Sender-Auth: ehIyRbgPAMOlRWOlEBTI9Hujejo Message-ID: Subject: Re: [RFC] support -b when starting gdb From: Adrian Chadd To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-current X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jan 2013 06:30:44 -0000 Also, I found 'set remotebaud' and 'set debug remote 1' to do this. I'd like to add the code just to support the same -b flag as gdb (so -r can also be used with a non-standard serial port.) Thanks, Adrian On 15 January 2013 21:15, Adrian Chadd wrote: > Hi, > > There doesn't seem to be a blessed way to set the baudrate from inside > gdb/kgdb. It seems to be set from '-b' on the command line. > > However kgdb doesn't have this support. > > This patch adds -b support so kgdb so I can override the default speed > (9600 it seems) to speak kgdb over serial to a 115200 console MIPS > device. > > The MIPS stuff has other issues; I'll talk about those later. > > Thanks, > > > > Adrian > > > Index: gnu/usr.bin/gdb/kgdb/main.c > =================================================================== > --- gnu/usr.bin/gdb/kgdb/main.c (revision 245281) > +++ gnu/usr.bin/gdb/kgdb/main.c (working copy) > @@ -333,11 +333,24 @@ > args.argv = malloc(sizeof(char *)); > args.argv[0] = argv[0]; > > - while ((ch = getopt(argc, argv, "ac:d:fn:qr:vw")) != -1) { > + while ((ch = getopt(argc, argv, "ab:c:d:fn:qr:vw")) != -1) { > switch (ch) { > case 'a': > annotation_level++; > break; > + case 'b': > + { > + int i; > + char *p; > + > + i = strtol (optarg, &p, 0); > + if (i == 0 && p == optarg) > + warnx("warning: could not set baud > rate to `%s'.\n", > + optarg); > + else > + baud_rate = i; > + } > + break; > case 'c': /* use given core file. */ > if (vmcore != NULL) { > warnx("option %c: can only be specified once",