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]

Re: gdb and C++ constructors


I did encounter this problem, too. It affects classes using virtual inheritance
and only appears when doing remote debugging. When trying to set a breakpoint
inside a constructor, the line GDB outputs on the console indicates that it tried
to set the BP at some weird line number. We are using a BDI2000 JTAG interface
for debugging, but since you encounter the same problem using eCos gdb stubs,
this is obviously a GDB problem.

Sorry that I can only confirm your observations and not offer any help
otherwise.

tk

Philip Keller wrote:
> 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);
> }
> ?

-- 
--------------------------------------------------

Thomas Koeller, Software Development
Basler Vision Technologies

thomas dot koeller at baslerweb dot com
http://www.baslerweb.com

==============================

--
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]