This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdb -write, core dumps


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]