Jas*_*nda 17
在Xcode 4.6中,lldb的l别名是一个简单的快捷方式source list.
在树源的顶部,这已经改进,表现得更像gdb.如果你看一下source/Interpreter/CommandInterpreter.cpp在在http://lldb.llvm.org/你会看到,l现在是一个正则表达式命令别名这些情况:
if (list_regex_cmd_ap->AddRegexCommand("^([0-9]+)[[:space:]]*$", "source list --line %1") &&
list_regex_cmd_ap->AddRegexCommand("^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$", "source list --file '%1' --line %2") &&
list_regex_cmd_ap->AddRegexCommand("^\\*?(0x[[:xdigit:]]+)[[:space:]]*$", "source list --address %1") &&
list_regex_cmd_ap->AddRegexCommand("^-[[:space:]]*$", "source list --reverse") &&
list_regex_cmd_ap->AddRegexCommand("^-([[:digit:]]+)[[:space:]]*$", "source list --reverse --count %1") &&
list_regex_cmd_ap->AddRegexCommand("^(.+)$", "source list --name \"%1\"") &&
list_regex_cmd_ap->AddRegexCommand("^$", "source list"))
Run Code Online (Sandbox Code Playgroud)
在这些情况下,您将获得如下行为:
显示当前帧:
(lldb) f
#0: 0x0000000100000f2b a.out`main + 27 at a.c:15
12
13
14
-> 15 puts ("hi"); // line 15
16
17 puts ("hi"); // line 17
18 }
Run Code Online (Sandbox Code Playgroud)
显示前十行:
(lldb) l -
5
6
7
8
9 puts ("hi"); // line 9
10
11
Run Code Online (Sandbox Code Playgroud)
您还可以使用stop-line-count-after和stop-line-count-before设置来控制帧停止时显示的源上下文数量.
请注意,您可以在~/.lldbinit文件中创建自己的正则表达式命令别名,其行为与top-of-tree lldb相同l.请参阅参考资料help command regex以获取语法和示例.
LLDB:[如何]列出源代码
即:对于任何寻找“如何让 lldb 显示我再次所在的行?(因为我最近的命令已覆盖它)”的人,这很简单f。再次键入f以查看您在代码中的位置。
f
Run Code Online (Sandbox Code Playgroud)
或者
frame select
Run Code Online (Sandbox Code Playgroud)
来源:LLDB:列出源代码
另请参阅以下位置的帮助菜单lldb:
help f
Run Code Online (Sandbox Code Playgroud)
显示以下内容:
Run Code Online (Sandbox Code Playgroud)(lldb) help f Select the current stack frame by index from within the current thread (see 'thread backtrace'.) Syntax: f <cmd-options> [<frame-index>] Command Options Usage: f [-r <offset>] [<frame-index>] -r <offset> ( --relative <offset> ) A relative frame index offset from the current frame index. This command takes options and free-form arguments. If your arguments resemble option specifiers (i.e., they start with a - or --), you must use ' -- ' between the end of the command options and the beginning of the arguments. 'f' is an abbreviation for 'frame select'
该帮助菜单的底部显示“f是”的缩写frame select。
请注意,在 中gdb,等效命令很简单:
f
Run Code Online (Sandbox Code Playgroud)
或者
frame
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16749 次 |
| 最近记录: |