[Lldb-commits] [PATCH] D32149: Correct handling NetBSD core(5) files with threads
Kamil Rytarowski via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Apr 17 18:43:45 PDT 2017
krytarowski created this revision.
krytarowski added a project: LLDB.
Correct detection of the NetBSD specific core(5) files.
The original code was apparently copied from FreeBSD
and it was buggy, because these BSDs are different and
do not share the same ELF layout for core(5) files.
Split ProcessElfCore::ParseThreadContextsFromNoteSegment
into two functions: NetBSD-specific and Generic. I presume
that other BSDs should follow this or share concepts with
NetBSD. The Linux threading and NOTE layout is very different
to the NetBSD one, and it is not easily doable, without a
monstrous design, to introduce there support for threads.
OpenBSD could reuse NetBSD code and perhaps share the same
functions, as these systems have very similar ELF core(5) layout.
Obligatory demo:
(lldb) target create "/usr/pkg/bin/rtorrent" --core "rtorrent.core"
Core file '/public/lldb_devel/rtorrent.core' (x86_64) was loaded.
(lldb) thread list
Process 0 stopped
* thread #1: tid = 3, 0x00007a59d623b51a libc.so.12`_sys___kevent50 + 10, stop reason = signal SIGSTOP
thread #2: tid = 2, 0x00007a59d623b51a libc.so.12`_sys___kevent50 + 10, stop reason = signal SIGSTOP
thread #3: tid = 1, 0x00007a59d623b21a libc.so.12`__select50 + 10, stop reason = signal SIGSTOP
(lldb) thread select 2
* thread #2, stop reason = signal SIGSTOP
frame #0: 0x00007a59d623b51a libc.so.12`_sys___kevent50 + 10
libc.so.12`_sys___kevent50:
-> 0x7a59d623b51a <+10>: addb %al, (%rax)
0x7a59d623b51c <+12>: addb %al, (%rax)
0x7a59d623b51e <+14>: addb %al, (%rax)
0x7a59d623b520 <+16>: addb %al, (%rax)
(lldb) bt
* thread #2, stop reason = signal SIGSTOP
* frame #0: 0x00007a59d623b51a libc.so.12`_sys___kevent50 + 10
frame #1: 0x00007a59d6606c97 libpthread.so.1`__kevent50(fd=<unavailable>, ev=<unavailable>, nev=<unavailable>, rev=<unavailable>, nrev=<unavailable>, ts=<unavailable>) at pthread_cancelstub.c:176
frame #2: 0x00007a59d91167f2 libtorrent.so.19`torrent::PollKQueue::poll(this=0x00007a59da153200, msec=10001) at poll_kqueue.cc:167
frame #3: 0x00007a59d9116d98 libtorrent.so.19`torrent::PollKQueue::do_poll(this=0x00007a59da153200, timeout_usec=10000000, flags=1) at poll_kqueue.cc:268
frame #4: 0x00007a59d91396d6 libtorrent.so.19`torrent::thread_base::event_loop(thread=0x00007a59da1a6700) at thread_base.cc:174
frame #5: 0x00007a59d660b6e1 libpthread.so.1`pthread__create_tramp(cookie=0x00007a59da1fd000) at pthread.c:576
frame #6: 0x00007a59d6287ac0 libc.so.12
Sponsored by <The NetBSD Foundation>
Repository:
rL LLVM
https://reviews.llvm.org/D32149
Files:
source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
source/Plugins/Process/elf-core/ProcessElfCore.cpp
source/Plugins/Process/elf-core/ProcessElfCore.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32149.95522.patch
Type: text/x-patch
Size: 14439 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170418/6107d394/attachment-0001.bin>
More information about the lldb-commits
mailing list