[lldb-dev] Stopping "stop reason = exec"
Jim Ingham via lldb-dev
lldb-dev at lists.llvm.org
Mon Dec 4 18:18:22 PST 2017
Yup, apparently debugserver tells us the stop is for exec directly so we don't treat it as a breakpoint hit. That sorta makes sense, you don't want to trigger a breakpoint hit every time you find a thread at the pc of a breakpoint (might be a thread that hit a breakpoint, then didn't get to run till the next stop.) But it defeats the obvious method.
Anyway, it is a program stop, so you can use a stop hook:
(lldb) target stop-hook add -n _dyld_start -o continue
That one does work, though the stop-hook output is a little ugly. It would also be nice to specify stop-hooks by stop reason too. But this method does work...
Jim
> On Dec 4, 2017, at 4:36 PM, Chris Lattner <sabre at nondot.org> wrote:
>
>> On Dec 4, 2017, at 4:25 PM, Chris Lattner <sabre at nondot.org> wrote:
>>> For macOS, you can also just do:
>>>
>>> (lldb) break set -n _dyld_start --skip-prologue 0 -s dyld
>>> Breakpoint 2: where = dyld`_dyld_start, address = 0x000000010000b19c
>>> (lldb) b com add -o continue
>>> either in your .lldbinit or in your debug session.
>>
>> This doesn’t appear to work, I tried both lldb and in a debug session. I’m starting lldb with “lldb -- swiftc … “ if that matters.
>>
>> (lldb) break set -n _dyld_start --skip-prologue 0 -s dyld
>> Breakpoint 1: where = dyld`_dyld_start, address = 0x0000000000001000
>> (lldb) b com add -o continue
>> Breakpoint 2: no locations (pending).
>> WARNING: Unable to resolve breakpoint to any actual locations.
>
> I realize that this is probably because you’re not using the standard ‘b’ alias. When I use ‘br’, the command succeeds, but I still stop on launch:
>
> (lldb) br com add -o continue
> (lldb) r
> There is a running process, kill it and restart?: [Y/n] y
> Process 24049 exited with status = 9 (0x00000009)
> Process 24054 launched: '/Users/clattner/Projects/build/Xcode-ReleaseAssert+swift-DebugAssert/swift-macosx-x86_64/Debug/bin/swiftc' (x86_64)
> Process 24054 stopped
> * thread #2, stop reason = exec
> frame #0: 0x0000000109852000 dyld`_dyld_start
> dyld`_dyld_start:
> -> 0x109852000 <+0>: popq %rdi
> 0x109852001 <+1>: pushq $0x0
> 0x109852003 <+3>: movq %rsp, %rbp
> 0x109852006 <+6>: andq $-0x10, %rsp
> Target 0: (swiftc) stopped.
>
>
> Thank you for the help, I appreciate it!
>
> -Chris
>
More information about the lldb-dev
mailing list