public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17772] New: libstdc++'s debug info confuses gdb (with "reproducer")
@ 2014-12-29 21:11 eclig at gmx dot net
  2023-12-27 13:05 ` [Bug c++/17772] " ssbssa at sourceware dot org
  0 siblings, 1 reply; 2+ messages in thread
From: eclig at gmx dot net @ 2014-12-29 21:11 UTC (permalink / raw)
  To: gdb-prs

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.
>From gdb-prs-return-17225-listarch-gdb-prs=sources.redhat.com@sourceware.org Mon Dec 29 21:12:02 2014
Return-Path: <gdb-prs-return-17225-listarch-gdb-prs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-gdb-prs@sources.redhat.com
Received: (qmail 27272 invoked by alias); 29 Dec 2014 21:12:01 -0000
Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <gdb-prs.sourceware.org>
List-Subscribe: <mailto:gdb-prs-subscribe@sourceware.org>
List-Archive: <http://sourceware.org/ml/gdb-prs/>
List-Post: <mailto:gdb-prs@sourceware.org>
List-Help: <mailto:gdb-prs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: gdb-prs-owner@sourceware.org
Delivered-To: mailing list gdb-prs@sourceware.org
Received: (qmail 27250 invoked by uid 48); 29 Dec 2014 21:12:01 -0000
From: "eclig at gmx dot net" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug c++/17772] libstdc++'s debug info confuses gdb (with
 "reproducer")
Date: Mon, 29 Dec 2014 21:12:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gdb
X-Bugzilla-Component: c++
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: eclig at gmx dot net
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at sourceware dot org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-17772-4717-NQpNp10t0f@http.sourceware.org/bugzilla/>
In-Reply-To: <bug-17772-4717@http.sourceware.org/bugzilla/>
References: <bug-17772-4717@http.sourceware.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://sourceware.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-q4/txt/msg00468.txt.bz2
Content-length: 367

https://sourceware.org/bugzilla/show_bug.cgi?id\x17772

eclig at gmx dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eclig at gmx dot net

--
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/17772] libstdc++'s debug info confuses gdb (with "reproducer")
  2014-12-29 21:11 [Bug c++/17772] New: libstdc++'s debug info confuses gdb (with "reproducer") eclig at gmx dot net
@ 2023-12-27 13:05 ` ssbssa at sourceware dot org
  0 siblings, 0 replies; 2+ messages in thread
From: ssbssa at sourceware dot org @ 2023-12-27 13:05 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17772

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
                 CC|                            |ssbssa at sourceware dot org
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |8.2

--- Comment #1 from Hannes Domani <ssbssa at sourceware dot org> ---
Dup.

*** This bug has been marked as a duplicate of bug 11927 ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-27 13:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-29 21:11 [Bug c++/17772] New: libstdc++'s debug info confuses gdb (with "reproducer") eclig at gmx dot net
2023-12-27 13:05 ` [Bug c++/17772] " ssbssa at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).