Re: Re: GDB | DWARF expression | Extracting a range of bits from an 'xmm' register

"Zaric, Zoran \(Zare\) via Gdb" <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
On 5/21/21 3:03 PM, Andrew Burgess wrote:
> * vaibhav kurhe via Gdb <[email protected]> [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 attribute 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 Vaibhav,

Maybe I am missing something, but what is the end goal that you are 
trying to accomplish?

The way how you formed your expression, you can only get a read only 
stack value location description.

Why not use the DW_OP_bit_piece with your register being the only piece 
inside of it and then use that as your end location description?

Thanks,
Zoran
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.