This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Isn't it OK to drop 'set write'?
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: gdb at sourceware dot org
- Date: Sun, 26 Jul 2015 22:49:05 +0200
- Subject: Isn't it OK to drop 'set write'?
- Authentication-results: sourceware.org; auth=none
Hi,
GDB 'set write on' currently does not work, it has regressed in 7.9:
"set write on" or "--write" corrupt the binary file
https://sourceware.org/bugzilla/show_bug.cgi?id=18168
due to
a485e98ea0cbb61ea9da1e7858da545e0bcf1a46 is the first bad commit
Author: Alan Modra <amodra@gmail.com>
Move ELF section headers to end of object file
$ echo 'int foo=10;int main(){}'|gcc -g -x c -
$ cp -p a.out a.out-orig
$ gdb -q -ex 'set trace-commands on' -ex 'set write on' -ex 'file a.out' -ex 'set foo=20' -ex q
+set write on
+file a.out
Reading symbols from a.out...done.
+set foo=20
+q
Segmentation fault
$ cmp a.out a.out-orig && echo unchanged
unchanged
It is already unsupported for:
writing into executable files is not supported for target: sysroots
I cannot much imagine when it is useful. For updates of too big binaries
there is gold incremental linking. Personally I have also never considered it
safe enough to use it myself, hexedit is there if one needs to create a weird
testfile.
Either there is some use case for that and so the fix should be 7.10 blocker.
Or the feature is no longer useful and it could be dropped which would
significantly simplify me a build-id patchset being prepared.
Jan