[Lldb-commits] [lldb] Allow option to ignore module load errors in ScriptedProcess (PR #127153)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Tue Feb 18 00:15:32 PST 2025
labath wrote:
> I'm not convinced of that this change needs to be happen in ScriptedProcess ... May be we could have a setting to not discard all modules loaded in case 1 of them failed to load that would also work with other Process plugins. @jimingham what do you think ?
I'm confused. Isn't that already what happens for non-scripted processes?
```
$ lldb -n a.out -o "image list" -b
(lldb) process attach --name "a.out"
Process 11191 stopped
* thread #1, name = 'a.out', stop reason = signal SIGSTOP
frame #0: 0x00007f7083e088e4 libc.so.6`pause + 20
libc.so.6`pause:
-> 0x7f7083e088e4 <+20>: cmpq $-0x1000, %rax ; imm = 0xF000
0x7f7083e088ea <+26>: ja 0x7f7083e08920 ; <+80>
0x7f7083e088ec <+28>: retq
0x7f7083e088ed <+29>: nopl (%rax)
Executable module set to "/tmp/X/a.out".
Architecture set to: x86_64-pc-linux-gnu.
(lldb) image list
[ 0] 171A52C4 0x000056532dec0000 /tmp/X/a.out
[ 1] 421DCFD2-138A-B321-D6F1-7AFD7B7FC999-F79CA445 0x00007ffdeb3a5000 [vdso] (0x00007ffdeb3a5000)
[ 2] 838926F7 0x00007f7083f45000 libb.so <====== LIBB.SO HERE
[ 3] C88DE6C8 0x00007f7083d1f000 /lib64/libc.so.6
/usr/lib/debug/lib64/libc.so.6.debug
[ 4] D626A570 0x00007f7083f4c000 /lib64/ld-linux-x86-64.so.2
$ rm libb.so <========= FILE DELETED
$ lldb -n a.out -o "image list" -b
(lldb) process attach --name "a.out"
Process 11191 stopped
* thread #1, name = 'a.out', stop reason = signal SIGSTOP
frame #0: 0x00007f7083e088e4 libc.so.6`pause + 20
libc.so.6`pause:
-> 0x7f7083e088e4 <+20>: cmpq $-0x1000, %rax ; imm = 0xF000
0x7f7083e088ea <+26>: ja 0x7f7083e08920 ; <+80>
0x7f7083e088ec <+28>: retq
0x7f7083e088ed <+29>: nopl (%rax)
Executable module set to "/tmp/X/a.out".
Architecture set to: x86_64-pc-linux-gnu.
(lldb) image list <===== LIBB.SO MISSING (BUT OTHER MODULES STILL THERE)
[ 0] 171A52C4 0x000056532dec0000 /tmp/X/a.out
[ 1] 421DCFD2-138A-B321-D6F1-7AFD7B7FC999-F79CA445 0x00007ffdeb3a5000 [vdso] (0x00007ffdeb3a5000)
[ 2] C88DE6C8 0x00007f7083d1f000 /lib64/libc.so.6
/usr/lib/debug/lib64/libc.so.6.debug
[ 3] D626A570 0x00007f7083f4c000 /lib64/ld-linux-x86-64.so.2
```
I got this on linux. On darwin, the module might still be present because it might be read from process memory directly. Still, if that failed for some reason (perhaps because instead of a live process we were dealing with a core file -- one which does not include the module contents in the dump), I would expect other modules to be present.
Rejecting all of them because one couldn't be found seems to go against our "do our best to keep going with limited info" philosophy.
https://github.com/llvm/llvm-project/pull/127153
More information about the lldb-commits
mailing list