I have a global function in a long run program :
int a = 12;
int c = 10;
a += c ;
(lldb) call test()
a=12a=22(int) $0 = 22
expr -i0 -- test()
(lldb) b test
Breakpoint 1: 4 locations.
(lldb) expr -i0 -- test()
error: Execution was interrupted, reason: breakpoint 1.1.
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
expression command in lldb (
call is an alias for
expression) takes a dozen or so options, one of them being whether lldb should stop on a breakpoint while executing the expression,
--ignore-breakpoints false, or
-i false, or
(lldb) br s -n printf Breakpoint 2: where = libsystem_c.dylib`printf, address = 0x00007fff89ee7930 (lldb) expr -- (void)printf("hi\n") hi (lldb) expr -i0 -- (void)printf("hi\n") error: Execution was interrupted, reason: breakpoint 2.1. The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation. Process 15259 stopped * thread #1: tid = 0xf0daf, 0x00007fff89ee7930 libsystem_c.dylib`printf, queue = 'com.apple.main-thread', stop reason = breakpoint 2.1 #0: 0x00007fff89ee7930 libsystem_c.dylib`printf libsystem_c.dylib`printf: -> 0x7fff89ee7930: pushq %rbp 0x7fff89ee7931: movq %rsp, %rbp 0x7fff89ee7934: pushq %r15 0x7fff89ee7936: pushq %r14 (lldb)
There was some thought put in to the default behavior (whether to stop on a breakpoint or not), and this seemed the behavior most people would expect.
As I said, the
call command is just an alias for
expression. If you want to change the behavior of it, you can overwrite the alias with one of your own. e.g.
command alias call expr -i false -- will do the trick. You can put this in your
~/.lldbinit file and you'll be set.