How to print self in debugger console on private method - objective-c

Here's my stack trace for an exception.
#0 0x049f088a in objc_exception_throw ()
#1 0x05f933b5 in __NSFastEnumerationMutationHandler ()
#2 0x03046e9d in -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] ()
#3 0x03047043 in __85-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]_block_invoke ()
#4 0x03046f14 in -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] ()
#5 0x03047043 in __85-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]_block_invoke ()
#6 0x03046f14 in -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] ()
#7 0x03046d3e in -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:] ()
#8 0x03052187 in -[UIView(Internal) _addSubview:positioned:relativeTo:] ()
#9 0x03045846 in -[UIView(Hierarchy) insertSubview:atIndex:] ()
#10 0x02fde714 in __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke ()
#11 0x0304c3ef in +[UIView(Animation) performWithoutAnimation:] ()
#12 0x02fddc96 in -[_UINavigationParallaxTransition animateTransition:] ()
#13 0x03118e4e in -[UINavigationController _startCustomTransition:] ()
#14 0x031250c7 in -[UINavigationController _startDeferredTransitionIfNeeded:] ()
#15 0x03125cb9 in -[UINavigationController __viewWillLayoutSubviews] ()
#16 0x0325f181 in -[UILayoutContainerView layoutSubviews] ()
#17 0x03055267 in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] ()
#18 0x04a0281f in -[NSObject performSelector:withObject:] ()
#19 0x023b12ea in -[CALayer layoutSublayers] ()
#20 0x023a50d4 in CA::Layer::layout_if_needed(CA::Transaction*) ()
#21 0x023a4f40 in CA::Layer::layout_and_display_if_needed(CA::Transaction*) ()
#22 0x0230cae6 in CA::Context::commit_transaction(CA::Transaction*) ()
#23 0x0230de71 in CA::Transaction::commit() ()
#24 0x0230e544 in CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) ()
#25 0x05ecb4ce in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
#26 0x05ecb41f in __CFRunLoopDoObservers ()
#27 0x05ea9344 in __CFRunLoopRun ()
#28 0x05ea8ac3 in CFRunLoopRunSpecific ()
#29 0x05ea88db in CFRunLoopRunInMode ()
#30 0x058939e2 in GSEventRunModal ()
#31 0x05893809 in GSEventRun ()
#32 0x02fead3b in UIApplicationMain ()
#33 0x000035f8 in main at /Users/dmueller39/Projects/ios-bloomberg/Bloomberg/main.mm:18
I had the debugger paused when I captured this. How do I print the value of self on frame #2?

You cannot print self simply by typing po self on stack frames that you do not have the source code for.
What you need to do is print the correct register.
See more information here:
http://www.clarkcox.com/blog/2009/02/04/inspecting-obj-c-parameters-in-gdb/
Make sure to select the correct architecture you are debugging on (i.e. if your binary is 32-bit, 64-bit, arm, simulator, etc).

Would
(lldb) frame select 2
(lldb) po self
work for you?

Related

EXC_BAD_ACCESS on NSLog with no string formatting

