[lldb-dev] lldb equivalent for gdb's "monitor" command
Greg Clayton
gclayton at apple.com
Mon Nov 11 10:30:32 PST 2013
The GDB plug-in installs two GDB remote specific commands under "process plugin":
The monitor command you need is actually implemented using the "qRcmd" packet:
(lldb) process plugin packet monitor foo=1
packet: qRcmd,666f6f3d31
response: E69
And if you need to send any other raw command, you can:
(lldb) process plugin packet send qRcmd,666f6f3d31
packet: qRcmd,666f6f3d31
response: E69
This just sent the monitor command manually. You can actually load a new python module that creates new python commands. See the http://lldb.llvm.org/python-reference.html page and check out the section named "CREATE A NEW LLDB COMMAND USING A PYTHON FUNCTION". There is also a template file you can use to create your new python command at http://llvm.org/svn/llvm-project/lldb/trunk/examples/python/cmdtemplate.py.
The theory goes, you can install a new python command and say name it "monitor". In your python command you would do whatever you would need to do and then call:
result = lldb.SBCommandReturnObject()
debugger.GetCommandInterpreter().HandleCommand("process plugin packet monitor foo=1", result)
print result.GetOutput() # The response from the command as a GDB remote packet with no leading '$' or the checksum "#XX"
Greg Clayton
On Nov 11, 2013, at 1:10 AM, Kemper, Benjamin <benjamin.kemper at intel.com> wrote:
> Hi,
>
> I'm implementing a debugger backend, which talks to lldb using the (extended) gdb protocol. To provide further functionality we use the gdbserver "monitor" command to provide "custom" commands to the debugger.
>
> I couldn't find anything similar in lldb in the help or the web. Is there another way of getting the same functionality in lldb?
>
> Regards,
> Benjamin.
>
> ---------------------------------------------------------------------
> Intel Israel (74) Limited
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
>
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
More information about the lldb-dev
mailing list