xcode – 如何记录自定义LLDB命令(别名)?

前端之家收集整理的这篇文章主要介绍了xcode – 如何记录自定义LLDB命令(别名)?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在GDB中(通常在.gdbinit文件中)我用来记录我添加自定义命令,如下所示:

define parg    <-- this define my custom command
p *($arg0*)($ebp+8+(4*$arg1))     <--- what in does
end

document parg   <--- HERE IS THE COMMENT / DOCUMENTATION ON THIS CUSTOM COMMAND
Prints current function arguments

parg <type> <index>
Prints the <index>th argument of the current function as type <type>
<index> is 0-based
end

我知道如何在LLDB中添加命令(命令别名…),但我该如何记录它?

解决方法

记录命令别名没有任何余地 – 它们通常非常简单,对它们运行“帮助”将显示它们扩展到的内容 – 但是如果在python中定义命令,则可以向该命令添加文档.例如,

(lldb) script
Python Interactive Interpreter. To exit,type 'quit()','exit()' or Ctrl-D.
>>> def say_hello(debugger,command,result,dict):
...   print 'hello!'
...   description = '''This command says hello.'''
...   usage = 'usage: say_hello'
... 
>>> ^D
(lldb) command script add -f say_hello say_hello
(lldb) say_hello
hello!
(lldb) help say_hello
   Run Python function say_hello  This command takes 'raw' input (no need to quote stuff).

Syntax: say_hello
(lldb)

注意第四行“…”行,我在空行上按下返回.

有关lldb中python脚本的更多信息,请参阅http://lldb.llvm.org/python-reference.html

但不,你的问题的答案是你今天不能记录命令别名.

猜你在找的Xcode相关文章