-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inferior process exits due to SIGTRAP on FreeBSD after detach, or exiting LLDB #19268
Comments
assigned to @emaste |
the breakpoint is not cleaned up upon detach (lldb) log enable lldb break Added location: 1.1: Breakpoint 1: where = ls`main + 9 at ls.c:166, address = 0x0000000000403069 Process::EnableSoftwareBreakpoint (site_id = 1) addr = 0x401dc0 ... ptrace(PT_GETREGS, 103027, 0x7fffff9fcdd0, 0) called from file ../tools/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp line 309 |
Initial fix in 201724 There is still an issue when quitting LLDB. |
quitting while stopped at a breakpoint looks like this (with log enable freebsd ptrace & lldb process): (lldb) quit Went to stop the private state thread, but it was already invalid. |
It seems ProcessPOSIX::DoDestroy is incomplete; this PoC patch addresses the aborting debugees and the delayed quit: --- a/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
After this there are two new failures, related to "process kill": test_state_after_continue_with_dwarf (TestThreadStates.ThreadStateTestCase) Need to determine exactly what is appropriate for DoDestroy. |
Change committed to FreeBSD in http://svnweb.freebsd.org/changeset/base/263678 |
Committed in r205315 and r205337 |
Extended Description
Invoke lldb against some target e.g. /bin/sleep, set a breakpoint, run, then detach when the breakpoint is hit. The inferior dumps core with SIGTRAP.
(LLDB r201577)
Typescript:
joule% bin/lldb /bin/sleep 60
Current executable set to '/bin/sleep' (x86_64).
(lldb) b main
Breakpoint 1: where = sleep`main + 20 at sleep.c:75, address = 0x0000000000400964
(lldb) run
Process 26485 launching
Process 26485 stopped
(lldb) Process 26485 launched: '/bin/sleep' (x86_64)
Process 26485 stopped
main(argc=<unavailable>, argv=0x00007fffffffd730) + 20 at sleep.c:75, stop reason = breakpoint 1.1 frame #​0: 0x0000000000400964 sleep
main(argc=, argv=0x00007fffffffd730) + 20 at sleep.c:7572 if (argc != 2)
73 usage();
74
-> 75 if (sscanf(argv[1], "%lf%1s", &d, buf) != 1)
76 usage();
77 if (d > INT_MAX)
78 usage();
(lldb) detach
Process 26485 detached
(lldb) Detaching from process 26485
(lldb) quit
joule% ls sleep.core
sleep.core
joule% bin/lldb /bin/sleep -c sleep.core
Core file '/data/emaste/src/llvm/build/sleep.core' (x86_64) was loaded.
Process 0 stopped
main(argc=<unavailable>, argv=0x00007fffffffd730) + 21 at sleep.c:75, name = 'sleep', stop reason = signal SIGTRAP frame #​0: 0x0000000000400965 sleep
main(argc=, argv=0x00007fffffffd730) + 21 at sleep.c:7572 if (argc != 2)
73 usage();
74
-> 75 if (sscanf(argv[1], "%lf%1s", &d, buf) != 1)
76 usage();
77 if (d > INT_MAX)
78 usage();
(lldb)
The text was updated successfully, but these errors were encountered: