[Dwarf-Discuss] PROPOSAL: DW_OP_implicit_pointer
Ron Brender
ron.brender@charter.net
Sun Aug 15 22:30:52 GMT 2010
Jakub,
OK, good, that helps a lot. One can imagine that the internal debug
implementation can use a kind of "unavailable but potentially unneeded
pointer" value that is not, of itself, necessarily a user error until
that turns out to be the value of the overall user expression.
Now keep going... How does DW_op_implicit_pointer help with
disaggregated fields of a struct?
Your posited inline add() and non-inlined foo() functions and claimed
"Similarly in the inlined add calls you can print *a->x, a->y, *b->x,
b->y or in foo print say *p[0].x."
Please explain, by similarly detailed example, how this works?
Thanks,
Ron
--------------------
Jakub Jelinek wrote:
> On Sun, Aug 15, 2010 at 02:52:04PM -0400, Ron Brender wrote:
>> Finally, as described, it appears that this operator neither uses
>> any values that are expected to be on the DEBUG stack nor has any
>> effect (pushes/pops/whatever) on the DEBUG stack--is that correct?
>
> It is a terminal, similarly to e.g. DW_OP_reg*, it can appear just
> in the same contexts as DW_OP_reg*.
>
> For:
>
> int
> bar (int i)
> {
> int *j = &i;
> int **k = &j;
> int ***l = &k;
> i++;
> return i;
> }
>
> GCC generates:
> .uleb128 0x3 # (DIE (0x4e) DW_TAG_formal_parameter)
> .ascii "i\0" # DW_AT_name
> .byte 0x1 # DW_AT_decl_file (qqq.c)
> .byte 0x2 # DW_AT_decl_line
> .long 0x8c # DW_AT_type
> .uleb128 0x3 # DW_AT_location
> .byte 0x75 # DW_OP_breg5
> .sleb128 1
> .byte 0x9f # DW_OP_stack_value
> .uleb128 0x4 # (DIE (0x5b) DW_TAG_variable)
> .ascii "j\0" # DW_AT_name
> .byte 0x1 # DW_AT_decl_file (qqq.c)
> .byte 0x4 # DW_AT_decl_line
> .long 0x93 # DW_AT_type
> .uleb128 0x6 # DW_AT_location
> .byte 0xf2 # DW_OP_GNU_implicit_pointer
> .long .Ldebug_info0+78 # ref to DIE 0x4e
> .sleb128 0
> .uleb128 0x4 # (DIE (0x6b) DW_TAG_variable)
> .ascii "k\0" # DW_AT_name
> .byte 0x1 # DW_AT_decl_file (qqq.c)
> .byte 0x5 # DW_AT_decl_line
> .long 0x99 # DW_AT_type
> .uleb128 0x6 # DW_AT_location
> .byte 0xf2 # DW_OP_GNU_implicit_pointer
> .long .Ldebug_info0+91 # ref to DIE 0x5b
> .sleb128 0
> .uleb128 0x4 # (DIE (0x7b) DW_TAG_variable)
> .ascii "l\0" # DW_AT_name
> .byte 0x1 # DW_AT_decl_file (qqq.c)
> .byte 0x6 # DW_AT_decl_line
> .long 0x9f # DW_AT_type
> .uleb128 0x6 # DW_AT_location
> .byte 0xf2 # DW_OP_GNU_implicit_pointer
> .long .Ldebug_info0+107 # ref to DIE 0x6b
> .sleb128 0
>
> So, if the debugger wants to
> print j
> it knows that the value is implicit pointer and can print something like
> <optimized out pointer>
> but for
> print *j
> it sees it is a implicit pointer to DIE 0x4e with offset 0 and
> that DIE has reg5 + 1 value, so it prints that value.
>
> Jakub
>
>
More information about the Dwarf-discuss
mailing list