Re: ObjectAlloc -- not able to use with debugger launched app?
Re: ObjectAlloc -- not able to use with debugger launched app?
- Subject: Re: ObjectAlloc -- not able to use with debugger launched app?
- From: Chris Kane <email@hidden>
- Date: Mon, 13 Aug 2001 19:31:09 -0700
On Monday, August 13, 2001, at 02:03 PM, tyler wrote:
I was trying to use the nifty ObjectAlloc tool and attach it to a
running process, but had no luck. Anyone care to share the trick on
how to do this?
I really want to be able to step through my application in the PB and
watch the allocations/deallocations my app makes -- Can this be done
with ObjectAlloc?
Currently it is simplest to run the app under ObjectAlloc, then attach
to it in the debugger. This is what I do at any rate. That way you
have complete information in OA -- if you attached with OA, it would
only have information about things that happened after that.
I've actually never tried to attach the debugger in PB to a running
process, so I don't know how you go about that off-hand (I'm too lazy to
launch it to see). I run gdb on the command-line when I want to attach
to something; run it without arguments in this case.
To attach, you use the "attach <pid>" command, where you've gotten <pid>
from 'ps' after launching the app under ObjectAlloc. If you want your
app to wait a while at startup for you to get attached, there are a few
techniques, but the simplest is to 'sleep(15);'. gdb will figure out
the executable involved. After the debugger has attached, "continue" or
whatever.
So: 1) launch app under ObjectAlloc, 2) 'ps' in a Terminal window, look
for your app, pid is on the left, 3) 'gdb', 4) "attach pid".
Chris Kane
Cocoa Frameworks, Apple