From owner-freebsd-bugs Thu Feb 7 12:40:11 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id A541B37B41A for ; Thu, 7 Feb 2002 12:40:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g17Ke1O70802; Thu, 7 Feb 2002 12:40:01 -0800 (PST) (envelope-from gnats) Received: from netau1.alcanet.com.au (ntp.alcanet.com.au [203.62.196.27]) by hub.freebsd.org (Postfix) with ESMTP id 7E65637B41A for ; Thu, 7 Feb 2002 12:38:59 -0800 (PST) Received: from mfg1.cim.alcatel.com.au (mfg1.cim.alcatel.com.au [139.188.23.1]) by netau1.alcanet.com.au (8.9.3 (PHNE_22672)/8.9.3) with ESMTP id HAA13556 for ; Fri, 8 Feb 2002 07:38:57 +1100 (EDT) Received: from gsmx07.alcatel.com.au by cim.alcatel.com.au (PMDF V5.2-32 #37645) with ESMTP id <01KE0V0QH3W05IK0SK@cim.alcatel.com.au> for FreeBSD-gnats-submit@freebsd.org; Fri, 8 Feb 2002 07:39:01 +1100 Received: (from jeremyp@localhost) by gsmx07.alcatel.com.au (8.11.6/8.11.6) id g17Kcrt79668; Fri, 08 Feb 2002 07:38:53 +1100 (EST envelope-from jeremyp) Message-Id: <200202072038.g17Kcrt79668@gsmx07.alcatel.com.au> Date: Fri, 08 Feb 2002 07:38:53 +1100 (EST) From: Peter Jeremy To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: gnu/34709: [patch] Inaccurate GDB documentation Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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 : 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