Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to skip a couple of lines code with lldb?

Tags:

xcode

lldb

Is there a way to skip over lines of code while debugging with lldb without having to recompile?

like image 487
BollMose Avatar asked May 27 '15 04:05

BollMose


People also ask

How do I skip a line in GDB?

So just type skip in gdb to skip a line.

How do you set a breakpoint in LLDB?

In lldb you can set breakpoints by typing either break or b followed by information on where you want the program to pause. After the b command, you can put either: a function name (e.g., b my_subroutine ) a line number (e.g., b 12 )

What does LLDB stand for?

LLDB (low-level debugger) is part of LLVM The LLVM compiler (low level virtual machine) creates programming languages. LLDB is Apple's “from the ground up” replacement for GDB. The LLDB debugger is analogous to GDB: (The GNU Project Debugger).


1 Answers

UPDATE

In addition to the original answer below, the jump/j aliases can be used for skipping a number of lines or skipping to a specific line number:

To skip two lines ahead:

(lldb) jump +2 

To skip to line 102:

(lldb) jump 102 

See help jump for more info.

ORIGINAL

This can be achieved using the thread jump command by giving the --by/-b flag. Example:

(lldb) thread jump --by 2 (lldb) th j -b 2 

Alternatively, instead of a relative move an absolute line number can be specific with --line/-l.

(lldb) thread jump --line 102 (lldb) th j -l 102 

Note that these both move the program counter, and that could put the program into a broken state and lead to crashes.

like image 59
Dave Lee Avatar answered Oct 27 '22 10:10

Dave Lee