Complex DWARF expressions

Eli Zaretskii
2014-09-21T19:33:01Z

I was debugging a crash in an optimized program, and wanted to know
the value of some variable, but was greeted with "<optimized out>".
So I tried to see if the value is in a register, and this is what I
saw:

(gdb) info address new_width
Symbol "new_width" is multi-location:
Range 0x100a847-0x100a8d9: a variable in $edx
Range 0x100a8d9-0x100a8e6: a complex DWARF expression:
0: DW_OP_breg3 176 [$ebx]

Range 0x100a8e6-0x100a8ee: a complex DWARF expression:
0: DW_OP_GNU_entry_value
2: DW_OP_reg2 [$edx]
3: DW_OP_stack_value

Range 0x100a8ee-0x100a955: a variable in $edx
Range 0x100a955-0x100aaed: a complex DWARF expression:
0: DW_OP_GNU_entry_value
2: DW_OP_reg2 [$edx]
3: DW_OP_stack_value

Range 0x100aaed-0x100aaf7: a variable in $edx
Range 0x100aaf7-0x100ad4c: a complex DWARF expression:
0: DW_OP_GNU_entry_value
2: DW_OP_reg2 [$edx]
3: DW_OP_stack_value

"A variable in $edx" I understand, but what about the "complex DWARF
expression" parts? Is there any way a mere mortal such as myself can
decipher this to the effect of understanding in which register or at
what address can I look up the value, assuming that I know at which PC
address the program stopped?

(Yes, I've looked at the DWARF Standard, but couldn't understand from
the description of these location descriptors how to convert them to
either a register or a memory address.)

TIA for any help.