Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jan 2013 21:15:11 -0800
From:      Adrian Chadd <adrian@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        freebsd-current <freebsd-current@freebsd.org>
Subject:   [RFC] support -b <baudrate> when starting gdb
Message-ID:  <CAJ-Vmo=egCndUfHoQVS3Sy8rd0QOEm96mJ1Vv3K%2BrRuJcUpp9Q@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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",



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmo=egCndUfHoQVS3Sy8rd0QOEm96mJ1Vv3K%2BrRuJcUpp9Q>