This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Disallow pseudo-registers in agent expression.
- From: "Jim Blandy" <jimb at red-bean dot com>
- To: "andrzej zaborowski" <balrogg at gmail dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Tue, 5 Feb 2008 07:34:17 -0800
- Subject: Re: [PATCH] Disallow pseudo-registers in agent expression.
- References: <fb249edb0801261107s6444f842s45ef63860c38f4d3@mail.gmail.com> <fb249edb0801261110g75922f69o948a2e2fd6b08dfa@mail.gmail.com> <8f2776cb0801271007r125463e0la1cf8a7c9d1efef@mail.gmail.com> <fb249edb0801281551o68911a0cw5e6d2051247722ab@mail.gmail.com> <8f2776cb0801281728v2ff40d50y2be92664b2c28de5@mail.gmail.com>
Andrzej, is this idea something that you would be interested in
implementing? It'd be great to get this working.
On Jan 28, 2008 5:28 PM, Jim Blandy <jimb@red-bean.com> wrote:
> On Jan 28, 2008 3:51 PM, andrzej zaborowski <balrogg@gmail.com> wrote:
> > On 27/01/2008, Jim Blandy <jimb@red-bean.com> wrote:
> > > On some targets, all the user-visible registers are pseudo-registers.
> > > What we need is a gdbarch method (optional) that the tracepoint code
> > > could call, passing it a struct agent_expr and a pseudo-register
> > > number, to have the architecture code append the appropriate bytecodes
> > > to access that register.
> >
> > That's ofcourse doable but sounds tough and bug-prone. The mapping of
> > numbers to raw registers is to some extent obvious and unlikely to
> > change, while the pseudo-registers may change with gdb version so the
> > target has more gdb version dependence.
>
> I'm not sure I expressed myself well. I was imagining something like this:
>
> *** ax-gdb.c 07 Jan 2008 08:31:13 -0800 1.40
> --- ax-gdb.c 28 Jan 2008 17:21:28 -0800
> ***************
> *** 1607,1615 ****
> if (reg == -1)
> internal_error (__FILE__, __LINE__,
> _("Register $%s not available"), name);
> ! value->kind = axs_lvalue_register;
> ! value->u.reg = reg;
> ! value->type = register_type (current_gdbarch, reg);
> }
> break;
>
> --- 1607,1627 ----
> if (reg == -1)
> internal_error (__FILE__, __LINE__,
> _("Register $%s not available"), name);
> ! if (reg < gdbarch_num_regs (current_gdbarch))
> ! {
> ! value->kind = axs_lvalue_register;
> ! value->u.reg = reg;
> ! value->type = register_type (current_gdbarch, reg);
> ! }
> ! else
> ! {
> ! /* It's a pseudo-register reference; ask the architecture
> ! to generate appropriate bytecode for it. */
> ! if (! gdbarch_gen_pseudo_reg_ax (current_gdbarch, ax, value, reg))
> ! error (_("Couldn't generate agent expression"
> ! " to refer to register '%s'"),
> ! gdbarch_register_name (current_gdbarch, reg));
> ! }
> }
> break;
>
> This seems pretty reasonable to me: only the architecture knows how
> pseudo-register values are computed from the raw register values --- a
> pseudo-register might be two raw registers spliced together, for
> example --- so only the architecture knows the right agent bytecode to
> generate.
>