Re: Software-vs-hardware single-step vs. sim/non-sim targets.

Dave Korn
2009-12-05T03:50:02Z

Daniel Jacobowitz wrote:

[ out-of-order:
> There's no obvious easy solution to this, but the basic problem has
> been discussed many times.

Sorry for making you go over old ground; it's not easy to get good search
results with terms as general as "hardware software single step gdb"; I
wouldn't be offended if you replied with just a couple of words for better
search terms or URLs to earlier threads. ]

> Answering the last question first, no, it does not necessarily get called.

> IMO the remote protocol hook you need is already present: implement
> vCont, even though it's overkill for an embedded single-threaded
> processor. Report that you don't support s or S in the vCont? reply.
>
> Current GDB will choke. So you have to somehow separate the above
> questions, so that when we ask the architecture whether to
> single-step, it knows whether the target needs SSS or not.

Hmm, okay, so the arch doesn't get re-inited between detaching from one
target and attaching to the next. But I'd bet (and I mean bet, I haven't
looked yet, but I can't imagine how the whole thing hangs together if it
doesn't work this way) that the infrun state machine does get thoroughly and
properly reset and all in-memory breakpoints restored during the
detach/reattach sequence. So in theory it should all be ok if
gdbarch_software_single_step_p() returned different values dynamically, so
long as they're constant during any given run of the inferior. Maybe it would
work to turn that into an arch hook, with a default that works like the
current version by simply testing if the single_step hook is set, but allow
for a dynamically-varying version to be installed by arches that choose. I'll
look a bit at how well that would work.

(Ah, gdbarch_software_single_step_p makes an instructive search term, there
seems to have been some discussion about what to do round the time when the
macro version got replaced by a hook. Haven't yet found anything that looks
like a firm resolution to it though.)

cheers,
DaveK