iOS 调试问题小结

1. XCode 提示 ”set a breakpoint in malloc_error_break to debug “时,如何设置 malloc_error_debug?
solution:
Step 1: Set a breakpoint on malloc_error_break() by opening the Breakpoint Navigator (View->Navigators->Show Breakpoint Navigator or ⌘7), clicking the plus button in the lower left corner, and selecting "Add Symbolic Breakpoint". In the popup that comes up, enter malloc_error_break (without quotes of course) in the Symbol field, then click Done.
Step 2: specify any module: try setting "libsystem_c.dylib"

2. 用 XCode 调试程序时,遇到 exc_bad_access 时,需要用 malloc_history pid memory_address 来查看内存分配情况,那么如何知道该 app 的 pid 呢?
solution: 打开 activity monitor, 在 memory 选项卡中找到该 app 的名称,该条对呀的PID就是我们需要的进程号啦。

3. lldb 中有一个命令 po,全程是 print object

4. 发生异常时,使用 po $eax 查看异常信息
explaination: $eax 是 CPU 的寄存器之一。在异常情况下,该寄存器会包含一个指针的 NSException 对象。$eax 只用于模拟器,如果在真机上调试,你需要使用寄存器 $R0
与之相关的命令还有:po [$eax name], po [$eax reason]等

5. Background audio is not supported in iPhone simulator.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值