Subject: Re: bin/5533: gdb -w is broken.
To: None <mrg@eterna.com.au, netbsd-bugs@NetBSD.ORG>
From: Chris G. Demetriou <cgd@pa.dec.com>
List: netbsd-bugs
Date: 06/03/1998 09:03:34
> 	gdb -w is not able to change values of variables in a kernel.
> 	i used to use `gdb -k -w /netbsd' to do this, but there is no
> 	`-k' to gdb anymore, and you can't do `target kcore' with no
> 	core file :(

I forgot to mention in my previous mail (but it may be obvious from
the mention of --write):

to patch a variable in a kernel binary, all you need is:

gdb --write <kernel>


e.g.:

(gdb) brick# gdb --write /netbsd.new
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (i386-netbsd), Copyright 1996 Free Software Foundation, Inc...
(no debugging symbols found)...
(gdb) print apmdebug
$1 = 0
(gdb) set apmdebug = 2
(gdb) quit
brick# gdb --write /netbsd.new
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (i386-netbsd), Copyright 1996 Free Software Foundation, Inc...
(no debugging symbols found)...
(gdb) print apmdebug
$1 = 2
(gdb) quit


no need for the wacked out set of commands jason posted.  8-)