Camden Narzt
Camden Narzt

Reputation: 2013

lldb skip objc_msgSend

I'm trying to determine how a method Apple exposes on NSWorkspace works internally, in order to try and work around an unfortunate side effect of the method (it writes to disk, every time you call it). I can attach lldb to my executable and set a breakpoint when the method is called, and step in with si into objc_msgSend and on, but I'd prefer to just skip ahead until I get to the method body, is there any way to set a breakpoint for the beginning of the method body, or the instruction in objc_msgSend immediately before the jump to the method body?

Upvotes: 3

Views: 258

Answers (2)

Jim Ingham
Jim Ingham

Reputation: 27203

lldb's source-level step command will always pass through the objc_msgSend trampoline code for you, stopping in the target implementation, regardless of where the implementation lives.

However, lldb will also by default automatically step back out of methods with no debug info. That is for the most part the behavior people want, but is in this case NOT what you want. Fortunately, you can turn off this latter behavior, either for a given step by doing:

(lldb) step -a 0

or generally by setting the global default that controls this:

(lldb) set set target.process.thread.step-in-avoid-nodebug 0

Upvotes: 1

JustSid
JustSid

Reputation: 25318

You can set a breakpoint to the actual method body itself via something like this

br s -n "-[NSWorkspace openURL:]"

Upvotes: 2

Related Questions