This is the mail archive of the
mailing list for the GDB project.
Re: emulating single-step in gdbserver?
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Miles Bader <miles at gnu dot org>
- Cc: gdb at sources dot redhat dot com
- Date: Thu, 20 Feb 2003 10:08:13 -0500
- Subject: Re: emulating single-step in gdbserver?
- References: <email@example.com>
On Thu, Feb 20, 2003 at 01:39:25PM +0900, Miles Bader wrote:
> I'm porting gdbserver to uClinux on the (NEC) v850e processor, and
> ptrace on this machine doesn't support PTRACE_SINGLESTEP (because the
> hardware doesn't support single-stepping).
> I thought gdb might already support an emulated singlestep by always
> setting a temporary breakpoint at the next insn, but from a quick
> perusal of the source, it seems not.
> So I'm wondering where the best place to stick this functionality is.
GDB (i.e. the client, not gdbserver). Certainly gdbserver could do it,
but you have to do some rather more complicated work in the server that
GDB is already set up to do and the server isn't - with threads, for
instance. Most other platforms do this; see ARM and MIPS at least.
However, now that I've got limited breakpoint support in gdbserver, it
might be practical to do it in the server.
> The `next_pc' member added to the_low_target would be a function that
> calculates the next pc after executing the current insn.
> Any comments on this approach; does it seem correct?
Roughly. Another detail you'd get wrong would be if we get a signal
before hitting the single-step breakpoint - it should be removed, not
left for later. There are probably others.
> A related question, BTW, is what's the precise meaning of
> `the_low_target.breakpoint_reinsert_addr'? It's not documented very
It's essentially a very limitted next_pc function. The only
breakpoints gdbserver places right now are in empty marker functions in
the thread library. After hitting one, it either single-steps or
places a breakpoint at the function's return address, and then
reinserts it. The advantage is that finding the return address is
quick and very simple.
MontaVista Software Debian GNU/Linux Developer