Hi,
It was just theoretical issue I speculated about, because I was trying to find reason why Unwind ThreadPlan for any other thread than thread group leader fails - and this seems to be already created and cached.
If you want to give it a shot, I’ll attach one of my puppets (10 threads, doing nothing but sleep).
Also I use bfd linker so it has nothing to do with gold in my case.
core was created by kernel (ulimit -c unlimited; kill -3 IIRC)
Please note strange backtraces (clearly .text is not accessible):
(lldb) target create a.out -c core.9025
Core file ‘/home/prak/soft/test/core.9025’ (x86_64) was loaded.
Process 0 stopped
- thread #1: tid = 0, 0x00007fddcd16b4a2 libpthread.so.0
pthread_join + 162, name = 'a.out', stop reason = signal SIGQUIT frame #0: 0x00007fddcd16b4a2 libpthread.so.0
pthread_join + 162
libpthread.so.0pthread_join + 162: -> 0x7fddcd16b4a2: addb %al, (%rax) 0x7fddcd16b4a4: addb %al, (%rax) 0x7fddcd16b4a6: addb %al, (%rax) 0x7fddcd16b4a8: addb %al, (%rax) thread #2: tid = 1, 0x00007fddcc867aad libc.so.6, stop reason = signal SIGQUIT frame #0: 0x00007fddcc867aad libc.so.6 libc.so.6
??? + 45:
→ 0x7fddcc867aad: addb %al, (%rax)
libc.so.6`??? + 47:
0x7fddcc867aaf: addb %al, (%rax)
libc.so.6`??? + 49:
0x7fddcc867ab1: addb %al, (%rax)
libc.so.6`??? + 51:
0x7fddcc867ab3: addb %al, (%rax)
thread #3: tid = 2, 0x00007fddcc867aad libc.so.6, stop reason = signal SIGQUIT
frame #0: 0x00007fddcc867aad libc.so.6
and so on it goes for other threads, what looks in memory like 0x00 …
We managed to unwind main thread though.
bt
- thread #1: tid = 0, 0x00007fddcd16b4a2 libpthread.so.0`pthread_join + 162, name = ‘a.out’, stop reason = signal SIGQUIT
- frame #0: 0x00007fddcd16b4a2 libpthread.so.0
pthread_join + 162 frame #1: 0x0000000000469c77 a.out
std:
:join() + 39
frame #2: 0x0000000000433e0b a.outmain + 162 at main.cc:30 frame #3: 0x00007fddcc7d2b05 libc.so.6
__libc_start_main + 245
frame #4: 0x0000000000433b81 a.out`_start + 41
(lldb) thread 2
invalid command ‘thread 2’
(lldb) thread select 2
- thread #2: tid = 1, 0x00007fddcc867aad libc.so.6, stop reason = signal SIGQUIT
frame #0: 0x00007fddcc867aad libc.so.6
libc.so.6`??? + 45:
→ 0x7fddcc867aad: addb %al, (%rax)
libc.so.6`??? + 47:
0x7fddcc867aaf: addb %al, (%rax)
libc.so.6`??? + 49:
0x7fddcc867ab1: addb %al, (%rax)
libc.so.6`??? + 51:
0x7fddcc867ab3: addb %al, (%rax)
- thread #2: tid = 1, 0x00007fddcc867aad libc.so.6, stop reason = signal SIGQUIT
frame #0: 0x00007fddcc867aad libc.so.6
libc.so.6`??? + 45:
→ 0x7fddcc867aad: addb %al, (%rax)
libc.so.6`??? + 47:
0x7fddcc867aaf: addb %al, (%rax)
libc.so.6`??? + 49:
0x7fddcc867ab1: addb %al, (%rax)
libc.so.6`??? + 51:
0x7fddcc867ab3: addb %al, (%rax)
image dump sections
Dumping sections for 6 modules.
Sections for ‘/home/prak/soft/test/a.out’ (x86_64):
SectID Type Load Address File Off. File Size Flags Section Name
…
0x0000000e code [0x0000000000433840-0x000000000048b7b2) 0x00033840 0x00057f72 0x00000006 a.out…text
…
Sections for ‘/usr/lib/libc.so.6’ (x86_64):
SectID Type Load Address File Off. File Size Flags Section Name
…
0x0000000d code [0x00007fddcc7d0490-0x00007fddcc8fb253) 0x0001f490 0x0012adc3 0x00000006 libc.so.6…text
…
(lldb) memory read 0x0000000000433840
0x00433840: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …
0x00433850: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …
(lldb) x 0x00007fddcceb9510
0x7fddcceb9510: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …
0x7fddcceb9520: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …
Other sections from ELF’s are not there too.
Some single threaded program like /usr/bin/sleep fail with core created by linux kernel, yet fine while created by gcore (may it add .text section to core? - x <address of .text> seems fine then)
I’ve noticed that all Target::ReadMemory and friends go directly to Process instead of trying to read from Modules.
That’s probably no probably no problem for plugins like POSIXProcess and derived since those have everything mapped in memory, and can read it anyway.
Today I won’t pursue it any more, since it is past my bedtime already, but I’ll tinker with that bit more probably during weekend.
Thanks,
/Piotr
main.cc (384 Bytes)