This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos 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 and C++ constructors


Hello,
?
I am unable to set breakpoints in, or trace through, C++ constructors. I am
wondering if this problem manifests itself on other platforms, and if anyone
has any suggestions on how to fix it or track it down.
?
A sample program is attached. The comment lines show how I build it, for
Cygwin as well as eCos.
?
I set breakpoints at the two printf statements, but gdb does not stop at the
one in the constructor (the printf happens, though). Tracing into the ?new?
does just that: I see the ?operator new?, then onward into malloc, which
eventually calls ?::unlock_inner and ?::call_pending_DSRs, never to be heard
from again. Setting a watch point on gFlag also causes gdb to disappear into
never-never land.
?
Needless to say, everything works as expected under Cygwin.
?
We are using a custom platform with a Samsung S3C2410X (ARM9 core)
processor. We?re using eCos 2.0.x, where ?x? = CVS ?current? as of
25.03.2004. We use RedBoot as monitor, and RedBoot includes GDB stubs. Our
monitor interface is TCP/IP. We normally use MacGraigor?s arm-elf-gdb --
actually insight = windowed version of gdb -- but the result is the same
with the gdb in ecoscentric-gnutools-arm-elf-1.4-2.cygwin.tar.bz2. 
?
Any suggestions would be VERY welcome ;-)?? 8-/?? =8-O
-- Philip
Keller??????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????
????????? 
?
8<-------------
?
// gcc -g -O0 -o test.exe test.cpp -lsupc++ -lstdc++
// arm-elf-gcc -g -O0 -mcpu=arm9 -o test
-I/opt/ecos/libPT2026/libPT2026_install/include -nostartfiles -nostdlib
-L/opt/ecos/libPT2026/libPT2026_install/lib -Ttarget.ld test.cpp
?
#include <stdio.h>
?
static int gFlag = 0;
?
class test
{
??????????? public :
??????????????????????? test (void);
??????????????????????? void output (char * string);
};
?
int main (void)
{
??????????? test * pTest = new test;
??????????? pTest->output ("Hello world!\n");
??????????? delete pTest;
??????????? return 0;
}
?
test::test (void)
{
??????????? gFlag = 1;
??????????? printf ("Creating new instance of test object.\n");
}
?
void test::output (char * string)
{
??????????? gFlag = 2;
??????????? printf (string);
}
?



--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


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