xcode 如何使用 lldb 跳过几行代码?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30472950/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:12:26  来源:igfitidea点击:

How to skip a couple of lines code with lldb?

xcodelldb

提问by BollMose

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

有没有办法在使用 lldb 调试时跳过代码行而无需重新编译?

回答by Dave Lee

UPDATE

更新

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

除了下面的原始答案外,jump/j别名可用于跳过多行或跳到特定行号:

To skip two lines ahead:

要跳过前面两行:

(lldb) jump +2

To skip to line 102:

跳到第 102 行:

(lldb) jump 102

See help jumpfor more info.

查看help jump更多信息。

ORIGINAL

原来的

This can be achieved using the thread jumpcommand by giving the --by/-bflag. Example:

这可以thread jump通过给--by/-b标志使用命令来实现。例子:

(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.

或者,可以使用--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.

请注意,这些都会移动程序计数器,这可能会使程序进入损坏状态并导致崩溃。