[Dwarf-Discuss] Semantics of DW_OP_(b)reg

David Anderson davea42@linuxmail.org
Fri Mar 17 21:49:24 GMT 2017

On 03/17/2017 01:18 PM, Adrian Prantl wrote:
> Are these two expressions equivalent?
> 1. DW_OP_breg1 0 DW_OP_breg2 0 DW_OP_plus DW_OP_stack_value
> 2. DW_OP_reg1    DW_OP_reg2    DW_OP_plus DW_OP_stack_value

In DW4 (DW5 has same text)
These operations name a register location. To fetch the contents of a
register, it is necessary to
use one of the register based addressing operations, such as DW_OP_bregx
(see Section

To me that means that 2. above cannot work.

In 1. the value of   DW_OP_breg1 0
(for example) is  pushed on the stack.

Can someone point out
where the standard (4 or 5 or?) states the push happens?
Ah yes: DW5: Register Values

The following operations push a value onto the stack
that is either the contents of a register or the result
of adding the contents of a register to a given
signed offset. DW_OP_regval_type pushes the
contents of the register together with the given
base type, while the other operations push the
result of adding the contents of a register
to a given signed offset together with the generic type.

Notice that DW_OP_reg<n> is NOT in the list where something
gets pushed on the stack.


More information about the Dwarf-discuss mailing list