Subject: kern/36526: ddb(4) doesn't document ddb.commandonenter fully, nor correctly
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Greg A. Woods <woods@planix.com>
List: netbsd-bugs
Date: 06/22/2007 18:50:00
>Number:         36526
>Category:       kern
>Synopsis:       ddb(4) doesn't document ddb.commandonenter fully, nor correctly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 22 18:50:00 +0000 2007
>Originator:     Greg A. Woods
>Release:        netbsd-4
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:
	
	
System: NetBSD 4.0_BETA2
>Description:

	while ddb(4) mentions the compile-time option to set
	DDB_COMMANDONENTER, it does not mention the sysctl variable
	"ddb.commandonenter"

	The example is also bogus, since the ddb(4) command-line parser
	does not actually understand the ";" command separator.

	setting ddb.maxwidth=0 doesn't exactly have the desired effect
	in all cases either.....  for example "help" produces one line
	per command, which is extremely hard to read, especially given
	that the groupings are lost.

>How-To-Repeat:


db{0}> trace; ps
Bad character
cpu_Debugger(c49b7400,0,ce282f38,c0348610,c49b7460) at netbsd:cpu_Debugger+0x4
comintr(c49b7400,0,10,30,10) at netbsd:comintr+0x6f0
Xintr_ioapic_edge4() at netbsd:Xintr_ioapic_edge4+0x9c
--- interrupt ---
netbsd:cpu_switch+0xab:
db{0}> trace;ps
Bad character
cpu_Debugger(c49b7400,0,ce282f38,c0348610,c49b7460) at netbsd:cpu_Debugger+0x4
comintr(c49b7400,0,10,30,10) at netbsd:comintr+0x6f0
Xintr_ioapic_edge4() at netbsd:Xintr_ioapic_edge4+0x9c
--- interrupt ---
netbsd:cpu_switch+0xab:
db{0}> 

	trying it for real with sysctl results in an endless loop that
	cannot be broken out of without a hardware reset or power off

>Fix:

	this hack sort of partly fixes the documentation at least....

	(note that other recent doc fixes still need to be pulled up to
	netbsd-4 too!!!!)

Index: share/man/man4/ddb.4
===================================================================
RCS file: /cvs/master/m-NetBSD/main/src/share/man/man4/ddb.4,v
retrieving revision 1.103
diff -u -r1.103 ddb.4
--- share/man/man4/ddb.4	28 Mar 2007 14:45:35 -0000	1.103
+++ share/man/man4/ddb.4	22 Jun 2007 18:45:41 -0000
@@ -87,10 +87,10 @@
 output to the kernel msgbuf:
 .Cd options DDB_TEE_MSGBUF=1
 .Pp
-To specify commands which will be executed on each entry to
+To specify a command which will be executed on each entry to
 .Ic ddb :
-.Cd options DDB_COMMANDONENTER="trace;show registers"
-In this case, "trace" and then "show registers" will be executed automatically.
+.Cd options DDB_COMMANDONENTER="trace"
+In this case ``trace'' will be executed automatically.
 .Sh DESCRIPTION
 .Nm
 is the in-kernel debugger.
@@ -1180,6 +1180,10 @@
 .Pp
 Built-in variables currently supported are:
 .Bl -tag -offset indent -width "maxwidth" -compact
+.It Va commandonenter
+A command to be run automatically when
+.Nm
+is entered.
 .It Va lines
 The number of lines.
 This is used by the
@@ -1201,7 +1205,7 @@
 wraps the current line by printing new line when
 .Va maxwidth
 column is reached.
-When this varibale is set to zero
+When this variable is set to zero
 .Nm
 doesn't perform any wrapping.
 .It Va onpanic

>Unformatted: