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] |
>Number: 1141 >Category: c++ >Synopsis: cannot print local variables in (some) constructor functions >Confidential: no >Severity: serious >Priority: high >Responsible: unassigned >State: open >Class: change-request >Submitter-Id: net >Arrival-Date: Thu Mar 13 16:48:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: germain at cs dot utah dot edu >Release: gdb 5.3 (gcc 3.2.(1 or 2)) >Organization: >Environment: Linux juggler 2.4.18-17.7.xsmp #1 SMP Tue Oct 8 12:37:04 EDT 2002 i686 unknown >Description: I'm having a problem with the gdb (5.3) debugger being able to tell me the value of local variables in a class function. I'm compiling with g++ 3.2.1. Here is the code: class ABC { public: ABC(double x); ABC(int x) { int temp = x; x_ = temp; } int x_; }; ABC::ABC(double x) { double temp = x; x_ = temp; } int main(int argc, char* argv[]) { ABC abc(1.0); ABC def(1); } % g++ -g test.cpp -o test the problem is that when i step into the constructor taking a double, I cannot print the temp variable ("No symbol "temp" in current context." When i step into the int (inlined) constructor, I can print the temp variable. (gdb) break main (gdb) run Starting program: /home/germain/PETE/jim Breakpoint 1, main (argc=1, argv=0xbffff514) at test.cpp:24 (gdb) s ABC (this=0xbffff4a4, x=1) at test.cpp:18 (gdb) p temp No symbol "temp" in current context. (gdb) fin Run till exit from #0 ABC (this=0xbffff4a4, x=1) at test.cpp:18 main (argc=1, argv=0xbffff514) at test.cpp:25 (gdb) s ABC (this=0xbffff4a0, x=1) at test.cpp:10 (gdb) p temp $1 = 1072693248 (gdb) I do not think this is a case of the compiler optimizing the variable away, (no optimization flags are used...) and if it is, then it shouldn't be (IMO). any help would be appreciated thanks jim >How-To-Repeat: see description. >Fix: hope you can help me >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] |