I am using GDB to load and debug my executable. At the moment, each time I want to run my program I first have to load it, and then continue it to start execution.

Apparently the run command starts execution from the start, but when I try to run I get the error:

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

My board is an STM32F2. Is there a way to easily start execution from the start of the executable without having the reload the damn thing onto memory again?

EDIT: I have tried Leo's suggestion, but when I do run I get the following error:

(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) [answered Y; input not from terminal]
../../gdb-7.2/gdb/thread.c:79: internal-error: inferior_thread: Assertion tp' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) [answered Y; input not from terminal]
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) [answered Y; input not from terminal]

This application has requested the Runtime to terminate it in an unusual way.

Take a look at https://stackoverflow.com/a/5200638/713554 which in turn links to http://sourceware.org/gdb/onlinedocs/gdb/Server.html

From what I understand, you should use target extended-remote instead of target remote.

• Thanks. I have tried that but I get an error. (Please see the edited question for the error.) – Randomblue Mar 22 '12 at 17:35

Step-by-step procedure

Remote:

# pwd contains cross-compiled ./myexec
gdbserver --multi :1234

Local:

# pwd also contains the same cross-compiled ./myexec
gdb -ex 'target extended-remote 192.168.0.1:1234' \
-ex 'set remote exec-file ./myexec' \
--args ./myexec arg1
(gdb) r
[Inferior 1 (process 1234) exited normally]
(gdb) r
[Inferior 1 (process 1235) exited normally]
(gdb) monitor exit

Stdout shows on remote.

Tested in Ubuntu 14.04.