[Dwarf-discuss] register name operators

Marcel Mettes marcelm
Wed Nov 15 16:23:42 GMT 2006


Hello,

We have a question regarding the register name expression operator, e.g. 
DW_OP_reg0.

In the DWARF 3 document as released last december, 2005 it says on 
DW_reg0 and the like:

----------------------------------------------------------------------------------


      2.6.1       Register Name Operators

The following DWARF operations can be used to name a register. They can 
be used only in location expressions. Each register name operator must 
be used alone (as a DWARF expression consisting of just that one 
operation).

/Note that the register number represents a DWARF specific mapping of 
numbers onto the actual registers of a given architecture. The mapping 
should be chosen to gain optimal density and should be shared by all 
users of a given architecture. It is recommended that this mapping be 
defined by the ABI authoring committee for each architecture./

1.      *DW_OP_reg0**, DW_OP_reg1**, ..., DW_OP_reg31*
The DW_OP_reg/n/ operations encode the names of up to 32 registers, 
numbered from 0 through 31, inclusive. The object addressed is in 
register /n/.

2.      *DW_OP_regx*
The DW_OP_regx operation has a single unsigned LEB128 literal operand 
that encodes the name of a register.

----------------------------------------------------------------------------------

This paragaph of the document has been extended since 2.0.0.

The statement that these DW_OP_reg have to be used "Each register name 
operator must be used alone (as a DWARF expression consisting of just 
that one operation)." seems to conflict with the examples given below in 
2.6.5:

----------------------------------------------------------------------------------
DW_OP_reg0 
<http://tsw.tasking.nl/doc/dwarf/dwarf3/Dwarf3-20051220.htm#DW_OP_reg0> DW_OP_piece 
<http://tsw.tasking.nl/doc/dwarf/dwarf3/Dwarf3-20051220.htm#DW_OP_piece> 4 
DW_OP_piece 
<http://tsw.tasking.nl/doc/dwarf/dwarf3/Dwarf3-20051220.htm#DW_OP_piece> 4 
DW_OP_fbreg 
<http://tsw.tasking.nl/doc/dwarf/dwarf3/Dwarf3-20051220.htm#DW_OP_fbreg> -12 
DW_OP_piece 
<http://tsw.tasking.nl/doc/dwarf/dwarf3/Dwarf3-20051220.htm#DW_OP_piece> 4
----------------------------------------------------------------------------------

This expression was valid in DWARF 2.0.0. Can I still use complex 
expressions with DW_reg register name operators?

Best regards,
Marcel Mettes.





More information about the Dwarf-discuss mailing list