public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "scovich at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/32186]  New: -ggdb emits broken debug info
Date: Sat, 02 Jun 2007 09:28:00 -0000	[thread overview]
Message-ID: <bug-32186-14600@http.gcc.gnu.org/bugzilla/> (raw)

Compiling with 'g++ -ggdb' confuses both gdb-6.5 and gdb-6.6 into thinking
they've got corrupted stacks. My programs all seem to execute properly, both
alone and inside gdb -- it's just hard to debug anything. Using 'g++ -g'
instead seems to work fine.

Consider 'g++ -ggdb foo.cpp' with the following code snippet:

void foo() {
  int i;
  i=1;
}

int main() {
  foo();
  return 0;
}

Below is the gdb output as I step through the resulting executable. 

Current directory is c:/cygwin/home/johnsory/experiments/
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) start
Breakpoint 1 at 0x401071: file foo.cpp, line 6.
Starting program: /home/johnsory/experiments/a.exe 
Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll
Loaded symbols for /usr/bin/cygwin1.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll
main () at foo.cpp:6
(gdb) step
(gdb) bt
#0  main () at foo.cpp:7
(gdb) step
foo () at foo.cpp:1
(gdb) bt
#0  foo () at foo.cpp:1
#1  0x00401050 in mainCRTStartup ()
(gdb) step
(gdb) bt
#0  foo () at foo.cpp:3
#1  0x00401056 in foo () at foo.cpp:1
#2  0x00401056 in foo () at foo.cpp:1
#3  0x00401056 in foo () at foo.cpp:1
#4  0x00401056 in foo () at foo.cpp:1
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) step
(gdb) bt
#0  foo () at foo.cpp:4
#1  0x0040105d in foo () at foo.cpp:3
#2  0x0040105d in foo () at foo.cpp:3
#3  0x0040105d in foo () at foo.cpp:3
#4  0x0040105d in foo () at foo.cpp:3
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) step
main () at foo.cpp:8
(gdb) bt
#0  main () at foo.cpp:8
(gdb) step
(gdb) bt
#0  main () at foo.cpp:9
(gdb) step
0x61006198 in dll_crt0_1 () from /usr/bin/cygwin1.dll
(gdb) bt
#0  0x61006198 in dll_crt0_1 () from /usr/bin/cygwin1.dll
#1  0x61004416 in _cygtls::call2 () from /usr/bin/cygwin1.dll
#2  0x00000000 in ?? ()
(gdb) step
Single stepping until exit from function _Z10dll_crt0_1Pv, 
which has no line number information.

Program exited normally.
(gdb)


-- 
           Summary: -ggdb emits broken debug info
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: scovich at gmail dot com
GCC target triplet: i686-pc-cygwin


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32186


             reply	other threads:[~2007-06-02  9:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-02  9:28 scovich at gmail dot com [this message]
2007-06-02  9:37 ` [Bug c++/32186] " scovich at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-32186-14600@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).