Yeah, in dwarf2out.c:

 4590 add_AT_low_high_pc (dw_die_ref die, const char *lbl_low, const
char *lbl_high,
......
 4604   if (dwarf_version < 4)
 4605     attr.dw_attr_val.val_class = dw_val_class_lbl_id;
 4606   else
 4607     attr.dw_attr_val.val_class = dw_val_class_high_pc;
.
dw_val_class_lbl_id is handled:
 7984         case dw_val_class_lbl_id:
 7985           dw2_asm_output_addr (DWARF2_ADDR_SIZE, AT_lbl (a), "%s", name);
 7986           break;

dw_val_class_high_pc is handled:
 8027         case dw_val_class_high_pc:
 8028           dw2_asm_output_delta (DWARF2_ADDR_SIZE, AT_lbl (a),
 8029                                 get_AT_low_pc (die), "DW_AT_high_pc");
 8030           break;

The dwarf4 specification says:

If the value of the DW_AT_high_pc is of class address, it is the
relocated address of the first location past the last instruction
associated with the entity; if it is of class constant, the value is
an unsigned integer offset which when added to the low PC gives the
address of the first location past the last instruction associated
with the entity.

However, I'm not sure how to tell how the DW_AT_high_pc's class is
represented...

Maybe it's the bug in the gcc dwarf implementation?

Dehao

On Sun, Sep 16, 2012 at 2:06 AM, H.J. Lu <hjl.to...@gmail.com> wrote:
> On Sat, Sep 15, 2012 at 9:09 AM, Dehao Chen <de...@google.com> wrote:
>> I tried the up-to-date addr2line on any "gcc -g" generated code, it
>> does not work either. This is because in the new dwarf, the
>> DW_AT_high_pc now actually means the size. e.g.
>>
>>  <1><9b>: Abbrev Number: 2 (DW_TAG_subprogram)
>>     <9c>   DW_AT_external    : 1
>>     <9c>   DW_AT_name        : bar
>>     <a0>   DW_AT_decl_file   : 1
>>     <a1>   DW_AT_decl_line   : 8
>>     <a2>   DW_AT_linkage_name: (indirect string, offset: 0x7b): _Z3barv
>>     <a6>   DW_AT_type        : <0x8d>
>>     <aa>   DW_AT_low_pc      : 0x400583
>>     <b2>   DW_AT_high_pc     : 0x37 0x0
>>     <ba>   DW_AT_frame_base  : 1 byte block: 9c         
>> (DW_OP_call_frame_cfa)
>>     <bc>   DW_AT_GNU_all_call_sites: 1
>>     <bc>   DW_AT_sibling     : <0xff>
>>
>> However, addr2line still thinks DW_AT_high_pc means "high_pc". I think
>> we should wait for binutil to catch up with gcc.
>>
>
> So, the meaning of  DW_AT_high_pc in DWARF4 is different
> from DWARF3?
>
> --
> H.J.

Reply via email to