How to print self in debugger console on private method

2

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?

objective-c
xcode
lldb
asked on Stack Overflow Feb 24, 2014 by Saltymule

2 Answers

3

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).

answered on Stack Overflow Feb 25, 2014 by Leo Natan
0

Would

(lldb) frame select 2

(lldb) po self

work for you?

answered on Stack Overflow Feb 25, 2014 by Enrico Granata

User contributions licensed under CC BY-SA 3.0