Re: [PATCH v2] Make only user-specified executable and symbol filenames sticky

Philippe Waroquiers
2015-06-07T12:03:19Z

On Fri, 2015-06-05 at 12:22 +0100, Gary Benson wrote:
> Built and regtested on RHEL6.6 x86_64.
I also tested the patch (unmodified, i.e. keeping the !fake_pid_p test)
with 'native' attach/detach.
I have encountered some problems.

Here is the test I am doing:
In one terminal, I launch
/bin/sleep 10000
In another terminal, I am launching
./gdbserver_tests/sleepers 1000000 1000000 1000000 BSBSBSBS
(sleepers is a program used for testing Valgrind gdbsrv).

Then I used the patched GDB to attach first to sleep, then detach,
then attach to sleepers, then detach, then attach again to sleep.
The 3 attach does not work properly: it believes it has to use
the sleepers executable, asks to switch to this symbol file,
and then GDB locks, and I have to kill it.

Philippe

(gdb) atta 27434
Attaching to process 27434
Reading symbols from /bin/sleep...(no debugging symbols found)...done.
warning: Cannot call inferior functions on this system - Linux kernel
with broken i386 NX (non-executable pages) support detected!
Reading symbols from /lib/libc.so.6...(no debugging symbols
found)...done.
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols
found)...done.
0x00dab416 in __kernel_vsyscall ()
(gdb) detach
Detaching from program: /bin/sleep, process 27434
(gdb) attach 27393
Attaching to program: /bin/sleep, process 27393
Reading symbols
from /home/philippe/valgrind/trunk_untouched/gdbserver_tests/sleepers...done.
Reading symbols from /lib/libpthread.so.0...(no debugging symbols
found)...done.
[New LWP 27396]
[New LWP 27395]
[New LWP 27394]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
Reading symbols from /lib/libc.so.6...(no debugging symbols
found)...done.
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols
found)...done.
0x00843416 in __kernel_vsyscall ()
(gdb) detach
Detaching from
program: /home/philippe/valgrind/trunk_untouched/gdbserver_tests/sleepers, process 27393
(gdb) atta 27434
Attaching to
program: /home/philippe/valgrind/trunk_untouched/gdbserver_tests/sleepers, process 27434
Load new symbol table from "/bin/sleep"? (y or n)
//////////// here GDB does not respond anymore.