Marcel Ammerlaan | 26 Apr 2003 16:32
Picon
Favicon

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

Boehm, Hans | 28 Apr 2003 20:45
Picon
Favicon

RE: Debugging C++ problem

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@...]
> Sent: Saturday, April 26, 2003 7:32 AM
> To: gc@...
> 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?
(Continue reading)


Gmane