I want to send gdb command (like "backtrace", "b *0xAAAAAAA", "i b", ...) from IDA debugger to gdbserver over gdb remote debugging and receive result and print it to output view of IDA, can I do it? Anyone have tried it before?

I found that function "SendDbgCommand" in IDA help

Send arbitrary command to the debugger engine. Returns: the command output.

Note: this function is available for the following debuggers: windbg, gdb, bochs

string SendDbgCommand(string cmd);

But when i tried it, in idc script or idapython script, it didn't work!

more detail:

  • i used ida 6.1 remote GDB debugger and my remote machine is Ubuntu, run command

gdbserver --multi localhost:12345

as normal remote debugging session and everything is alright

now, i want to use other gdb commands (like above) beside operators provided by ida GUI

if s.startswith("IDC_FAILURE"):
    raise Exception, "Debugger command is available only when the debugger is active!"
  • i also tried use SendDbgCommand in idc script but i didn't work too, it returns 0

Anyone can help me please? Thank you so much!

  • You didn't explain enough what you already tried, what configuration you used and, also, what was the problem you encountered when running it. Try to give more details. – perror Aug 27 '14 at 7:22
  • ok, i am going to add more detail! – user3746442 Aug 27 '14 at 9:30

The commands you're trying to use are implemented in the GDB executable, not gdbserver. The gdbserver implements the Remote Serial Protocol, and IDA is using that to send commands (read/write registers/memory, set breakpoints etc.) and get results.

Since IDA is not using the GDB program itself, it cannot process its commands. You need to use IDA commands to control the executable and retrieve the information.

The "GDB" commandline at the bottom allows you to send the so-called "monitor commands" which allow the remote stub to implement various functionality not covered by the protocol. For example, VMWare's GDB stub supports "r" command to get details about some registers.

  • ah ... so gdbserver has private commands and ida communicates with it by remote serial protocol and SendDbgCommand is used to send the gdbserver's private commands? – user3746442 Aug 27 '14 at 12:55

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.