[Bug debug/60524] New: Typedef information bypassed in dwarf2 function parameter information when it is 'const'
wpk at culm dot net
gcc-bugzilla@gcc.gnu.org
Fri Mar 14 09:52:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60524
Bug ID: 60524
Summary: Typedef information bypassed in dwarf2 function
parameter information when it is 'const'
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: wpk at culm dot net
For following code:
typedef unsigned char Bar[12];
void foo(Bar *bar) {}
void fooconst(const Bar *bar) {}
compiled with gcc -gdwarf-2 -c, readelf -wi shows the foolowing dwarf-2 info:
For typedef Bar:
<1><2d>: Abbrev Number: 2 (DW_TAG_typedef)
<2e> DW_AT_name : Bar
<32> DW_AT_decl_file : 1
<33> DW_AT_decl_line : 1
<34> DW_AT_type : <0x38>
<1><38>: Abbrev Number: 3 (DW_TAG_array_type)
<39> DW_AT_type : <0x4f>
<3d> DW_AT_sibling : <0x48>
For 'foo' function:
<1><56>: Abbrev Number: 6 (DW_TAG_subprogram)
(...)
<58> DW_AT_name : foo
(...)
<2><78>: Abbrev Number: 7 (DW_TAG_formal_parameter)
<79> DW_AT_name : bar
(...)
<7f> DW_AT_type : <0x87>
(...)
<1><87>: Abbrev Number: 8 (DW_TAG_pointer_type)
<88> DW_AT_byte_size : 8
<89> DW_AT_type : <0x2d>
This points to DW_TAG_typedef for 'Bar'
But for 'fooconst':
<1><8d>: Abbrev Number: 9 (DW_TAG_subprogram)
(...)
<8f> DW_AT_name : (indirect string, offset: 0x5c): fooconst
(...)
<2><af>: Abbrev Number: 7 (DW_TAG_formal_parameter)
<b0> DW_AT_name : bar
(..)
<b6> DW_AT_type : <0xbe>
(..)
<1><be>: Abbrev Number: 8 (DW_TAG_pointer_type)
<bf> DW_AT_byte_size : 8
<c0> DW_AT_type : <0x38>
This points directly to unsigned char[12], completely bypassing typedef Bar
info.
GCC version info:
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.8.1-10ubuntu9' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin
--with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
--enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre
--enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu9)
More information about the Gcc-bugs
mailing list