Reputation: 1342
In GDB (typically in .gdbinit file) I use to document my added custom commands like this :
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
I know how to add a command in LLDB (command alias ...), but how do I document it?
Upvotes: 4
Views: 1123
Reputation: 1201
You can document custom lldb commands using docstrings as documented in the Python Reference:
Optionally, you can also provide a Python docstring, and LLDB will use it when providing help for your command, as in:
(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)
Upvotes: 0
Reputation: 15395
There isn't any allowance for documenting command aliases -- they're usually pretty straightforward and running 'help' on them will show what they expand to -- but if you define a command in python, you can add documentation to that command. For instance,
(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)
Note the fourth "..." line where I pressed return on the empty line.
For further information about python scripting in lldb, please see http://lldb.llvm.org/python-reference.html
But no, the answer to your question is that you cannot today document a command alias.
Upvotes: 3