Discussion:
[PATCH] Fix PR gdb/20948: --write option to GDB causes segmentation fault
Jozef Lawrynowicz
2018-09-13 10:55:16 UTC
Permalink
When opening a BFD for update, as gdb --write does, modifications to
anything but the contents of sections is restricted.

Do not try to write back any ELF headers in this case.

Successfully tested with no regressions on x86_64-pc-linux-gnu with
the binutils, gas, ld and gdb testsuites.

The PR is assigned to GDB, but the fix is to BFD, hence the
submission to binutils mailing list instead of GDB.
Nick Clifton
2018-09-17 16:01:02 UTC
Permalink
Hi Jozef,
Post by Jozef Lawrynowicz
The PR is assigned to GDB, but the fix is to BFD, hence the
submission to binutils mailing list instead of GDB.
The BFD part of your patch is approved.

Cheers
Nick
Tom Tromey
2018-09-17 16:13:51 UTC
Permalink
Jozef> The PR is assigned to GDB, but the fix is to BFD, hence the
Jozef> submission to binutils mailing list instead of GDB.

Jozef> * gdb/testsuite/gdb.base/write_mem.exp: New test.
Jozef> * gdb/testsuite/gdb.base/write_mem.c: Likewise.

The ChangeLog entries have to be split into the appropriate directories.

Jozef> diff --git a/gdb/testsuite/gdb.base/write_mem.c b/gdb/testsuite/gdb.base/write_mem.c
Jozef> new file mode 100644
Jozef> index 0000000..941f172
Jozef> --- /dev/null
Jozef> +++ b/gdb/testsuite/gdb.base/write_mem.c
Jozef> @@ -0,0 +1,7 @@
Jozef> +/* Test for PR gdb/20948. */

Both new gdb files need the GPL header.
You can copy one from some other test file.

Jozef> +if {[build_executable $testfile.exp $testfile \
Jozef> + $srcfile [list debug nowarnings] ] == -1} {

The indentation of this line looks off to me.
I would suggest checking other examples to see how it should look.

This is ok with these things fixed. Thank you for the patch.

Tom
Jozef Lawrynowicz
2018-09-23 19:45:37 UTC
Permalink
Post by Tom Tromey
Jozef> The PR is assigned to GDB, but the fix is to BFD, hence the
Jozef> submission to binutils mailing list instead of GDB.
Jozef> * gdb/testsuite/gdb.base/write_mem.exp: New test.
Jozef> * gdb/testsuite/gdb.base/write_mem.c: Likewise.
The ChangeLog entries have to be split into the appropriate directories.
Jozef> diff --git a/gdb/testsuite/gdb.base/write_mem.c b/gdb/testsuite/gdb.base/write_mem.c
Jozef> new file mode 100644
Jozef> index 0000000..941f172
Jozef> --- /dev/null
Jozef> +++ b/gdb/testsuite/gdb.base/write_mem.c
Jozef> +/* Test for PR gdb/20948. */
Both new gdb files need the GPL header.
You can copy one from some other test file.
Jozef> +if {[build_executable $testfile.exp $testfile \
Jozef> + $srcfile [list debug nowarnings] ] == -1} {
The indentation of this line looks off to me.
I would suggest checking other examples to see how it should look.
This is ok with these things fixed. Thank you for the patch.
Tom
Thanks for the review, the updated patch is attached. I would appreciate
it if someone would commit the patch for me, as I do not have write
access. Jozef
Tom Tromey
2018-09-24 12:22:34 UTC
Permalink
Jozef> Thanks for the review, the updated patch is attached. I would
Jozef> appreciate it if someone would commit the patch for me, as I do not
Jozef> have write access.

I've pushed it. Thanks once again for the patch.

Tom

Loading...