[Dwarf-Discuss] PROPOSAL: DW_OP_implicit_pointer

Jakub Jelinek jakub at redhat.com
Sun Aug 15 12:01:58 PDT 2010


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