How do I use gdbserver on Raspberry Pi?

Cristian Ion Preda picture Cristian Ion Preda · Jan 2, 2016 · Viewed 7.2k times · Source

I try to remotly debug using gdb. On the target computer (Raspberry Pi with Ubuntu Mate 15.10), I run gdbserver :4444 main. And on my laptop, I run ./arm-linux-gnueabihf-gdb ~/workspace/piCCompileProj/Debug/main. At the gdb prompt (on my laptop), I type:

target remote <target>:4444
run

But gdb reports this error message:

The "remote" target does not support "run". Try "help target" or "continue".

How I can use gdb remote? When I use gdb directly on the Raspberry Pi, it runs as expected.

Answer

Cristian Ion Preda picture Cristian Ion Preda · Jan 3, 2016

I find the solution for my problem.

If I run gdbserver :4444 main on my PI the main program will start and is not needed for run comand in gdb. To have full control on gdb I use in PI gdbserver --multi :4444 an in may local PC I use the command:./arm-linux-gnueabihf-gdb -x /path/init where the content of the /path/init file is:

symbol-file /home/username/workspace/piCCompileProj/Debug/main
target extended-remote 192.168.0.100:4444
set remote exec-file /home/username/cppSandbox/main