This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug c++/17772] New: libstdc++'s debug info confuses gdb (with "reproducer")
- From: "eclig at gmx dot net" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Mon, 29 Dec 2014 21:11:00 +0000
- Subject: [Bug c++/17772] New: libstdc++'s debug info confuses gdb (with "reproducer")
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=17772
Bug ID: 17772
Summary: libstdc++'s debug info confuses gdb (with
"reproducer")
Product: gdb
Version: unknown
Status: NEW
Severity: normal
Priority: P2
Component: c++
Assignee: unassigned at sourceware dot org
Reporter: eclig at gmx dot net
Created attachment 8035
--> https://sourceware.org/bugzilla/attachment.cgi?id=8035&action=edit
source file demonstrating the problem
I'm having trouble displaying structure members with certain names in
GDB. In this concrete example GDB refuses to display the member
called `complex':
$ cat gdb-reproducer.cpp
#include <iostream>
using std::cout;
typedef struct {
int rlevel;
int complex;
} param_t;
int main(int argc, char *argv[]) {
param_t foo;
foo.rlevel = 4;
foo.complex= foo.rlevel + 11;
cout << "foo.complex: " << foo.complex << "\n";
return(0);
}
$ g++ -Wall -ggdb3 gdb-reproducer.cpp && ./a.out
foo.complex: 15
$ gdb a.out
GNU gdb (Debian 7.7.1+dfsg-3) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from a.out...done.
(gdb) b main
Breakpoint 1 at 0x4007c6: file gdb-reproducer.cpp, line 13.
(gdb) r
Starting program: /home/lopes/projects/c/a.out
Breakpoint 1, main (argc=1, argv=0x7fffffffe958) at gdb-reproducer.cpp:13
13 foo.rlevel = 4;
(gdb) n
14 foo.complex= foo.rlevel + 11;
(gdb) n
16 cout << "foo.complex: " << foo.complex << "\n";
(gdb) p foo
$1 = {rlevel = 4, complex = 15}
(gdb) ptype foo
type = struct param_t {
int rlevel;
int complex;
}
(gdb) p foo.complex
A syntax error in expression, near `'.
Trying to find the culprit I came upon this:
(gdb) info shared
From To Syms Read Shared Object Library
0x00007ffff7ddcae0 0x00007ffff7df5170 Yes
/lib64/ld-linux-x86-64.so.2
No linux-vdso.so.1
0x00007ffff7b2c8e0 0x00007ffff7b9480a Yes
/usr/lib/x86_64-linux-gnu/libstdc++.so.6
0x00007ffff77d5580 0x00007ffff7840de6 Yes
/lib/x86_64-linux-gnu/libm.so.6
0x00007ffff75bcab0 0x00007ffff75cc995 Yes
/lib/x86_64-linux-gnu/libgcc_s.so.1
0x00007ffff72304a0 0x00007ffff735a613 Yes
/lib/x86_64-linux-gnu/libc.so.6
(gdb) noshared
(gdb) p foo.complex
$2 = 15
(gdb) p foo
$3 = {rlevel = 4, complex = 15}
(gdb) p foo.complex
$4 = 15
(gdb) shared libstdc.*
Reading symbols from
/usr/lib/x86_64-linux-gnu/libstdc++.so.6...Reading symbols from
/usr/lib/debug//usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20...done.
done.
Loaded symbols for /usr/lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) p foo.complex
A syntax error in expression, near `'.
(gdb) p foo
$5 = {rlevel = 4, complex = 15}
(gdb) ptype foo
type = struct param_t {
int rlevel;
int complex;
}
This suggests that something in the debug info of libstdc++ seems to
be causing the problem.
Some info about the system I'm using:
$ uname -a
Linux lopes 3.14-1-amd64 #1 SMP Debian 3.14.12-1 (2014-07-11) x86_64
GNU/Linux
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.1-4'
--with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.9 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify
--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.9-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --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.9.1 (Debian 4.9.1-4)
$ dpkg -l | grep -F 'libstdc++'
ii libstdc++-4.9-dev:amd64 4.9.1-4 amd64 GNU Standard
C++ Library v3 (development files)
ii libstdc++6:amd64 4.9.1-4 amd64 GNU Standard
C++ Library v3
ii libstdc++6-4.9-dbg:amd6 4.9.1-4 amd64 GNU Standard
C++ Library v3 (debugging files)
$ dpkg -l | grep -F 'gcc'
ii gcc 4:4.9.0-4 amd64 GNU C
compiler
ii gcc-4.7-base:amd64 4.7.4-2 amd64 GCC, the GNU
Compiler Collection (base package)
ii gcc-4.8 4.8.3-7 amd64 GNU C
compiler
ii gcc-4.8-base:amd64 4.8.3-7 amd64 GCC, the GNU
Compiler Collection (base package)
ii gcc-4.9 4.9.1-4 amd64 GNU C
compiler
ii gcc-4.9-base:amd64 4.9.1-4 amd64 GCC, the GNU
Compiler Collection (base package)
ii libgcc-4.8-dev:amd64 4.8.3-7 amd64 GCC support
library (development files)
ii libgcc-4.9-dev:amd64 4.9.1-4 amd64 GCC support
library (development files)
ii libgcc1:amd64 1:4.9.1-4 amd64 GCC support
library
ii libgcc1-dbg:amd64 1:4.9.1-4 amd64 GCC support
library (debug symbols)
ii linux-compiler-gcc-4.8- 3.14.15-2 amd64 Compiler for
Linux on x86 (meta-package)
Please let me know if you can reproduce this. I've also seen this
error when using GDB 7.8 and IIRC 7.6.
I'm working on somewhat larger codebase, with lots of automatically
generated code from XML files, using those structures. So I would be
very thankful if someone could provide a workaround (aside from
abstaining from a debugging-enabled libstdc++) or a patch for this
"interesting behaviour".
Thank you very much!
EmÃlio
--
You are receiving this mail because:
You are on the CC list for the bug.