Re: [RFC] support -b <baudrate> when starting gdb

From: Warner Losh <imp_at_bsdimp.com>
Date: Wed, 16 Jan 2013 10:52:37 -0700
On Jan 16, 2013, at 9:05 AM, Garrett Cooper wrote:

> On Jan 16, 2013, at 7:35 AM, Warner Losh <imp_at_bsdimp.com> wrote:
> 
>> How does 'set remotebaud' not do what you want?
>> 
>> Warner
>> 
>> On Jan 15, 2013, at 10:15 PM, 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)
>>> _at__at_ -333,11 +333,24 _at__at_
>>>      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",
> 
> It's more of a convenience factor and easier to script command line arguments IMO.

True, but he said there was no way to do it...  I have this in my setup scripts when I have to do serial debugging...

Warner
Received on Wed Jan 16 2013 - 16:52:47 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:34 UTC