Luka Rahne
Luka Rahne

Reputation: 10457

How to do remote debugging in Eclipse CDT without running `gdbserver` manually on the target every time?

Before each debugging cycle I have to run gdbserver on remote target (Linux). So I was thinking to make script that would call python program that would connect over ssh and would run gdbserver.

I cant find any options to run command before debug and I also try to change .gdbinit file but I am unable tu run python script whit that. Since I am using crosscompiler I cant to get other gdb whit such support.

Upvotes: 2

Views: 3096

Answers (3)

Eclipse 4.7.0 can connect to SSH and launch gdbserver automatically with the automatic launcher set when creating a new debug connection, without the need for any custom scripts.

I have explained the setup in great detail at: Remote debugging C++ applications with Eclipse CDT/RSE/RDT

Upvotes: 0

greydet
greydet

Reputation: 5539

If you can't get any external program called from your gdbinit, I see one way of doing it within Eclipse that might work (I didn't tested) but it is not really straightforward...

  • Create an External Tool configuration that launches your gdbserver program (Python or whatever command line script)
  • Create a C/C++ application launcher that launch your application to debug
  • Create a launch group that will call the two previously configured configurations.
  • Launch the group in debug mode

Upvotes: 1

Employed Russian
Employed Russian

Reputation: 213754

You don't need to run Python to invoke an external command from GDB. This (in .gdbinit) should work:

shell ssh remote-host gdbserver :12345 /path/to/binary/on/remote &
target remote remote-host:12345

If you do need more complicated ssh setup and need Python for that, you can certainly get it with

shell python your_script.py

Upvotes: 1

Related Questions