NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/48743: gdb: quitting after attaching to process doesn't work

>Number:         48743
>Category:       toolchain
>Synopsis:       gdb: quitting after attaching to process doesn't work
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 13 18:10:00 +0000 2014
>Originator:     Thomas Klausner
>Release:        NetBSD 6.99.40
Curiosity is the very basis of education and if you tell me that 
curiosity killed the cat, I say only that the cat died nobly.
- Arnold Edinborough
Architecture: x86_64
Machine: amd64
I was just looking at an I think single-threaded program. Just
attached to a running process and did 'thread apply all bt' which just
gave me one thread's backtrace.

Then I tried leaving gdb:

(gdb) quit
A debugging session is active.

        Inferior 1 [LWP 0] will be detached.

Quit anyway? (y or n) y

/archive/foreign/src/external/gpl3/gdb/dist/gdb/thread.c:615: internal-error: 
int is_thread_state(ptid_t, enum thread_state): Assertion `tp' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y
/archive/foreign/src/external/gpl3/gdb/dist/gdb/thread.c:615: internal-error: 
int is_thread_state(ptid_t, enum thread_state): Assertion `tp' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) y
sorry, pid 860 was killed: orphaned traced process
zsh: abort (core dumped)  gdb debugallocation_test 860
# gdb gdb.core
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64--netbsd".
For bug reporting instructions, please see:
Reading symbols from /usr/bin/gdb...done.
[New process 1]

warning: Can't read pathname for load map: Input/output error.
Core was generated by `gdb'.
Program terminated with signal 6, Aborted.
#0  0x00007f7ff552322a in _lwp_kill () from /usr/lib/
(gdb) bt
#0  0x00007f7ff552322a in _lwp_kill () from /usr/lib/
#1  0x00007f7ff5522e5b in abort () at 
#2  0x00000000004cc096 in dump_core () at 
#3  0x00000000004c801a in internal_vproblem (problem=<optimized out>, 
file=<optimized out>, line=<optimized out>, fmt=<optimized out>, ap=<optimized 
    at /archive/foreign/src/external/gpl3/gdb/dist/gdb/utils.c:929
#4  0x00000000004c7d7c in internal_verror (file=0x6 <Address 0x6 out of 
bounds>, line=0, fmt=0x7f7ff552322a <_lwp_kill+10> "r\001\303\351\016", ap=0x3e)
    at /archive/foreign/src/external/gpl3/gdb/dist/gdb/utils.c:944
#5  0x00000000004c76a4 in internal_error (file=0x1 <Address 0x1 out of bounds>, 
warning: Unmapped DWARF Register #-2 encountered.
line=<error reading variable: Unable to access DWARF register number 
0xfffffffe>, string=0x0)
    at /archive/foreign/src/external/gpl3/gdb/dist/gdb/utils.c:954
#6  0x000000000053562c in is_thread_state (state=<optimized out>, ptid=..., 
state=<optimized out>) at 
#7  is_stopped (ptid=...) at 
#8  make_cleanup_restore_current_thread () at 
#9  0x00000000004a9c54 in save_current_space_and_thread () at 
#10 0x00000000004522eb in prepare_re_set_context (b=<optimized out>) at 
#11 breakpoint_re_set_one (bint=0x7f7ff7b3b400) at 
#12 0x00000000004a1815 in catch_errors (func=0x4522d0 <breakpoint_re_set_one>, 
func_args=0x7f7ff7b3b400, errstring=0x7f7ff77399e0 "Error in re-setting 
breakpoint -3: ", mask=6)
    at /archive/foreign/src/external/gpl3/gdb/dist/gdb/exceptions.c:546
#13 0x000000000044eb3b in breakpoint_re_set () at 
#14 0x000000000041923c in clear_symtab_users (add_flags=<optimized out>) at 
#15 0x00000000004197ed in symbol_file_clear (from_tty=0) at 
#16 0x000000000055f903 in nbsd_thread_detach (ops=0xabfe08 <nbsd_thread_ops>, 
args=0x0, from_tty=1) at 
#17 0x000000000050f019 in target_detach (args=0x0, from_tty=1) at 
#18 0x00000000004cdcf3 in kill_or_detach (inf=<optimized out>, 
args=0x7f7fffffd1e8) at 
#19 0x00000000004aca69 in iterate_over_inferiors (callback=0x4cdca0 
<kill_or_detach>, data=0x7f7fffffd1e8) at 
#20 0x00000000004cd254 in quit_target (arg=0x6) at 
#21 0x00000000004a1815 in catch_errors (func=0x4cd240 <quit_target>, 
func_args=0x7f7fffffd1e8, errstring=0x70bdcf "Quitting: ", mask=6) at 
#22 0x00000000004cd230 in quit_force (args=0x0, from_tty=1) at 
#23 0x00000000004cc4bb in execute_command (p=0x6ebabf "", from_tty=<optimized 
out>) at /archive/foreign/src/external/gpl3/gdb/dist/gdb/top.c:484
#24 0x000000000052ad82 in command_handler (command=0x0) at 
#25 0x000000000052a9ca in command_line_handler (rl=<optimized out>) at 
#26 0x0000000000689933 in rl_callback_read_char () at 
#27 0x000000000052a8a9 in rl_callback_read_char_wrapper (client_data=0x1) at 
#28 0x000000000052b55c in process_event () at 
#29 0x000000000052b488 in gdb_do_one_event () at 
#30 0x000000000052b995 in start_event_loop () at 
#31 0x00000000004074d3 in captured_command_loop (data=0x1) at 
#32 0x00000000004a1815 in catch_errors (func=0x4074c0 <captured_command_loop>, 
func_args=0x0, errstring=0x6f5a4b "", mask=6) at 
#33 0x0000000000406fd6 in captured_main (data=<optimized out>) at 
#34 0x00000000004a1815 in catch_errors (func=0x406200 <captured_main>, 
func_args=0x7f7fffffd560, errstring=0x6f5a4b "", mask=6) at 
#35 0x00000000004061f7 in gdb_main (args=0x0) at 
#36 0x0000000000406116 in main (argc=<optimized out>, argv=0x6) at 

On NetBSD-6.99.32/amd64 from Sunday, and still on 6.99.40/amd64 from today.
All compiled with clang, in case it matters.

start a program, e.g.

While it's running, attach to it using
gdb python2.7 <PID>

leave gdb by pressing 'q'

It does work for /bin/cat, so it's not all programs that are broken this way,
but all programs I wanted to debug :)



Home | Main Index | Thread Index | Old Index