This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Software-vs-hardware single-step vs. sim/non-sim targets.
- From: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- To: gdb at sourceware dot org
- Date: Fri, 04 Dec 2009 21:14:40 +0000
- Subject: Software-vs-hardware single-step vs. sim/non-sim targets.
Hi all,
I have a GDB port for a custom target, a sim-based simulator, and a gdbstub
for use on the real thing. GDB can single step the simulator of course, since
the support for simulated hardware-single-step is built in, but I'd like to
save bytes in the gdbstub by not implementing support for the "s" command.
So is there a way I can get gdb to use (simulated) hardware single stepping
for the simulator target and software single stepping for the remote target?
And dynamically switch when the target changes? Or do I have to compile two
different builds, only one of which sets the software single step method in
the gdbarch?
I'm trying not to do anything too hacky or break the architectural layering
in GDB, but can I perhaps examine the current_target in my arch init function
and frig the value of the single_step hook in the gdbarch that I either lookup
or allocate before returning it? Does the arch init function always get
called when switching between targets or otherwise altering the layers in the
stratum stack?
cheers,
DaveK