public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: vaibhav kurhe <vaibhav.kurhe@gmail.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb@sourceware.org
Subject: Re: GDB | DWARF expression | Extracting a range of bits from an 'xmm' register
Date: Sat, 22 May 2021 02:07:45 +0530	[thread overview]
Message-ID: <CAHKv1qvRJHAA=91iwGV_tVoqRXSu-UXRdvaBssyvxhD+MFc4Fw@mail.gmail.com> (raw)
In-Reply-To: <20210521140340.GC2295059@embecosm.com>

On Fri, May 21, 2021 at 7:33 PM Andrew Burgess
<andrew.burgess@embecosm.com> wrote:
>
> * vaibhav kurhe via Gdb <gdb@sourceware.org> [2021-05-21 14:27:15 +0530]:
>
> > Hello all,
> > For a use case, I am trying to build a DWARF expression which represents
> > the value of an arbitrary range of bits (e.g. 96-127 bits) in an *128-bit
> > xmm register* to be used as a *location attri
bute value* for a variable DIE.
> > I am using GDB to consume the debug info and test it.
> >
> > Following is the expression I started with to test out a shift operation on
> > an 128-bit xmm0 register using Typed DWARF stack :-
> >
> > *"DW_OP_GNU_regval_type: 21 (xmm0) <0x30>; DW_OP_GNU_const_type: <0x30>  16
> > byte block: 20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; DW_OP_shl;
>
> I'm probably just not understanding correctly, but I'm confused by the
> use of DW_OP_GNU_const_type.  Isn't this providing the number of bits
> to shift?  I'd have expected something like 'DW_OP_const1u 96'.
>
> Thanks,
> Andrew

Hi Andrew,
Thanks for the reply!

Yes, the second operand to DW_OP_shl is indeed the number of bits to
shift. But, I saw that the DWARF5 standard mentions that both the
operands should be of the same type.
So, in this case, as the 1st operand is typed (which points to a DIE
for the base type), I think the 2nd operand also has to be typed and
hence used the operation DW_OP_const_type.

Regards,
Vaibhav

      parent reply	other threads:[~2021-05-21 20:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21  8:57 vaibhav kurhe
2021-05-21 14:03 ` Andrew Burgess
2021-05-21 16:02   ` Zaric, Zoran (Zare)
2021-05-21 21:09     ` vaibhav kurhe
2021-05-24 10:00       ` Zaric, Zoran (Zare)
2021-05-21 20:37   ` vaibhav kurhe [this message]

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='CAHKv1qvRJHAA=91iwGV_tVoqRXSu-UXRdvaBssyvxhD+MFc4Fw@mail.gmail.com' \
    --to=vaibhav.kurhe@gmail.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).