This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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]

Gdb didnot step into the break point in class constructor in RH 8.0


Hi, all,

I came across a very weird problem on RH 8.0, gdb
didnot step into the breakpoint set in class
constructor. The program test3.cpp is very very
simple:

      1 #include <stdlib.h>
      2
      3 class TranMessage
      4 {
      5 public:
      6         TranMessage(int age);
      7 private:
      8         int mAge;
      9 };
     10
     11 TranMessage::TranMessage(int age)
     12 {
     13         mAge = age;
     14 }
     15 int main()
     16 {
     17      TranMessage* tran = new TranMessage(200);
     18      return 0;
     19 }

[kaiduanx@localhost test3]$ /usr/bin/g++ --version
g++ (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying
conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.

/usr/bin/g++ -o test3 -g test3.cpp
[kaiduanx@localhost test3]$ gdb ./test3
GNU gdb Red Hat Linux (5.2.1-4)
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 "i386-redhat-linux"...
(gdb) b 17
Breakpoint 1 at 0x8048484: file test3.cpp, line 17.
(gdb) run
Starting program: /home/kaiduanx/test/test3/test3

Breakpoint 1, main () at test3.cpp:17
17              TranMessage* tran = new
TranMessage(200);
(gdb) s
operator new(unsigned) (sz=4)
    at ../../../../libstdc++-v3/libsupc++/new_op.cc:46
46      ../../../../libstdc++-v3/libsupc++/new_op.cc:
No such file or directory.        in
../../../../libstdc++-v3/libsupc++/new_op.cc
(gdb)

what is the problem? 

I also downloaded the latest gcc version 3.4.3 source
code and build it (configure; make; make install; and
installed in /usr/local/bin). The result is a little
different.

[kaiduanx@localhost test3]$ /usr/local/bin/g++ -o
test3 -g test3.cpp
[kaiduanx@localhost test3]$ gdb ./test3
GNU gdb Red Hat Linux (5.2.1-4)
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 "i386-redhat-linux"...
(gdb) b 17
Breakpoint 1 at 0x80484fd: file test3.cpp, line 17.
(gdb) run
Starting program: /home/kaiduanx/test/test3/test3

Breakpoint 1, main () at test3.cpp:17
17              TranMessage* tran = new
TranMessage(200);
(gdb) s
operator new(unsigned) (sz=4)
    at
../../../../gcc-3.4.3/libstdc++-v3/libsupc++/new_op.cc:46
46        if (sz == 0)

Now it can enter into the new_op.cc, but if I set
breakpoint in the Constructor (line number 13),

(gdb) b 13
Breakpoint 1 at 0x80484c7: file test3.cpp, line 13.
(gdb) run
Starting program: /home/kaiduanx/test/test3/test3

Program exited normally.

GDB did NOT step into the constructor!!!

Can anyone tell me what is wrong? I tested the program
on RH 9.0, gdb can step into the constructor. But due
to other reasons, I donot want to upgrade my system to
RH 9.0.

Thank your patience for reading so long, :)

Best regards,

kaiduan


______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca


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