Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 08 Feb 2002 07:38:53 +1100 (EST)
From:      Peter Jeremy <peter.jeremy@alcatel.com.au>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   gnu/34709: [patch] Inaccurate GDB documentation
Message-ID:  <200202072038.g17Kcrt79668@gsmx07.alcatel.com.au>

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

>Number:         34709
>Category:       gnu
>Synopsis:       [patch] Inaccurate GDB documentation
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 07 12:40:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Peter Jeremy
>Release:        FreeBSD 4.4-STABLE i386
>Organization:
Alcatel Australia
>Environment:
System: FreeBSD aalp03.alcatel.com.au 4.4-STABLE FreeBSD 4.4-STABLE #0: Wed Dec 19 03:14:51 EST 2001     root@aalp03.alcatel.com.au:/usr/obj/usr/src/sys/wansim  i386

>Description:
	The GDB .info documentation states (node "Patching"):
`set write on'
`set write off'
     If you specify `set write on', GDB opens executable and core files
     for both reading and writing; if you specify `set write off' (the
     default), GDB opens them read-only.

	When in kgdb mode, the "set write" command has no effect.  Instead
	the command line option "-wcore" must be used.  This option is not
	documented in the .info file.  Whilst it is documented in the
	man page, GNU man pages are generally not reliable.

>How-To-Repeat:

aalp03# gdb -k /kernel /dev/mem
GNU gdb 4.18
...
#0  0xc0159bf0 in mi_switch ()
(kgdb) set write on 
(kgdb) exec-file /kernel
(kgdb) core-file /dev/mem
IdlePTD 3457024
initial pcb at 724e000
panic messages:
---
---
#0  0xc0159bf0 in mi_switch ()
(kgdb) x/4x sched_yield+16
0xc01fffa4 <sched_yield+16>:    0x00004eb8      0x5dec8900      0x00768dc3     0x8be58955
(kgdb) print {int}0xc01fffa4 = 0x00004eb8
kvm_write:write failed
(kgdb)
	
>Fix:

	The .info file should be updated to correctly document GDB
	behaviour.  The following patch is untested.

Index: gdb.texinfo
===================================================================
RCS file: /usr/ncvs/src/contrib/gdb/gdb/doc/gdb.texinfo,v
retrieving revision 1.3
diff -u -r1.3 gdb.texinfo
--- gdb.texinfo 2 May 1999 11:25:25 -0000       1.3
+++ gdb.texinfo 7 Feb 2002 20:36:58 -0000
@@ -1266,6 +1266,15 @@
 a signal to display the source code for the frame.
 @end ifclear
 
+@item -kernel
+@itemx -k
+Use gdb in kernel debugging mode.
+The prompt is set to @samp{kgdb}.
+
+@item -wcore
+This option may only be used in kernel debugging mode while debugging
+a ``live'' kernel and makes the corefile @file{/dev/mem} writable.
+
 @ifset SERIAL
 @ifclear HPPA
 @item -b @var{bps}
@@ -7865,6 +7874,9 @@
 @end ifclear
 files for both reading and writing; if you specify @samp{set write
 off} (the default), @value{GDBN} opens them read-only.
+Note that this command has no effect in kernel debugging mode.
+To write to @file{/dev/mem}, you must specift @samp{-wcore} on the
+command line.
 
 If you have already loaded a file, you must load it again (using the
 @code{exec-file}
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202072038.g17Kcrt79668>