For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > August 2005 > dbx question: how to trace deletion of specific object?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author dbx question: how to trace deletion of specific object?
Roy Smith

2005-08-19, 4:18 pm

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?
Seongbae Park

2005-08-19, 4:18 pm

Roy Smith <roy@panix.com> wrote:
> 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/"
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com