[Gc] Debugging C++ problem

Boehm, Hans hans_boehm@hp.com
Mon, 28 Apr 2003 11:45:20 -0700


On Linux/X86 you should be able to build the collector with -DSAVE_CALL_COUNT=8 (or --enable-full-debug).  This will save partial stack traces in each object.  In the most recent versions of the collector, diagnostic routines should print this in human-readable form, assuming you compile with -g and have addr2line available.

For this to work, don't compile with -fomit-frame-pointer.  The stack saving code relies on the frame pointer.

Unfortunately, this varies depending on the hardware platform, since stack unwinding ease/facilities vary.  (In the most recent version, with gcc, either -DAVE_CALL_COUNT should work, or you should get one additional return address automatically, using gcc's __builtin_return_address(0).) 

Hans

> -----Original Message-----
> From: Marcel Ammerlaan [mailto:marcel-spam@wanadoo.nl]
> Sent: Saturday, April 26, 2003 7:32 AM
> To: gc@napali.hpl.hp.com
> Subject: [Gc] Debugging C++ problem
> 
> 
> Hi,
> 
> I recently started using C++, but coming from a
> Java background I prefer GC over explicit management.
> 
> However, I ran into a problem using the debug code
> for the collector: because the C++ wrapper for the
> GC code is not based on macro's the __LINE__ and __FILE__
> macros are not meaningfull (they always point to the
> GC code). Is there another way to get the desired information?
> (btw. platform is Linux 2.4.19/Gcc 3.3)
> 
> thanks,
> marcel
> -- 
> Don't let people drive you crazy
> when you know it's in walking distance
> _______________________________________________
> Gc mailing list
> Gc@linux.hpl.hp.com
> http://linux.hpl.hp.com/cgi-bin/mailman/listinfo/gc
>