[lldb-dev] Breakpoints from source-before-file are not working

jingham at apple.com jingham at apple.com
Wed Jan 21 10:45:30 PST 2015


When I add a breakpoint like this then before I run the program it is not resolved, but then when I run it does get resolved and hit.  For instance:

 > cat /tmp/address-bkpt.lldb 
break set -a 0x00007fff9223f050
 > lldb Sketch.app/ -S /tmp/address-bkpt.lldb 
(lldb) command source -s 1 '/tmp/address-bkpt.lldb'
(lldb) target create "Sketch.app"
Current executable set to 'Sketch.app' (x86_64).
(lldb) break list
Current breakpoints:
1: address = 0x00007fff9223f050, locations = 1
  1.1: address = 0x00007fff9223f050, unresolved, hit count = 0 

(lldb) run
Process 62885 launched: 'Sketch.app/Contents/MacOS/Sketch' (x86_64)
Process 62885 stopped
* thread #1: tid = 0x2447b6, function: objc_retain , stop reason = breakpoint 1.1
    frame #0: 0x00007fff9223f050 libobjc.A.dylib`objc_retain
->  0x7fff9223f050 <objc_retain>: xorl   %eax, %eax
    0x7fff9223f052 <objc_retain+2>: testq  %rdi, %rdi
    0x7fff9223f055 <objc_retain+5>: je     0x7fff9223f060            ; objc_retain + 16
    0x7fff9223f057 <objc_retain+7>: testb  $0x1, %dil

Address breakpoints are funny before you run, since libraries haven't gotten their correct load addresses, and in fact quite often there's either nothing actually in the address where they WILL load, or many things, because most libraries on OS X are zero based.

So I wouldn't worry too much about what it says before you run.  If it isn't hitting the breakpoint once you actually run, however, that would be worth look into.

Jim


> On Jan 21, 2015, at 6:54 AM, Christian Mayer <christian at fox21.at> wrote:
> 
> Hi list,
> 
> I have a file `lldb.txt` with LLDB commands:
> 
> 	target create PATH/TO/BINARY
> 	br s -a 0x7fff5fc01031
> 	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 `unresolved` but `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.
> 
> 
> Best regards,
> Christian
> 
> -- 
> Christian Mayer
> software developer
> http://fox21.at
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev





More information about the lldb-dev mailing list