svr4_relocate_main_executable() bails out without doing anything if it detects prior existing relocation offsets have been applied. A comment there states that this is done so that preference is given to relocation offsets specified by qOffsets packet processing, which occurs earlier. Now suppose I start gdb and do: 1. Issue "target remote /dev/ttyS0" 2. GDB attaches, reads auxv and relocates via svr4_relocate_main_executable() 3. Issue "detach" 4. Issue "target remote /dev/ttyS1" 5. GDB attaches, reads auxv (relocation is different than above) 6. GDB bails out of svr4_relocate_main_executable() without relocating. 7. GDB uses the relocation data from the original connection, not the current one. Note that if the remote stub supports "qOffsets" (not required), then the processing of that response relocates the executable using that mechanism.
I believe this problem should be fixed by: ping: [patch 6/6] PIE: Fix back re-run http://sourceware.org/ml/gdb-patches/2010-06/msg00236.html [ You should apply all 6 patches of the series. ] It should get finally checked-in these days after 3 months of reviewing process.
Jan -- will this change be in time for the 7.2 release?
Yes, it is listed as a 7.2 blocker: http://sourceware.org/gdb/wiki/GDB_7.2_Release
Subject: Bug 11776 CVSROOT: /cvs/src Module name: src Changes by: jkratoch@sourceware.org 2010-07-05 18:04:33 Modified files: gdb : ChangeLog solib-svr4.c gdb/testsuite : ChangeLog gdb/testsuite/gdb.base: break-interp.exp Log message: gdb/ Fix re-run of PIE executable, PR shlibs/11776. * solib-svr4.c (svr4_relocate_main_executable) <symfile_objfile>: Remove the part of pre-set SYMFILE_OBJFILE->SECTION_OFFSETS. gdb/testsuite/ Fix re-run of PIE executable, PR shlibs/11776. * gdb.base/break-interp.exp (test_ld): Turn off "disable-randomization". Remove $displacement_main to match the solib-svr4.c change. New "kill" and re-"run" of the inferior. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.11966&r2=1.11967 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/solib-svr4.c.diff?cvsroot=src&r1=1.136&r2=1.137 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.2375&r2=1.2376 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/break-interp.exp.diff?cvsroot=src&r1=1.17&r2=1.18
The bug should be fixed now.