#644357 gdb segfaults in xstrdup

Package:
gdb
Source:
gdb
Description:
GNU Debugger
Submitter:
"Ph. Marek"
Date:
2011-10-05 07:51:10 UTC
Severity:
normal
#644357#5
Date:
2011-10-05 07:49:12 UTC
From:
To:
I've got a program, that (for the sake of testing) does fork() in a loop; I
want to follow the child.

To work around the bug in
https://lkml.org/lkml/2011/8/16/121
I've tried to set breakpoints at the end of main() and on exit() that use
"commands" to detach from the binary.


But now I get a segfault in gdb.


Sadly there's no gdb-dbg package, so I can only give the raw stack dump:
(gdb) bt
#0  0x0000000000784dba in xstrdup ()
#1  0x00000000004e3634 in ?? ()
#2  0x00000000004e2cd6 in execute_control_command ()
#3  0x000000000052bdde in ?? ()
#4  0x000000000052be70 in bpstat_do_actions ()
#5  0x00000000005afadb in ?? ()
#6  0x00000000005b0181 in ?? ()
#7  0x00007f7c51a5cfe8 in rl_callback_read_char () from /lib/x86_64-linux-
gnu/libreadline.so.6
#8  0x00000000005aef85 in ?? ()
#9  0x00000000005af9c5 in stdin_event_handler ()
#10 0x00000000005adf28 in ?? ()
#11 0x00000000005ad400 in ?? ()
#12 0x00000000005ad4cb in gdb_do_one_event ()
#13 0x00000000005a770e in catch_errors ()
#14 0x00000000004f8ca7 in ?? ()
#15 0x00000000005a7e95 in current_interp_command_loop ()
#16 0x000000000045173b in ?? ()
#17 0x00000000005a770e in catch_errors ()
#18 0x00000000004527e1 in ?? ()
#19 0x00000000005a770e in catch_errors ()
#20 0x0000000000452817 in gdb_main ()
#21 0x000000000045143f in main ()


For reference, here's the file I "source" in gdb:

set follow-fork-mode child
set detach-on-fork off

b exit
commands
detach
inferior 1
end

b *((long)main+232)
commands
detach
inferior 1
end

# and some more breakpoints on "interesting" locations