From: Bill Bumgarner <bbum@co...> - 2002-10-24 03:48:07
I'm trying to track down the segfault that occurs after the third or
fourth NSArray/NSDictionary is created. Bad bug. Trashes the stack.
Very hard to figure out (at least for me).
Some random tips...
- You can run the tests under gdb in project builder.... this gives
access to the handy dandy PBX debugging GUI.
Create a new foundation tool project
Delete the source and frameworks... everything but the product.
Add a custom executable. Set the executable to /usr/bin/python.
Add an argument. Set it to the path to one of the unit testing
scripts (or whatever).
Click the debug icon.....
Now, to break somewhere in the bridge, you probably don't want to set
any old breakpoint. More likely, you want to set the breakpoints that
you want, then disable them, then set a single breakpoint that will be
hit after module initialization. To do this, I chose some random
debugging function that is relatively innocuous that I could call from
the python code.
class TestNSArrayInteraction( unittest.TestCase ):
def testNSArrayAllocation( self ):
for i in range(1,1000):
print "c: %s" % i
a = NSArray.array()
b = NSArray.alloc().init()
.... I chose NSCountFrames(). In gdb, I set a breakpoint on
NSCountFrames(). When the breakpoint is hit, simply enable the real
breakpoints and continue execution.
Works for me, anyway.