[lldb-dev] Using DYLD_LIBRARY_PATH and lldb
Haakon Sporsheim via lldb-dev
lldb-dev at lists.llvm.org
Fri Oct 23 01:11:52 PDT 2015
Hi.
I'm fairly new to lldb, been using gdb most of my life.
I'm currently hacking on a small library which I'm building without
installing. Usually I'm running tests for the library also without
installing, but rather using DYLD_LIBRARY_PATH in this manner:
DYLD_LIBRARY_PATH=<mydylibpath> mytestbinary
On linux using gdb when I want to debug an issue I usually just stick
gdb in there, which I can't do with lldb on darwin it seems:
DYLD_LIBRARY_PATH=<mydylibpath> lldb mytestbinary
lldb gives me this result:
(lldb) target create "<mytestbinary>"
Current executable set to '<mytestbinary>' (x86_64).
(lldb) r
Process 4904 launched: '<mytestbinary>' (x86_64)
dyld: Library not loaded: /usr/local/lib/<mydylib>
Referenced from: <mytestbinary>
Reason: image not found
Process 4904 stopped
* thread #1: tid = 0xfe39, 0x00007fff5fc01075 dyld`dyld_fatal_error +
1, stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
frame #0: 0x00007fff5fc01075 dyld`dyld_fatal_error + 1
dyld`dyld_fatal_error:
-> 0x7fff5fc01075 <+1>: nop
dyld`dyldbootstrap::start:
0x7fff5fc01076 <+0>: pushq %rbp
0x7fff5fc01077 <+1>: movq %rsp, %rbp
0x7fff5fc0107a <+4>: pushq %r15
(lldb)
so it's not picking up the dylib from DYLD_LIBRARY_PATH.
I guess my question is whether this is a bug or not? Am I doing
anything wrong, or should I not use DYLD_LIBRARY_PATH this way? Any
suggestions and/or education would be appreciated!
To work around this issue I've used 'install_name_tool -change old new
<mytestbinary>' which obviously works.
Thanks, best regards
Haakon Sporsheim
More information about the lldb-dev
mailing list