Home > front end >  How do I place a breakpoint at the start of an application in LLDB
How do I place a breakpoint at the start of an application in LLDB

Time:08-16

Whenever I try and debug an application with LLDB I can not seem to get a breakpoint set at the entry point of the application.

I have been running br set -n _main and this sets a breakpoint that can be seen when running br list however these breakpoints are never hit.

How do I get LLDB to set a breakpoint at the entry point of my executable?

CodePudding user response:

If you launch your process using:

(lldb) process launch --stop-at-entry -- <Process arguments>

that will stop when your program binary is loaded, but before any code is run. Note, that includes any dyld code - so no shared libraries have been loaded, only the main executable - or any system initializers. So there's generally not much you can do safely at this point. If you want to then stop at the first significant library load, you can do:

(lldb) target.process.stop-on-sharedlibrary-events 1
(lldb) continue

That will run to the first major load event (and stop at all the others if you leave it on.)

  • Related