[cfe-dev] Fwd: clang may generate incorrect dwarf info?

Andriy Gapon avg at FreeBSD.org
Wed Apr 3 06:49:17 PDT 2013


-------- Original Message --------


Function signature in FreeBSD source code:
void _sx_xunlock(struct sx *sx, const char *file, int line);

DWARF (reported by objdump -x -w -W) when compiled with gcc:
 <1><8337>: Abbrev Number: 63 (DW_TAG_subprogram)
  <8338>     DW_AT_external    : 1
  <8339>     DW_AT_name        : (indirect string, offset: 0x48c9): _sx_xunlock
  <833d>     DW_AT_decl_file   : 1
  <833e>     DW_AT_decl_line   : 373
  <8340>     DW_AT_prototyped  : 1
  <8341>     DW_AT_low_pc      : 0x13a7
  <8349>     DW_AT_high_pc     : 0x143e
  <8351>     DW_AT_frame_base  : 0x3cd3 (location list)
  <8355>     DW_AT_sibling     : <84a4>
 <2><8359>: Abbrev Number: 59 (DW_TAG_formal_parameter)
  <835a>     DW_AT_name        : sx
  <835d>     DW_AT_decl_file   : 1
  <835e>     DW_AT_decl_line   : 372
  <8360>     DW_AT_type        : <2cac>
  <8364>     DW_AT_location    : 0x3d1f (location list)
 <2><8368>: Abbrev Number: 60 (DW_TAG_formal_parameter)
  <8369>     DW_AT_name        : (indirect string, offset: 0x9016): file
  <836d>     DW_AT_decl_file   : 1
  <836e>     DW_AT_decl_line   : 372
  <8370>     DW_AT_type        : <1ea>
  <8374>     DW_AT_location    : 0x3d8e (location list)
 <2><8378>: Abbrev Number: 60 (DW_TAG_formal_parameter)
  <8379>     DW_AT_name        : (indirect string, offset: 0x12a): line
  <837d>     DW_AT_decl_file   : 1
  <837e>     DW_AT_decl_line   : 372
  <8380>     DW_AT_type        : <5f>
  <8384>     DW_AT_location    : 0x3dd7 (location list)

Ditto when compiled with clang:
 <1><2c70>: Abbrev Number: 55 (DW_TAG_subprogram)
  <2c71>     DW_AT_name        : (indirect string, offset: 0x1817): _sx_xunlock
  <2c75>     DW_AT_decl_file   : 1
  <2c76>     DW_AT_decl_line   : 373
  <2c78>     DW_AT_prototyped  : 1
  <2c78>     DW_AT_external    : 1
  <2c78>     DW_AT_inline      : 1      (inlined)
 <2><2c79>: Abbrev Number: 51 (DW_TAG_formal_parameter)
  <2c7a>     DW_AT_name        : (indirect string, offset: 0xd061): line
  <2c7e>     DW_AT_decl_file   : 1
  <2c7f>     DW_AT_decl_line   : 373
  <2c81>     DW_AT_type        : <a2>
 <2><2c85>: Abbrev Number: 51 (DW_TAG_formal_parameter)
  <2c86>     DW_AT_name        : (indirect string, offset: 0xd056): sx
  <2c8a>     DW_AT_decl_file   : 1
  <2c8b>     DW_AT_decl_line   : 373
  <2c8d>     DW_AT_type        : <782c>
 <2><2c91>: Abbrev Number: 51 (DW_TAG_formal_parameter)
  <2c92>     DW_AT_name        : (indirect string, offset: 0xc67): file
  <2c96>     DW_AT_decl_file   : 1
  <2c97>     DW_AT_decl_line   : 373
  <2c99>     DW_AT_type        : <32>

First, looks like the parameters come in a wrong order.

[snip]

-- 
Andriy Gapon





More information about the cfe-dev mailing list