摘要: 有时候我们的程序不知道跑到哪个地方就 crash 了,而 crash 又很难重现。保守的做法是在系统抛出异常之前设置断点,具体来说是在 objc_exception_throw处设置断点。设置步骤为:首先在 XCode 按 CMD + 6,进入断点管理窗口;然后点击右下方的 +,增加新的 Symbolic Breakpoint,在 Symbol 一栏输入:objc_exception_throw,然后点击 done,完成。 这样在 Debug 模式下,如果程序即将抛出异常,就能在抛出异常处中断了。比如在前面的代码中,我让 [firstObjctcrashTest]; 抛出异常。在 objc_e 阅读全文
posted @ 2012-05-15 16:04 RYan~~ 阅读(576) 评论(0) 推荐(0) 编辑
摘要: 当你忘记某条gdb命令的语法时,可以使用 help 命令名 来获取帮助信息。如:help show 显示 show 命令的用法。(gdb) help showGeneric command for showing things about the debugger.List of show subcommands:show annotate -- Show annotation_levelshow architecture -- Show architecture of targetshow args -- Show argument list to give program being de 阅读全文
posted @ 2012-05-15 16:03 RYan~~ 阅读(292) 评论(0) 推荐(0) 编辑
摘要: 有点类似于格式化输出,可以输出对象的不同信息。(gdb) print (int)[str retainCount] $1 = 2 阅读全文
posted @ 2012-05-15 15:57 RYan~~ 阅读(283) 评论(0) 推荐(0) 编辑
摘要: po 为 print object 的缩写,显示对象的文本描述(显示从对象的 description 消息获得的字符串信息)。(gdb)po dic{ fruit=Apple; car=BMW; pc=IBM;} 阅读全文
posted @ 2012-05-15 15:55 RYan~~ 阅读(733) 评论(0) 推荐(0) 编辑