This is the mail archive of the gdb@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]

GDB, g++, backtrace problem


Hi, I've now patched my PPC405 kernel so GDB's breakpoints work correctly. I 
now have another problem.

GDB 6.2.1
GCC 3.3.4
linux 2.4.20
uclibc latest snapshot

test program:
-------
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

class test{
 public:
   int testmethod();
};

int main(int argc, char* argv[])
{
   test* test1 = new test();

   test1->testmethod();
}

int test::testmethod()
{
   printf("hi\n");

}
---------
Compiled with: g++ -g -O2 -fPIC test.cpp

I put a breakpoint on test::testmethod. GDB gives the following in the 
backtrace:

#0  test::testmethod (this=0x10011050) at test.cpp:22
#1  0x10000608 in test::testmethod (this=0x10011050) at test.cpp:21
#2  0x10000608 in test::testmethod (this=0x10011050) at test.cpp:21
#3  0x10000608 in test::testmethod (this=0x10011050) at test.cpp:21
Previous frame inner to this frame (corrupt stack?)

It needs -O2 (or -O3) and -fPIC to do it - if you use -O, or miss off -fPIC, 
the backtrace is correct.

Does anyone have any suggestions what might be causing this?


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