[This post was originally posted as a Stackoverflow question.]
I have a file
lldb.txt with LLDB commands:
target create PATH/TO/BINARY br s -a 0x7fff5fc01031 br li process launch --stop-at-entry
So I can start debugging a program with
lldb -S lldb.txt. After launch the debugger stops at 0x7fff5fc01000 (under Mac OS X 10.10) in dyld. As you can see I want to stop at breakpoint 0x7fff5fc01031 in dyld.
The breakpoint is
locations = 1.
[lldb]> breakpoint list Current breakpoints: 1: address = 0x00007fff5fc01031, locations = 1 1.1: address = 0x00007fff5fc01031, unresolved, hit count = 0
When I add the breakpoint manually then it’s resolved.
[lldb]> br s -a 0x7fff5fc01031 Breakpoint 2: where = dyld`_dyld_start + 49, address = 0x00007fff5fc01031 [lldb]> breakpoint list Current breakpoints: 1: address = 0x00007fff5fc01031, locations = 1 1.1: address = 0x00007fff5fc01031, unresolved, hit count = 0 2: address = 0x00007fff5fc01031, locations = 1, resolved = 1, hit count = 0 2.1: where = dyld`_dyld_start + 49, address = 0x00007fff5fc01031, resolved, hit count = 0
How can I add a breakpoint in my
lldb.txt file which will be automatically resolved?
I don’t know if this is a bug or if I’m doing it wrong with breakpoints. I already checked out the newest version (lldb-330.99.0) from the LLDB Git repository and compiled it with
xcodebuild. But it’s still unresolved.
Update, 2015-01-22 00:13: See the mailing list discussion. By the way, the TOT expression used in the discussion stands for Top of Tree.
Update, 2015-01-24 16:56: The first breakpoint from the source file (
lldb.txt) which will work is after all images has been linked. This is in
dyld.cpp at function
link(sMainExecutable, sEnv.DYLD_BIND_AT_LAUNCH, true, ImageLoader::RPathChain(NULL, NULL));
I reported bug #22323 to the bugtracker.
Update, 2015-03-05: It seems that they deleted my question on Stackoverflow.