This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [patch/mips, rfc] Don't define FP_REGNUM
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Fri, 13 Sep 2002 18:16:51 -0400
- Subject: Re: [patch/mips, rfc] Don't define FP_REGNUM
- References: <3D824782.1040306@ges.redhat.com>
On Fri, Sep 13, 2002 at 04:16:02PM -0400, Andrew Cagney wrote:
> Hello,
>
> Ok, so this takes things out of the theory stage :-)
>
> The attached patch eliminates the totally bogus definition of FP_REGNUM
> from the MIPS target. It was being mapped to a pseudo register and that
> pseudo register, through luck, not good management, sometimes contained
> the contents of the SP. It now always returns the SP.
>
> To get this patch working, I needed to modify
> ``legacy_virtual_frame_pointer'' (used by the tracepoint code) so that
> it tries FP_REGNUM and then SP_REGNUM as a possible frame pointer
> register. As I write:
>
> - gdb_assert (FP_REGNUM >= 0);
> - *frame_regnum = FP_REGNUM;
> + /* FIXME: cagney/2002-09-13: This code is used when identifying the
> + frame pointer of the current PC. It is assuming that a single
> + register and an offset can determine this. Instead it should
> + generate a byte code expression that computes the current FP. */
> + if (FP_REGNUM >= 0 && FP_REGNUM < NUM_REGS)
> + *frame_regnum = FP_REGNUM;
> + else if (SP_REGNUM >= 0 && SP_REGNUM < NUM_REGS)
> + *frame_regnum = SP_REGNUM;
> + else
> + /* Should this be an internal error? I guess so, it is reflecting
> + an architectural limitation in the current design. */
> + internal_error (__FILE__, __LINE__, "No virtual frame pointer
> available");
> *frame_offset = 0;
>
> For the MIPS to work, a custom virtual_frame_pointer() function would be
> needed. I don't see any point in implementing this, though, as there is
> no tracepoint target to test it against. Anyway, coments on this aspect
> of the patch? If not, I'll check it in.
>
> [Hmm, need to mention this in the NEWS file. The MIPS $fp will finally
> behave as specified in the documentation.]
Looks good to me. And there may someday be a tracepoint target to
test it against - I hope to add tracepoints to gdbserver, eventually.
When that happens I can revisit this.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer