Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Jim Blandy" <jimb@red-bean.com>
To: "andrzej zaborowski" <balrogg@gmail.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] Disallow pseudo-registers in agent expression.
Date: Tue, 29 Jan 2008 01:49:00 -0000	[thread overview]
Message-ID: <8f2776cb0801281728v2ff40d50y2be92664b2c28de5@mail.gmail.com> (raw)
In-Reply-To: <fb249edb0801281551o68911a0cw5e6d2051247722ab@mail.gmail.com>

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.


  reply	other threads:[~2008-01-29  1:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-26 19:09 andrzej zaborowski
2008-01-26 19:15 ` andrzej zaborowski
2008-01-27 21:11   ` Jim Blandy
2008-01-29  0:19     ` andrzej zaborowski
2008-01-29  1:49       ` Jim Blandy [this message]
2008-02-05 15:34         ` Jim Blandy
2008-02-05 15:58           ` Jim Blandy
2008-02-05 16:07             ` Jim Blandy
2008-02-05 18:23           ` andrzej zaborowski
2008-02-05 19:16             ` Jim Blandy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8f2776cb0801281728v2ff40d50y2be92664b2c28de5@mail.gmail.com \
    --to=jimb@red-bean.com \
    --cc=balrogg@gmail.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox