This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
c++/1234: local variables in destructor ignored
- From: mvanier at cs dot caltech dot edu
- To: gdb-gnats at sources dot redhat dot com
- Date: 4 Jun 2003 04:00:33 -0000
- Subject: c++/1234: local variables in destructor ignored
- Reply-to: mvanier at cs dot caltech dot edu
>Number: 1234
>Category: c++
>Synopsis: local variables in destructor ignored
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Wed Jun 04 04:08:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Michael Vanier
>Release: gdb 5.3
>Organization:
>Environment:
Debian Linux, 2.4.17 kernel, g++ 3.3
>Description:
Gdb does not recognize local variables within a destructor, making it impossible to examine their values. In the code snippet below, setting a breakpoint in the destructor Test::~Test() allows me to step through the destructor code, but I can't print the value of "t" because gdb says that there is no such variable in the current context. When I do "info locals" gdb asserts that there are no locals.
>How-To-Repeat:
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;
}
>Fix:
None.
>Release-Note:
>Audit-Trail:
>Unformatted: