public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* GDB, g++, backtrace problem
@ 2004-11-08 16:30 Andrew de Quincey
  0 siblings, 0 replies; only message in thread
From: Andrew de Quincey @ 2004-11-08 16:30 UTC (permalink / raw)
  To: gdb

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?

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-11-08  0:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-08 16:30 GDB, g++, backtrace problem Andrew de Quincey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).