dbx question: how to trace deletion of specific object?

dbx question: how to trace deletion of specific object?

Post by Roy Smit » Sat, 20 Aug 2005 22:22:12



Yesterday, I was trying to track down a memory corruption problem in a
multi-threaded C++ solaris app.  We knew an object was being deleted at the
wrong time, and needed to figure out where.  We could trace all the calls
to operator delete with (IIRC):

when in operator delete { where; }

but that produced a huge amount of output.  We did eventually find out
problem by wading through the huge output that produced, but I'm looking
for a better way.  What we really wanted to do was something like:

when in operator delete and first argument == 0x9be40 { where; }

Is this possible in dbx?

 
 
 

dbx question: how to trace deletion of specific object?

Post by Seongbae Par » Sun, 21 Aug 2005 00:56:50



> Yesterday, I was trying to track down a memory corruption problem in a
> multi-threaded C++ solaris app.  We knew an object was being deleted at the
> wrong time, and needed to figure out where.  We could trace all the calls
> to operator delete with (IIRC):

> when in operator delete { where; }

> but that produced a huge amount of output.  We did eventually find out
> problem by wading through the huge output that produced, but I'm looking
> for a better way.  What we really wanted to do was something like:

> when in operator delete and first argument == 0x9be40 { where; }

> Is this possible in dbx?

On SPARC:

when in operator delete -if $o0 == 0x9be40   { where; }

On x86 or x64, replace $o0 with appropriate stack location/register
where the first parameter is.

Do "help event specification" on dbx command line for more detail.
--
#pragma ident "Seongbae Park, compiler, http://blogs.sun.com/seongbae/"

 
 
 

1. static objects' deletion

I'm C++ programmer.

1.
I heard that all the memory leak detecting tools report memory leaks
for static objects even if it was 'delete' ed.  Is it true?  If yes,
what is the alternative to circumvent this?

2.
static objects will get deleted upon the exit of the program. Say, the
process is hanging(may be in a infinite while loop). If I kill that
process now, is it guaranteed that static object will still gets
deleted ??

Thanks!

2. Low level format for Conner HDD

3. Can I trace to output file from dbx?

4. FTP macros

5. xmkmf trace/truss dbx

6. serial console & real console

7. In C, how to print stack trace like dbx does

8. PerlQt problem

9. Why can't dbx trace gnu-c compiled code?

10. dbx (AIX 3.2.2) core dumps when attempting stack trace

11. problems with dbx, trace

12. dbx and large shared objects

13. debugging object-oriented C in dbx