switching to target remote when using target sim
Andrew Burgess
aburgess@redhat.com
Mon Jul 1 10:18:59 GMT 2024
William Tambe via Gdb <gdb@sourceware.org> writes:
> I have implemented gdb target sim, however, I was wondering whether there
> is a way to make gdb automatically switch to target remote and starting an
> external simulator when using target sim at the gdb prompt ?
Not really.
You could potentially override 'target sim' as either a Python command
or from gdb script, e.g.:
(gdb) define target sim
Type commands for definition of "target sim".
End with a line saying just "end".
>echo Is this useful?\n
>end
(gdb) target sim
Is this useful?
(gdb)
You can replace the 'echo ...' with whatever commands you like, for
example some 'target remote ....' commands. The downside of this is
that the actual 'target sim' is gone (in that GDB session) with no way
to get it back (that I know of). But maybe that's OK for a per-project
script?
Usually when I'm using an external simulator I just train the users to
use 'target remote ...', it's a pretty common approach, e.g. it's how
QEMU and OpenOCD connect to GDB, so most folk are more familiar with
this approach than 'target sim' I find.
Thanks,
Andrew
More information about the Gdb
mailing list