加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-14 17:31:10 所属栏目:百科 来源:网络整理
导读:在GDB中(通常在.gdbinit文件中)我用来记录我添加的自定义命令,如下所示: define parg -- this define my custom commandp *($arg0*)($ebp+8+(4*$arg1)) --- what in doesenddocument parg --- HERE IS THE COMMENT / DOCUMENTATION ON THIS CUSTOM COMMANDP
在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

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读