This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/1234: local variables in destructor ignored


>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]