[lldb-dev] lldb with app using shared lib not working
Greg Clayton via lldb-dev
lldb-dev at lists.llvm.org
Fri Nov 20 11:34:11 PST 2015
You can else set environment variables when you launch manually:
(lldb) process launch -v DYLD_FRAMEWORK_PATH=/tmp -- arg1 arg2
"env" is nice because it sets it permanently for your target and you don't have to specify it over and over. But it you ever want to _sometimes_ launch with a different framework, the "-v" or "--environemnt" option to process launch can come in handy.
Greg
> On Nov 20, 2015, at 5:06 AM, Andre Alefeld via lldb-dev <lldb-dev at lists.llvm.org> wrote:
>
> FYI,
>
> I found the solution to the problem:
> DYLD_* env variables are purged from the environment due to SIP in El Capitan.
> It is necessary to set any DYLD_* variable settings within (lldb)
>
> e.g.
> lldb -f DARWIN_X64/test_app
> (lldb) target create "DARWIN_X64/test_app"
> Current executable set to 'DARWIN_X64/test_app' (x86_64).
> (lldb) env DYLD_LIBRARY_PATH=<directory where lib lives>
> (lldb) r
>
> then the shared lib is honored as expected inside lldb.
>
>
>
> -------- Forwarded Message --------
> Subject: lldb with app using shared lib not working
> Date: Thu, 19 Nov 2015 13:24:46 +0100
> From: Andre Alefeld <aalefeld at univa.com>
> To: lldb-dev at lists.llvm.org
>
> Hi,
>
> if I try to debug an application from the terminal that is using a
> shared lib lldb complains always about not finding the library even
> though everything is loading correctly when starting the app directly
> from the same terminal:
>
> echo $DYLD_LIBRARY_PATH/
> <some path>
>
> running with debugger, shared lib can be loaded:
> test_app
>
> otool -L DARWIN_X64/test_app
> DARWIN_X64/test_app:
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
> version 1225.1.1)
> libmyapp.dylib (compatibility version 0.0.0, current version 0.0.0)
>
>
>
> lldb -f DARWIN_X64/test_app
> (lldb) target create "DARWIN_X64/test_app"
> Current executable set to 'DARWIN_X64/test_app' (x86_64).
> (lldb) r
> Process 32234 launched: '/Users/xxx/yyy/zzz/source/DARWIN_X64/test_app'
> (x86_64)
> dyld: Library not loaded: libmyapp.dylib
> Referenced from: /Users/xxx/yyy/zzz/source/DARWIN_X64/test_app
> Reason: image not found
> Process 32234 stopped
> * thread #1: tid = 0x85c524, 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
>
>
> how can I achieve that the shared lib is used in the debugger correctly,
> do I have to set some additional environment variables. Is there a
> special r (process launch) syntax that I need to use ?
>
> in gdb it used to work like a charm...
>
> thanks for any help you can deliver in advance,
>
> Andre
>
>
>
>
>
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
More information about the lldb-dev
mailing list