在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中添加命令(命令别名...),但是我如何记录它?
发布于 2012-09-25 05:52:57
不允许记录命令别名--它们通常非常简单,对它们运行'help‘会显示它们展开到什么位置--但是如果你用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。
但是不,你的问题的答案是,你现在不能记录命令别名。
发布于 2015-09-29 23:07:48
您可以使用Python Reference中记录的文档字符串来记录自定义lldb命令
也可以提供
文档字符串,LLDB将在为命令提供帮助时使用它,如下所示:
(lldb) script
>>> def documented(*args):
... '''
... This command is documented using a docstring.
...
... You can write anything!
... '''
... pass
...
>>> exit
(lldb) command script add -f documented documented
(lldb) help documented
This command is documented using a docstring.
You can write anything!
Syntax: documented
(lldb)https://stackoverflow.com/questions/12530535
复制相似问题