misc/175743: Patches for kgdb

Christoph Mallon christoph.mallon at gmx.de
Thu Jan 31 20:50:06 UTC 2013


>Number:         175743
>Category:       misc
>Synopsis:       Patches for kgdb
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 31 20:50:06 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Christoph Mallon
>Release:        
>Organization:
>Environment:
>Description:
Two patches for Adrian Chadd for kgdb:
- Improve test whether the argument of -b is valid.
- Document -b in the manpage and usage.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

>From 9d268c225e431bd8e548cfd88df5a9837a3aeb87 Mon Sep 17 00:00:00 2001
From: Christoph Mallon <christoph.mallon at gmx.de>
Date: Mon, 21 Jan 2013 07:27:42 +0100
Subject: [PATCH 1/2] kgdb: Improve test whether the argument of -b is valid.

Now non-digits (e.g. "4k") are detected.
---
 gnu/usr.bin/gdb/kgdb/main.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/gnu/usr.bin/gdb/kgdb/main.c b/gnu/usr.bin/gdb/kgdb/main.c
index 45a3dc0..930cdee 100644
--- a/gnu/usr.bin/gdb/kgdb/main.c
+++ b/gnu/usr.bin/gdb/kgdb/main.c
@@ -338,19 +338,18 @@ main(int argc, char *argv[])
 		case 'a':
 			annotation_level++;
 			break;
-		case 'b':
-			{
-				int i;
-				char *p;
+		case 'b': {
+			int i;
+			char *p;
 
-				i = strtol (optarg, &p, 0);
-				if (i == 0 && p == optarg)
+			i = strtol(optarg, &p, 0);
+			if (*p != '\0' || p == optarg)
 				warnx("warning: could not set baud rate to `%s'.\n",
 				    optarg);
-				else
-					baud_rate = i;
-			}
+			else
+				baud_rate = i;
 			break;
+		}
 		case 'c':	/* use given core file. */
 			if (vmcore != NULL) {
 				warnx("option %c: can only be specified once",
-- 
1.8.1.2

>From 3846bfff5ad1450d4d047c3d3912dd28a5235751 Mon Sep 17 00:00:00 2001
From: Christoph Mallon <christoph.mallon at gmx.de>
Date: Fri, 25 Jan 2013 20:58:37 +0100
Subject: [PATCH 2/2] kgdb: Document -b in the manpage and usage.

---
 gnu/usr.bin/gdb/kgdb/kgdb.1 | 4 ++++
 gnu/usr.bin/gdb/kgdb/main.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gnu/usr.bin/gdb/kgdb/kgdb.1 b/gnu/usr.bin/gdb/kgdb/kgdb.1
index 4073d70..58d0786 100644
--- a/gnu/usr.bin/gdb/kgdb/kgdb.1
+++ b/gnu/usr.bin/gdb/kgdb/kgdb.1
@@ -33,6 +33,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl a | Fl f | Fl fullname
+.Op Fl b Ar rate
 .Op Fl q | Fl quiet
 .Op Fl v
 .Op Fl w
@@ -62,6 +63,9 @@ The
 or
 .Fl fullname
 options are supported for backward compatibility as well.
+.It Fl b Ar rate
+Set the baudrate to
+.Ar rate .
 .It Fl q
 Suppress printing of the banner when the debugger starts.
 The
diff --git a/gnu/usr.bin/gdb/kgdb/main.c b/gnu/usr.bin/gdb/kgdb/main.c
index 930cdee..aa062a2 100644
--- a/gnu/usr.bin/gdb/kgdb/main.c
+++ b/gnu/usr.bin/gdb/kgdb/main.c
@@ -83,7 +83,7 @@ usage(void)
 {
 
 	fprintf(stderr,
-	    "usage: %s [-afqvw] [-d crashdir] [-c core | -n dumpnr | -r device]\n"
+	    "usage: %s [-afqvw] [-b rate] [-d crashdir] [-c core | -n dumpnr | -r device]\n"
 	    "\t[kernel [core]]\n", getprogname());
 	exit(1);
 }
-- 
1.8.1.2



>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list