LLDB Break at Address

2019-04-04 18:09发布

问题:

I apologize for the likely trivial question but I am running into a wall as Google gives me the same non-applicable answers over and over.

I am trying to set a breakpoint in LLDB. After reading the documentation, the options available to me are to either stop on a certain line in the source or on a certain symbol.

What I want to do is set a breakpoint on a certain memory location.

Not read-or-write to that memory location either but simply breaking when the instruction at that location is about to be executed.

In Pseudocode:

break 0x00010000

breaks when EIP points to 0x00010000.

How can I do this?

回答1:

breakpoint set has an address option; you would type help breakpoint set to see all of them. For your specific example,

(lldb) br s -a 0x10000

(You can always use shorter versions of command names in lldb that are unambiguous so typing out breakpoint set isn't necessary)



回答2:

The alternative is to use "process launch --stop-at-entry ...". This will allow you to set breakpoints after the program is launched and then "continue" will let you stop on your first breakpoint. Interestingly (testing in Ubuntu) using --stop-at-entry takes a lot longer to start (~3 seconds). I need to use this on OS X and maybe it will be quicker there.