Thanks for explaining that. I really have no ideia why it’s failing. I’m getting this, on the breakpoint log (when issuing the “process load” command):
Process 84650 resuming
<lldb.driver.main-thread> Target::CreateBreakpoint (internal = yes) => break_id = -8: address = 0x0000000100000d70
<lldb.driver.main-thread> Target::RemoveBreakpointByID (break_id = -4, internal = yes)
<lldb.driver.main-thread> Target::DisableBreakpointByID (break_id = -4, internal = yes)
error: failed to load ‘~/src/tests/libmylib.dyld’: Execution was interrupted, reason: breakpoint site 8.
The process has been returned to the state before execution.
(lldb)
I suppose that a line would be printed if a breakpoint was hit, which is even weirder. I’ve tried to dlopen that dylib with gdb (loading the program, stopping at the same spot, executing ‘call dlopen(…)’ like the call lldb does), and it works. Calling dlopen with an expr command on lldb also works, and that one triggers the dyld breakpoint site that you talked about (location -1.1):
(lldb) expr (int)dlopen("/Users/filipe/src/tests/libmylib.dylib", 1)
<lldb.driver.main-thread> Target::CreateBreakpoint (internal = yes) => break_id = -9: address = 0x0000000100000d70
<lldb.driver.main-thread> Target::RemoveBreakpointByID (break_id = -8, internal = yes)
<lldb.driver.main-thread> Target::DisableBreakpointByID (break_id = -8, internal = yes)
<lldb.process.internal-state(pid=84685)> Hit breakpoint location: -1.1:
module = /usr/lib/dyld
symbol = gdb_image_notifier(dyld_image_mode, unsigned int, dyld_image_info const*)
address = 0x00007fff5fc0a2f2
resolved = true
hit count = 3
, continuing.
<lldb.process.internal-state(pid=84685)> Target::RemoveBreakpointByID (break_id = -9, internal = yes)
<lldb.process.internal-state(pid=84685)> Target::DisableBreakpointByID (break_id = -9, internal = yes)
(int) $2 = 1049248
(lldb)
Could this be an ordering issue, where the event that is broadcast from hitting the breakpoint site is not caught by the handler that we want (in the dyld), but by the handler set up by the Evaluate() method (I don’t know much about the event system, so I may be way off)?
Thanks for the help,
Filipe