I'm getting an EXC_BAD_ACCESS (or a malloc error) on the following line of code:
NSLog(#"Points:");
Which makes zero sense to me, as it should be accessing a string constant and nothing else. It's usually an EXC_BAD_ACCESS, but it occasionally is the following error (on the same line):
Annotate23D(50572,0xac6bb2c0) malloc: *** error for object 0x7051004: incorrect checksum for freed object - object was probably modified after being freed.
The stack trace for the malloc error (I'm having a hard time getting a full one out of the bad access error) is:
#0 0x960e7c97 in malloc_error_break ()
#1 0x960a94ce in szone_error ()
#2 0x960a954e in free_list_checksum_botch ()
#3 0x960afec0 in small_malloc_from_free_list ()
#4 0x960b124c in szone_malloc_should_clear ()
#5 0x960b166b in szone_malloc ()
#6 0x960e7962 in malloc_zone_malloc ()
#7 0x960e8882 in malloc ()
#8 0x020e5837 in uhash_hashUChars ()
#9 0x020e5c01 in uhash_setResizePolicy ()
#10 0x020e5ca5 in uhash_init ()
#11 0x02075896 in uhash_open ()
#12 0x021f5978 in icu::ZoneMeta::getCanonicalCLDRID ()
#13 0x021f6a4f in icu::ZoneMeta::getCanonicalCLDRID ()
#14 0x021ab551 in icu::TimeZone::getCanonicalID ()
#15 0x021bfaf2 in ucal_getCanonicalTimeZoneID ()
#16 0x024d8bf4 in __nameStringOK ()
#17 0x024d8ae4 in -[__NSPlaceholderTimeZone __initWithName:cache:] ()
#18 0x024d89d0 in -[__NSPlaceholderTimeZone initWithName:] ()
#19 0x024d884b in +[NSTimeZone timeZoneWithName:] ()
#20 0x024d8768 in +[NSTimeZone systemTimeZone] ()
#21 0x024d84d7 in +[NSTimeZone defaultTimeZone] ()
#22 0x024d846d in CFTimeZoneCopyDefault ()
#23 0x024e6726 in CFCalendarCreateWithIdentifier ()
#24 0x02509e67 in __CFLogCString ()
#25 0x02509db3 in _CFLogvEx ()
#26 0x00b99b63 in NSLogv ()
#27 0x00b99ad5 in NSLog ()
#28 0x00008323 in -[Cylinderoid generateMesh] (self=0x6a73fa0, _cmd=0x6e836) at /Users/haldean/Code/ipad/Annotate23D/Annotate23D/Cylinderoid.mm:154
#29 0x0006cd85 in -[MeshGenerator rendererForObjects:] (self=0x6a67b80, _cmd=0x6e246, workspace=0xa83f270) at /Users/haldean/Code/ipad/Annotate23D/Annotate23D/MeshGenerator.m:16
#30 0x00005367 in -[WorkspaceViewController renderButton:] (self=0xa8377f0, _cmd=0x6e4ac, sender=0x6a58260) at /Users/haldean/Code/ipad/Annotate23D/Annotate23D/WorkspaceViewController.m:304
#31 0x02562ec9 in -[NSObject performSelector:withObject:withObject:] ()
#32 0x002365c2 in -[UIApplication sendAction:to:from:forEvent:] ()
#33 0x0023655a in -[UIApplication sendAction:toTarget:fromSender:forEvent:] ()
#34 0x002dbb76 in -[UIControl sendAction:to:forEvent:] ()
#35 0x002dc03f in -[UIControl(Internal) _sendActionsForEvents:withEvent:] ()
#36 0x002db2fe in -[UIControl touchesEnded:withEvent:] ()
#37 0x004f4a2a in _UIGestureRecognizerUpdate ()
#38 0x025359ce in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
#39 0x024cc670 in __CFRunLoopDoObservers ()
#40 0x024984f6 in __CFRunLoopRun ()
#41 0x02497db4 in CFRunLoopRunSpecific ()
#42 0x02497ccb in CFRunLoopRunInMode ()
#43 0x0244a879 in GSEventRunModal ()
#44 0x0244a93e in GSEventRun ()
#45 0x00233a9b in UIApplicationMain ()
#46 0x00002b88 in main (argc=1, argv=0xbffff590) at /Users/haldean/Code/ipad/Annotate23D/Annotate23D/main.m:1
It may be relevant that the file in question is an Objective-C++ file with ARC turned on. The method itself is huge, so I put it up here to keep the question shortish. The line in question is line 94. Any ideas on either how to fix it or how to debug are greatly appreciated. Thanks in advance!
Quick edit:
I'm now also getting page corruption errors. From the debugger:
Annotate23D(50697) malloc: protecting edges
Annotate23D(50697) malloc: recording malloc stacks to disk using standard recorder
Annotate23D(50697) malloc: process 50678 no longer exists, stack logs deleted from /tmp/stack-logs.50678.Annotate23D.QDMh8a.index
Annotate23D(50697) malloc: stack logs being written into /tmp/stack-logs.50697.Annotate23D.XuPnEH.index
objc[50697]: autorelease pool page 0x7239000 corrupted
magic 0 3f473a55 3f20c2f1 0
pthread 0x43af3ce7
(gdb) bt
#0 0x026f28e5 in _objc_trap ()
#1 0x026f296e in _objc_fatal ()
#2 0x02706960 in objc_autoreleasePoolPush ()
#3 0x0248a95a in _CFAutoreleasePoolPush ()
#4 0x00b24e2b in NSPushAutoreleasePool ()
#5 0x00b99af4 in NSLogv ()
#6 0x00b99ad5 in NSLog ()
#7 0x00008323 in -[Cylinderoid generateMesh] (self=0x6ddd8a0, _cmd=0x6e836) at /Users/haldean/Code/ipad/Annotate23D/Annotate23D/Cylinderoid.mm:151
#8 0x0006cd85 in -[MeshGenerator rendererForObjects:] (self=0x6a9de30, _cmd=0x6e246, workspace=0x6dc1460) at /Users/haldean/Code/ipad/Annotate23D/Annotate23D/MeshGenerator.m:16
#9 0x00005367 in -[WorkspaceViewController renderButton:] (self=0x6db8a30, _cmd=0x6e4ac, sender=0x6dbd6a0) at /Users/haldean/Code/ipad/Annotate23D/Annotate23D/WorkspaceViewController.m:304
#10 0x02562ec9 in -[NSObject performSelector:withObject:withObject:] ()
#11 0x002365c2 in -[UIApplication sendAction:to:from:forEvent:] ()
#12 0x0023655a in -[UIApplication sendAction:toTarget:fromSender:forEvent:] ()
#13 0x002dbb76 in -[UIControl sendAction:to:forEvent:] ()
#14 0x002dc03f in -[UIControl(Internal) _sendActionsForEvents:withEvent:] ()
#15 0x002db2fe in -[UIControl touchesEnded:withEvent:] ()
#16 0x004f4a2a in _UIGestureRecognizerUpdate ()
#17 0x025359ce in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
#18 0x024cc670 in __CFRunLoopDoObservers ()
#19 0x024984f6 in __CFRunLoopRun ()
#20 0x02497db4 in CFRunLoopRunSpecific ()
#21 0x02497ccb in CFRunLoopRunInMode ()
#22 0x0244a879 in GSEventRunModal ()
#23 0x0244a93e in GSEventRun ()
#24 0x00233a9b in UIApplicationMain ()
#25 0x00002b88 in main (argc=1, argv=0xbffff590) at /Users/haldean/Code/ipad/Annotate23D/Annotate23D/main.m:16
(gdb) info malloc-history 0x7239000
Alloc: Block address: 0x07239000 length: 4096
Stack - pthread: 0xac6bb2c0 number of frames: 4
0: 0x960e76ee in malloc_zone_memalign
1: 0x270697d in objc_autoreleasePoolPush
2: 0x2b22 in main at /Users/haldean/Code/ipad/Annotate23D/Annotate23D/main.m:16
3: 0x2ae5 in start
Old question but in Swift you'll get this issue if you are logging an encoded URL which contains '%' - For example:
NSLog("My long Encoded URL: \(myLongUrlVar)")
Instead, it will work with params:
NSLog("My long Encoded URL: %#", myLongUrlVar)
In the comments I suggested:
The problem is not with NSLog. The problem is probably that some memory is getting smashed and that is causing the crash in NSLog. It would probably help if you could break down that method you're using to make it easier to read, perhaps even separating the functionality into a new object. Also, avoid the use of magic numbers (3 & 6).
It appears that #haldean went with this suggestion and tracked down the problem. I can't claim credit for actually doing the hard work of tracking down the problem, but I'm happy the suggestion helped.
there are % in string, replace % to %%
NSLog([message stringByReplacingOccurrencesOfString:#"%" withString:#"%%"]);
First thing I would try (after zombie hunting or perhaps before in this case) is to clear out the build directories and do a fresh rebuild. Sometimes left over cruft from prior builds can cause strange problems.

Strange behavior with inApp purchases

I've got a very strange problem recently. I have a code which processes inApp purchases in my app. I haven't changed anything in the code for month and this week I got a crash when calling the following method:
//
// call this before making a purchase
//
- (BOOL)canMakePurchases
{return [SKPaymentQueue canMakePayments];
}
I've tried to perform bt command in gdb and got following:
#0 0x33adffdc in CFRetain ()
#1 0x31f5bdb6 in ___init_block_invoke_2 ()
#2 0x36e797ea in _dispatch_barrier_sync_f_invoke ()
#3 0x36e7965a in dispatch_barrier_sync_f$VARIANT$up ()
#4 0x36e7928e in dispatch_sync_f$VARIANT$up ()
#5 0x36e79910 in dispatch_sync$VARIANT$up ()
#6 0x36e7b576 in dispatch_once_f$VARIANT$up ()
#7 0x31f5c706 in CPLoggingAddCustomLogFile ()
#8 0x320a2658 in __MCLoggingInitialize_block_invoke_1 ()
#9 0x36e7b576 in dispatch_once_f$VARIANT$up ()
#10 0x320a26a4 in MCLoggingInitialize ()
#11 0x320a3060 in -[MCProfileConnection _init] ()
#12 0x320a3764 in +[MCProfileConnection sharedConnection] ()
#13 0x31750764 in +[SKPaymentQueue canMakePayments] ()
#14 0x00037702 in -[InAppPay canMakePurchases] (self=0x44b1a0, _cmd=0x149c1e) at /Users/lowfreq/Desktop/Projects/magazinereader/Archive/InAppPay.m:32
#15 0x00039444 in -[PreViewArchives Tap:] (self=0x46aba0, _cmd=0x149d03, sender=0x46f030) at /Users/lowfreq/Desktop/Projects/magazinereader/Archive/PreViewArchives.m:161
#16 0x33af1434 in -[NSObject performSelector:withObject:withObject:] ()
#17 0x34c1f9ea in -[UIApplication sendAction:to:from:forEvent:] ()
#18 0x34c1f9a6 in -[UIApplication sendAction:toTarget:fromSender:forEvent:] ()
#19 0x34c1f984 in -[UIControl sendAction:to:forEvent:] ()
#20 0x34c1f6f4 in -[UIControl(Internal) _sendActionsForEvents:withEvent:] ()
#21 0x34c2002c in -[UIControl touchesEnded:withEvent:] ()
#22 0x34c1e50e in -[UIWindow _sendTouchesForEvent:] ()
#23 0x34c1df00 in -[UIWindow sendEvent:] ()
#24 0x34c044ec in -[UIApplication sendEvent:] ()
#25 0x34c03d2c in _UIApplicationHandleEvent ()
#26 0x3572edf2 in PurpleEventCallback ()
#27 0x33b6b552 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#28 0x33b6b4f4 in __CFRunLoopDoSource1 ()
#29 0x33b6a342 in __CFRunLoopRun ()
#30 0x33aed4dc in CFRunLoopRunSpecific ()
#31 0x33aed3a4 in CFRunLoopRunInMode ()
#32 0x3572dfcc in GSEventRunModal ()
#33 0x34c32742 in UIApplicationMain ()
#34 0x00002364 in main (argc=1, argv=0x2fdffb38) at /Users/lowfreq/Desktop/Projects/magazinereader/main.m:14
Current language: auto; currently objective-c
What's going on? I can't understand the reason why the code which worked for month without any problem now giving me a crash?
I've tried to rebuild provisioning profiles from scratch, reset my iPad but still no luck
Thanks in advance for any clues!
since you are trying for SKPaymentQueue canMakePayments try both in device and simulator.. if it crashes in both.. then it got to be code error..then post the code.

XCode Instruments not detecting Zombie with BAD_ACCESS

Usually, when I try to fix a BAD_ACCESS error I open the Xcode Instruments and test to find the zombies that are causing the error.
I'm running my app with iPhone 5.0 simulator. It stops with BAD_ACCESS, but Instruments doesn't flags any zombie.
The behavior is totally different when I run the app with iPhone 4.3 simulator. In this case, the application runs very well without any BAD_ACCESS.
I'm using XCode 4.2.
What could be happening?
Here's the backtrace:
(gdb) bt
#0 0x0167209b in objc_msgSend ()
#1 0x00002ff2 in -[BSViewController viewDidAppear:] (self=0x1, _cmd=0x12ddd81, animated=1 '\001') at BSViewController.m:42
#2 0x012616f8 in __CFStringAppendFormatCore ()
#3 0x011acb6c in _CFStringCreateWithFormatAndArgumentsAux ()
#4 0x0122bce8 in _CFLogvEx ()
#5 0x00b26b63 in NSLogv ()
#6 0x00b26ad5 in NSLog ()
#7 0x00009ffc in -[BSCTView buildFrames] (self=0x6a55f80, _cmd=0xd541) at BSCTView.m:96
#8 0x0000a5da in -[BSCTView layoutSubviews] (self=0x6a55f80, _cmd=0x66a6c4) at BSCTView.m:124
#9 0x001ff301 in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] ()
#10 0x01284e72 in -[NSObject performSelector:withObject:] ()
#11 0x0283592d in -[CALayer layoutSublayers] ()
#12 0x0283f827 in CA::Layer::layout_if_needed ()
#13 0x027c5fa7 in CA::Context::commit_transaction ()
#14 0x027c7ea6 in CA::Transaction::commit ()
#15 0x0285330c in +[CATransaction flush] ()
#16 0x001bf4c6 in -[UIApplication _reportAppLaunchFinished] ()
#17 0x001bfbd6 in -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] ()
#18 0x001ce743 in -[UIApplication handleEvent:withNewEvent:] ()
#19 0x001cf1f8 in -[UIApplication sendEvent:] ()
#20 0x001c2aa9 in _UIApplicationHandleEvent ()
#21 0x01748fa9 in PurpleEventCallback ()
#22 0x012571c5 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#23 0x011bc022 in __CFRunLoopDoSource1 ()
#24 0x011ba90a in __CFRunLoopRun ()
#25 0x011b9db4 in CFRunLoopRunSpecific ()
#26 0x011b9ccb in CFRunLoopRunInMode ()
#27 0x001bf2a7 in -[UIApplication _run] ()
#28 0x001c0a9b in UIApplicationMain ()
#29 0x000027a0 in main (argc=1, argv=0xbffff578) at main.m:16
As said above by #AdamRosenfield, on question comments, EXC_BAD_ACCESS can be caused by many other things that aren't zombies.
In this specific case, the problem was an NSLog() with a format string that expected an object #"%#" and was receiving an int as a parameter, as the example bellow.
int variable = 1;
NSLog(#"%#", variable);
This was causing the EXC_BAD_ACCESS.
After reading the backtrace, I saw that line #6 and searched all NSLog() calls on code to finally found the one with error.

ASIHTTPRequest crash in ASIInputStream forwardInvocation:

Does somebody else has randomly seen crashes in ASIInputStream forwardInvocation: during the use of ASIFormDataRequest? (the request was startAsynchronous)
Here is the backtrace:
#0 0x95877b83 in CFRunLoopSourceSignal ()
#1 0x958daa45 in _CFStreamScheduleWithRunLoop ()
#2 0x9588d05d in __invoking___ ()
#3 0x9588cfc8 in -[NSInvocation invoke] ()
#4 0x958c8f28 in -[NSInvocation invokeWithTarget:] ()
#5 0x0001d7ee in -[ASIInputStream forwardInvocation:] (self=0x228d40, _cmd=0x972d80c0, anInvocation=0x225a70) at /Users/catlan/Projekte/TBU/ASIInputStream.m:75
#6 0x9588de54 in ___forwarding___ ()
#7 0x9588d982 in __forwarding_prep_0___ ()
#8 0x958da8f8 in CFReadStreamScheduleWithRunLoop ()
#9 0x958daa26 in _CFStreamScheduleWithRunLoop ()
#10 0x958daa26 in _CFStreamScheduleWithRunLoop ()
#11 0x00015d4d in -[ASIHTTPRequest scheduleReadStream] (self=0x2318e0, _cmd=0x23490) at /Users/catlan/Projekte/TBU/ASIHTTPRequest.m:2608
#12 0x0000de97 in -[ASIHTTPRequest startRequest] (self=0x2318e0, _cmd=0x23827) at /Users/catlan/Projekte/TBU/ASIHTTPRequest.m:1005
#13 0x0000b56c in -[ASIHTTPRequest main] (self=0x2318e0, _cmd=0x973cfd56) at /Users/catlan/Projekte/TBU/ASIHTTPRequest.m:624
#14 0x0000b0a8 in -[ASIHTTPRequest startAsynchronous] (self=0x2318e0, _cmd=0x2136e) at /Users/catlan/Projekte/TBU/ASIHTTPRequest.m:546
#15 0x00004b0f in -[TBUploadWindowController requestUserInfo] (self=0x2f09e10, _cmd=0x205ed) at /Users/catlan/Projekte/TBU/TBUploadWindowController.m:119
#16 0x92591ad9 in __NSFireDelayedPerform ()
#17 0x95851edb in __CFRunLoopRun ()
#18 0x9584f864 in CFRunLoopRunSpecific ()
#19 0x9584f691 in CFRunLoopRunInMode ()
#20 0x908fdf6c in RunCurrentEventLoopInMode ()
#21 0x908fdd23 in ReceiveNextEventCommon ()
#22 0x908fdba8 in BlockUntilNextEventMatchingListInMode ()
#23 0x96b4eac5 in _DPSNextEvent ()
#24 0x96b4e306 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#25 0x96b1049f in -[NSApplication run] ()
#26 0x96b08535 in NSApplicationMain ()
#27 0x00002c8c in main (argc=1, argv=0xbffff858) at /Users/catlan/Projekte/TBU/main.m:13
Any idea on how to debug this?
This sounds like a bug in ASIHTTPRequest I fixed earlier today, so grab a new copy and hopefully that will resolve the problem.
My apologies to everyone who got caught by this. Clearly, I need more tests! ;)
I can confirm that rel. 1.6 fixes this problem. I had it also (strangely, it was working perfectly in the simulator but crashing on the device) and this new version fixes it.
Thanks to the developers for the fix (other than the whole package!) and to catlan for reporting the problem.

Application hanging in __semwait_signal ()

I have a user of my application that sometimes when they run the application it gets stuck at the following point ...
0x92542782 in __semwait_signal ()
(gdb) where
#0 0x92542782 in __semwait_signal ()
#1 0x9254243e in _pthread_cond_wait ()
#2 0x925440d8 in pthread_cond_wait$UNIX2003 ()
#3 0x95232670 in fe_fragment_render_quad ()
#4 0x9522f07f in fe_sw_quad ()
#5 0x9522edf9 in fe_context_quad ()
#6 0x95227915 in fe_tree_render_apply_1 ()
#7 0x9522244f in fe_tree_render_apply ()
#8 0x95220c9b in fe_tree_render_ ()
#9 0x9522443c in fe_tree_render_texture ()
#10 0x95224295 in texture_retain ()
#11 0x95223d5d in fe_texture_new ()
#12 0x95222a62 in fe_tree_create_texture ()
#13 0x95222159 in fe_tree_render_apply ()
#14 0x95220c9b in fe_tree_render_ ()
#15 0x9522443c in fe_tree_render_texture ()
#16 0x95224295 in texture_retain ()
#17 0x95223d5d in fe_texture_new ()
#18 0x95222a62 in fe_tree_create_texture ()
#19 0x95222159 in fe_tree_render_apply ()
#20 0x95220c9b in fe_tree_render_ ()
#21 0x9522443c in fe_tree_render_texture ()
#22 0x95224295 in texture_retain ()
#23 0x95223d5d in fe_texture_new ()
#24 0x95222a62 in fe_tree_create_texture ()
#25 0x95222159 in fe_tree_render_apply ()
#26 0x95220c9b in fe_tree_render_ ()
#27 0x95220bef in fe_tree_render_ ()
#28 0x9522443c in fe_tree_render_texture ()
#29 0x95224295 in texture_retain ()
#30 0x95223d5d in fe_texture_new ()
#31 0x95222a62 in fe_tree_create_texture ()
#32 0x95222159 in fe_tree_render_apply ()
#33 0x95220c9b in fe_tree_render_ ()
#34 0x952201e2 in fe_tree_render_tree ()
#35 0x9520e72a in fe_tree_render_image ()
#36 0x9520dfea in fe_image_render_ ()
#37 0x9520dae7 in fe_image_get_bitmap ()
#38 0x9520d8b7 in -[CIContextImpl render:toBitmap:rowBytes:bounds:format:colorSpace:] ()
#39 0x918f29e8 in cgxcoreimage_instance_render ()
#40 0x918f2ae8 in cgxcoreimage_provider_create_data ()
#41 0x9841d601 in faultDataAcquireBytePointer ()
#42 0x9837f20f in CGAccessSessionGetBytePointer ()
#43 0x983db0e0 in img_decode_read ()
#44 0x983daf47 in img_colormatch_read ()
#45 0x983dad7c in img_alphamerge_read ()
#46 0x983b8ee9 in img_data_lock ()
#47 0x983b5ee6 in CGSImageDataLock ()
#48 0x92b16748 in ripc_AcquireImage ()
#49 0x92b143be in ripc_DrawImage ()
#50 0x983b5b60 in CGContextDrawImage ()
#51 0x990ed9c6 in CUIPenCG::DrawImage ()
#52 0x990f9e85 in CUIRenderer::DrawImage ()
#53 0x990eaa94 in CUIRenderer::Draw ()
#54 0x90d6059c in -[NSCoreUIImageRep draw] ()
#55 0x90d60481 in -[NSImageRep drawInRect:] ()
#56 0x90d602fd in __-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_2 ()
#57 0x90d6025b in NSGraphicsContextPushContextWithFlippedMetadata_drawWithBlock_ ()
#58 0x90cb4673 in __-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_1 ()
#59 0x90cb3b39 in -[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:] ()
#60 0x90caed89 in -[NSImage _drawMappingAlignmentRectToRect:withState:backgroundStyle:operation:fraction:flip:hints:] ()
#61 0x90d5f42e in -[NSButtonCell drawImage:withFrame:inView:] ()
#62 0x90d5e941 in -[NSButtonCell _configureAndDrawImageWithRect:cellFrame:controlView:] ()
#63 0x90d5cba8 in -[NSButtonCell drawInteriorWithFrame:inView:] ()
#64 0x90d5c1bd in -[NSButtonCell drawWithFrame:inView:] ()
#65 0x90d5489e in -[NSControl drawRect:] ()
#66 0x90d4cce1 in -[NSView _drawRect:clip:] ()
#67 0x90d4b97f in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#68 0x90d4bcb4 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#69 0x90d4bcb4 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#70 0x90d730c2 in -[NSToolbarItemViewer _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#71 0x90d4bcb4 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#72 0x90d4bcb4 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#73 0x90d4bcb4 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#74 0x90d49e9e in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] ()
#75 0x90d49a13 in -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] ()
#76 0x90d46359 in -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] ()
#77 0x90ca6f26 in -[NSView displayIfNeeded] ()
#78 0x90c70292 in -[NSWindow displayIfNeeded] ()
#79 0x90c6ed30 in -[NSWindow _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] ()
#80 0x90c6e892 in -[NSWindow orderWindow:relativeTo:] ()
#81 0x90c6c054 in -[NSWindow makeKeyAndOrderFront:] ()
#82 0x000151a2 in -[AppController applicationFinishedLaunching:] ()
#83 0x9208f253 in _nsnote_callback ()
#84 0x98facc29 in __CFXNotificationPost ()
#85 0x98fac65a in _CFXNotificationPostNotification ()
#86 0x92084120 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#87 0x920914fd in -[NSNotificationCenter postNotificationName:object:] ()
#88 0x90ca78f2 in -[NSApplication _postDidFinishNotification] ()
#89 0x90ca7802 in -[NSApplication _sendFinishLaunchingNotification] ()
#90 0x90dfe565 in -[NSApplication(NSAppleEventHandling) _handleAEOpen:] ()
#91 0x90dfe185 in -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] ()
#92 0x920c446c in -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] ()
#93 0x920c4230 in _NSAppleEventManagerGenericHandler ()
#94 0x929c0de6 in aeDispatchAppleEvent ()
#95 0x929c0ce5 in dispatchEventAndSendReply ()
#96 0x929c0bf2 in aeProcessAppleEvent ()
#97 0x97cae381 in AEProcessAppleEvent ()
#98 0x90c77ed2 in _DPSNextEvent ()
#99 0x90c7750a in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#100 0x90c3969b in -[NSApplication run] ()
#101 0x90c31735 in NSApplicationMain ()
#102 0x0000262e in start ()
(gdb)
When you debug a bit more and print the NSImage instance it is trying to draw ...
(gdb) frame 60
(gdb) po *(int*)($ebp+8)
<NSImage 0x1261f10 Name=ForwardTemplate Size={20, 20} Reps=(
NSPDFImageRep 0x18abc30 Size={20, 20} ColorSpace=NSCalibratedRGBColorSpace BPS=0 Pixels=20x20 Alpha=NO
)>
This is one of the template images for the "forward transport" custom button in the application's toolbar. (see http://www.cancelmonday.com/beatler for a screen shot)
I am just looking for ideas on what I can do to try and debug this further as the hard thing is that it is only this one user that is reporting this issue and I cannot reproduce it locally.
Any help would be greatly appreciated.
Update
Thanks to diciu I ran ...
thread apply all bt
This did show up a problem with a load of threads sat waiting and an example stack for a thread is ...
Thread 365 (process 1866):
#0 0x92542782 in __semwait_signal ()
#1 0x9254243e in _pthread_cond_wait ()
#2 0x925440d8 in pthread_cond_wait$UNIX2003 ()
#3 0x920b7b5e in -[NSCondition wait] ()
#4 0x920a5531 in -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] ()
#5 0x920b7cb7 in -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] ()
#6 0x000183e8 in -[BLImageLoader main] ()
#7 0x920b73b3 in -[__NSOperationInternal start] ()
#8 0x920b6fe0 in ____startOperations_block_invoke_2 ()
#9 0x925487b8 in _dispatch_call_block_and_release ()
#10 0x9253a97e in _dispatch_worker_thread2 ()
#11 0x9253a401 in _pthread_wqthread ()
#12 0x9253a246 in start_wqthread ()
These threads do update the UI but it is always done through ...
[item performSelectorOnMainThread:#selector(setDisplayImage:) withObject:image waitUntilDone:YES];
I thought this would be safe, are there any issues with lots of threads e.g. 400+ all wanting to ...
performSelectorOnMainThread
...within the same time period?
Your main thread is blocked waiting for a condition to happen (pthread_cond_wait$UNIX2003).
Are you updating the UI from a non-main thread?
In gdb
thread apply all bt
will show you the state of all your application's threads - it may be that your main thread is blocked by some other thread doing UI stuff.