This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
gdb -write, core dumps
- From: Nitin Gupta <toolchain at gmail dot com>
- To: gdb at sources dot redhat dot com
- Date: Wed, 2 Mar 2005 15:45:53 -0800
- Subject: gdb -write, core dumps
- Reply-to: Nitin Gupta <toolchain at gmail dot com>
I see that "gdb -write" is doing a core dump, while modifying the binary.
I see this problem on gdb-6.1 as well as on gdb-6.3
Any suggestion on what I might be doing wrong?
foo.c:
volatile int i=4;
main() { }
gcc -g foo.c -o foo
Then, patch the global variable:
gdb -write foo
.....
(gdb) p i
$1 = 4
(gdb) p i=3
$2 = 3
(gdb) q
Segmentation fault