gdb-iOS调试
来源:互联网 发布:macd背离源码 编辑:程序博客网 时间:2024/06/05 09:19
1.最常用的肯定是NSLog了,可以查看各种变量在各个状态的值,而且对于程序流程的整理也很有帮助
2.单步调试,一般鼠标悬浮在变量上就可以快速查看变量的状态,俺一般看这个变量的地址,就是0x开头的,主要是看它是否为nil,nil的地址是0x0,字符串可以看具体值,而字典和数组却只显示count,即有多少个元素或键值对,如果要查看整个数组或字典的话,此时是不行的(呵呵,方法在后面)
俺主要想说的其实是后面这几点,呵呵
3.debuger在单步调试的时候会出现,三部分,俺初学的时候只用下面的单步调试,直观快捷
3-1.后来发现:有个比较快捷的方法查看数组和字典,右上角的窗口里,有Arguments和locals(俺常用),在Arguments的self或loacls里有你想查看的数组的话,选中它,右键菜单上有printdescription toconsole,可以很方便的在console里查看数组和字典的值,当然像文件夹路径这种长字符串更不在话下了
3-2.左上角的窗口以前看上去好复杂,虽然现在看还是复杂,但俺看出了点门道,特别是在interrupt的时候,报错状态下,左上角的第一行显示????,其实左上角是倒序显示的,就是说最后执行的语句是在第一句,而已经执行的是显示在下面,有的时候,???下面有一些是显示"方法的调用",即[objectmessage],这很关键,可以找到距离报错的地点最近的地方,经过俺的实践,常常就是在那解决bug的
4.也是在报错状态,console一般会显示错误信息,常见的unregniseselector这些看多了也就熟悉了,有的时候会显示Call stack atfirstthrow这种也是倒着看,先执行的在下面显示,定位到离错误最近的地方解决bug,如:
- 2010-10-16
20:14:13.633 Universiade 2011[5293:207]*** 'NSUnknownKeyException',Terminating app due to uncaught exception reason: '[<MoreSecondViewController_ser 0x6d49bf0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key mytableView.' - ***
Call stack at first throw: - (
-
0 CoreFoundation __exceptionPreprocess 185+ -
1 libobjc.A.dylib objc_exception_throw 47+ -
2 CoreFoundation -[NSException 17raise] + -
3 Foundation _NSSetUsingKeyValueSetter 135+ -
4 Foundation -[NSObject(NSKeyValueCoding) 285setValue:forKey:] + -
5 UIKit -[UIRuntimeOutletConnectio 112n connect] + -
6 CoreFoundation -[NSArray 239makeObjectsPerformSelect or:] + -
7 UIKit -[UINib 1041instantiateWithOwner:options:] + -
8 UIKit -[NSBundle(UINSBundleAdditions) 168loadNibNamed:owner:options:] + -
9 UIKit -[UIViewController 70_loadViewFromNibNamed:bundle:] + -
10 UIKit -[UIViewController 120loadView] + -
11 UIKit -[UIViewController 56view] + -
12 UIKit -[UIViewController 42contentScrollView] + -
13 UIKit -[UINavigationController 48_computeAndApplyScrollCon tentInsetDeltaForViewCon troller:] + -
14 UIKit -[UINavigationController 43_layoutViewController:] + -
15 UIKit -[UINavigationController 326_startTransition:fromViewController:toViewController:] + -
16 UIKit -[UINavigationController 266_startDeferredTransitionI fNeeded] + -
17 UIKit -[UINavigationController 876pushViewController:transition:forceImmediate:] + -
18 UIKit -[UINavigationController 62pushViewController:animated:] + -
19 Universiade -[MoreTableView 1050tableView:didSelectRowAtIndexPath:] + -
20 UIKit -[UITableView 1140_selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + -
21 UIKit -[UITableView 219_userSelectRowAtIndexPath :] + -
22 Foundation __NSFireDelayedPerform 441+ -
23 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ 19+ -
24 CoreFoundation __CFRunLoopDoTimer 1364+ -
25 CoreFoundation __CFRunLoopRun 1817+ -
26 CoreFoundation CFRunLoopRunSpecific 208+ -
27 CoreFoundation CFRunLoopRunInMode 97+ -
28 GraphicsServices GSEventRunModal 217+ -
29 GraphicsServices GSEventRun 115+ -
30 UIKit UIApplicationMain 1160+ -
31 Universiade main 102+ -
32 Universiade start 53+ - )
- terminate
called after throwing an instance of 'NSException' - Program
received signal: “SIGABRT”.
5.比较恼火的BAD_ACCESS,网上有个做法是设置ZomebieEnabled,确实不错,有的时候确不显示(不知道是不是人品问题..)
不显示的时候用俺刚才说的debuger左上角的定位至离错误最近的地方那个方法,一般都OK了
- gdb-iOS调试
- gdb调试ios
- iOS - GDB & Breakpoint 调试:
- iOS开发 GDB调试
- IOS之GDB调试命令
- GDB调试
- gdb 调试
- gdb调试
- gdb 调试
- GDB调试
- GDB调试
- GDB调试
- GDB调试
- GDB调试
- GDB调试
- gdb 调试
- GDB 调试
- gdb 调试
- :TableView UI
- 多线程编程
- 售票 多线程
- iPhone category
- iOS视频学习
- gdb-iOS调试
- Three20添加方法
- 新浪微博iOS版SDK“宝玉XP”框…
- 新浪微博iOS版SDK“宝玉XP”框…
- 第十六章: 本地化
- [iPhone]XML文件解析 parsing-xml-…
- 320+xcode4
- 怎么将three20 加入Xcode4 中
- 在Xcode4.2 下编译发布与提交App到…