From nobody@FreeBSD.org  Thu Jan 31 20:48:12 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
	by hub.freebsd.org (Postfix) with ESMTP id DF92D7F7
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 31 Jan 2013 20:48:12 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id D084EA3
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 31 Jan 2013 20:48:12 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r0VKmCpA076913
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 31 Jan 2013 20:48:12 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id r0VKmC8g076912;
	Thu, 31 Jan 2013 20:48:12 GMT
	(envelope-from nobody)
Message-Id: <201301312048.r0VKmC8g076912@red.freebsd.org>
Date: Thu, 31 Jan 2013 20:48:12 GMT
From: Christoph Mallon <christoph.mallon@gmx.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Patches for kgdb
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         175743
>Category:       bin
>Synopsis:       [patch] Patches for kgdb(1) - improve test of arguments; update manpage
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    adrian
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 31 20:50:06 UTC 2013
>Closed-Date:    Tue Feb 19 02:09:34 UTC 2013
>Last-Modified:  Tue Feb 19 02:10:00 UTC 2013
>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@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@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:
Responsible-Changed-From-To: freebsd-bugs->adrian 
Responsible-Changed-By: emaste 
Responsible-Changed-When: Fri Feb 15 14:58:57 UTC 2013 
Responsible-Changed-Why:  
kgdb's -b is Adrian's addition 

http://www.freebsd.org/cgi/query-pr.cgi?pr=175743 
State-Changed-From-To: open->closed 
State-Changed-By: adrian 
State-Changed-When: Tue Feb 19 02:09:27 UTC 2013 
State-Changed-Why:  
committed, thanks! 


http://www.freebsd.org/cgi/query-pr.cgi?pr=175743 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/175743: commit references a PR
Date: Tue, 19 Feb 2013 02:09:32 +0000 (UTC)

 Author: adrian
 Date: Tue Feb 19 02:09:18 2013
 New Revision: 246958
 URL: http://svnweb.freebsd.org/changeset/base/246958
 
 Log:
   kgdb enhancements!
   
   * document the kgdb -b flag
   * better verify what's valid with -b
   * add more comprehensive command line help
   
   PR:		kern/175743
   Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
 
 Modified:
   head/gnu/usr.bin/gdb/kgdb/kgdb.1
   head/gnu/usr.bin/gdb/kgdb/main.c
 
 Modified: head/gnu/usr.bin/gdb/kgdb/kgdb.1
 ==============================================================================
 --- head/gnu/usr.bin/gdb/kgdb/kgdb.1	Tue Feb 19 02:07:36 2013	(r246957)
 +++ head/gnu/usr.bin/gdb/kgdb/kgdb.1	Tue Feb 19 02:09:18 2013	(r246958)
 @@ -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
 
 Modified: head/gnu/usr.bin/gdb/kgdb/main.c
 ==============================================================================
 --- head/gnu/usr.bin/gdb/kgdb/main.c	Tue Feb 19 02:07:36 2013	(r246957)
 +++ head/gnu/usr.bin/gdb/kgdb/main.c	Tue Feb 19 02:09:18 2013	(r246958)
 @@ -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);
  }
 @@ -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",
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
