如何在私有方法的调试器控制台中打印self

时间:2014-02-24 18:11:15

标签: objective-c xcode lldb

这是我的异常堆栈跟踪。

#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

当我捕获这个时,我暂停了调试器。如何在#2帧上打印self的值?

2 个答案:

答案 0 :(得分:3)

您无法通过在没有源代码的堆栈帧上键入po self来打印自己。

您需要做的是打印正确的注册表。

在此处查看更多信息: http://www.clarkcox.com/blog/2009/02/04/inspecting-obj-c-parameters-in-gdb/

确保选择正在调试的正确架构(即,如果您的二进制文件是32位,64位,arm,模拟器等)。

答案 1 :(得分:0)

(lldb) frame select 2

(lldb) po self

为你工作?