Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jan 2013 10:52:37 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Garrett Cooper <yanegomi@gmail.com>
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>, Adrian Chadd <adrian@FreeBSD.org>, freebsd-current <freebsd-current@freebsd.org>
Subject:   Re: [RFC] support -b <baudrate> when starting gdb
Message-ID:  <52655D4C-6B01-4E62-B639-51142EEE8353@bsdimp.com>
In-Reply-To: <816C84A4-BF12-468C-BED8-797A319E9CDC@gmail.com>
References:  <CAJ-Vmo=egCndUfHoQVS3Sy8rd0QOEm96mJ1Vv3K%2BrRuJcUpp9Q@mail.gmail.com> <89207049-41FF-479D-90EE-89652937AB29@bsdimp.com> <816C84A4-BF12-468C-BED8-797A319E9CDC@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Jan 16, 2013, at 9:05 AM, Garrett Cooper wrote:

> On Jan 16, 2013, at 7:35 AM, Warner Losh <imp@bsdimp.com> wrote:
>=20
>> How does 'set remotebaud' not do what you want?
>>=20
>> Warner
>>=20
>> On Jan 15, 2013, at 10:15 PM, Adrian Chadd wrote:
>>=20
>>> Hi,
>>>=20
>>> 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.
>>>=20
>>> However kgdb doesn't have this support.
>>>=20
>>> 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.
>>>=20
>>> The MIPS stuff has other issues; I'll talk about those later.
>>>=20
>>> Thanks,
>>>=20
>>>=20
>>>=20
>>> Adrian
>>>=20
>>>=20
>>> Index: gnu/usr.bin/gdb/kgdb/main.c
>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>>> --- gnu/usr.bin/gdb/kgdb/main.c (revision 245281)
>>> +++ gnu/usr.bin/gdb/kgdb/main.c (working copy)
>>> @@ -333,11 +333,24 @@
>>>      args.argv =3D malloc(sizeof(char *));
>>>      args.argv[0] =3D argv[0];
>>>=20
>>> -       while ((ch =3D getopt(argc, argv, "ac:d:fn:qr:vw")) !=3D -1) =
{
>>> +       while ((ch =3D getopt(argc, argv, "ab:c:d:fn:qr:vw")) !=3D =
-1) {
>>>              switch (ch) {
>>>              case 'a':
>>>                      annotation_level++;
>>>                      break;
>>> +               case 'b':
>>> +                       {
>>> +                               int i;
>>> +                               char *p;
>>> +
>>> +                               i =3D strtol (optarg, &p, 0);
>>> +                               if (i =3D=3D 0 && p =3D=3D optarg)
>>> +                               warnx("warning: could not set baud
>>> rate to `%s'.\n",
>>> +                                   optarg);
>>> +                               else
>>> +                                       baud_rate =3D i;
>>> +                       }
>>> +                       break;
>>>              case 'c':       /* use given core file. */
>>>                      if (vmcore !=3D NULL) {
>>>                              warnx("option %c: can only be specified =
once",
>=20
> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52655D4C-6B01-4E62-B639-51142EEE8353>