public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mvanier@cs.caltech.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/11098] New: g++ doesn't emit complete debugging information for local variables in destructors
Date: Thu, 05 Jun 2003 07:27:00 -0000	[thread overview]
Message-ID: <20030605072735.11098.mvanier@cs.caltech.edu> (raw)

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: g++ doesn't emit complete debugging information for
                    local variables in destructors
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mvanier@cs.caltech.edu
                CC: gcc-bugs@gcc.gnu.org

Consider this code (in the file "foo.cc"):

// Begin code:
class Test {
private:
    int *data;
public:
    Test();
    ~Test();
};

Test::Test() {
    data = new int[1000];
}

Test::~Test() {
    int *t = data;
    delete [] t;
}


int main() {
    Test s;
    return 0;
}
// End code.

When I compile this with "g++ -Wall -g foo.cc -o foo" and then bring up gdb 5.3
and set a breakpoint in the destructor, this happens:

[tap] gdb foo
GNU gdb 5.3
Copyright 2002 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-linux-gnu"...
(gdb) break Test::~Test()
Breakpoint 1 at 0x80484c6: file foo.cc, line 13.
(gdb) run
Starting program: /home/mvanier/tmp/cs11/foo 

Breakpoint 1, ~Test (this=0xbfffee30) at foo.cc:14
14          int *t = data;
(gdb) p t
No symbol "t" in current context.
(gdb) info locals
No locals.
(gdb) 

Clearly this is wrong, as "t" is a local variable in the destructor.

I sent in a bug report to the gdb developers, and they say that the reason this
is happening is that g++ is not outputting the correct debugging information.
They tell me I should refer you to bugs debug/10156 in the gcc GNATS database
and c++/1234 in the gdb GNATS database (the latter being the one I submitted).
Thanks in advance for your help.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


             reply	other threads:[~2003-06-05  7:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-05  7:27 mvanier@cs.caltech.edu [this message]
2003-06-22 13:13 ` [Bug c++/11098] " pinskia at physics dot uc dot edu
2003-07-05 15:45 ` [Bug c++/11098] [3.3./3.4 regression] [dwarf2] " pinskia at physics dot uc dot edu
2003-07-14 22:22 ` [Bug debug/11098] " mmitchel at gcc dot gnu dot org
2003-07-15  1:04 ` cvs-commit at gcc dot gnu dot org
2003-07-15  1:05 ` cvs-commit at gcc dot gnu dot org
2003-07-15  1:06 ` mmitchel at gcc dot gnu dot org
2003-07-15  1:12 ` mmitchel at gcc dot gnu dot org
2003-09-03  6:07 ` pinskia at gcc dot gnu dot org

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=20030605072735.11098.mvanier@cs.caltech.edu \
    --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).