美文网首页iOS开发笔记
Xcode添加断点调试.

Xcode添加断点调试.

作者: 王四猫 | 来源:发表于2019-03-25 11:31 被阅读22次

当我们使用Xcode进行日常开发时,偶尔出现一些错误,Xcode反馈崩溃位置与错误信息并不与实际出现的问题的代码匹配.
这时我们可以通过以下操作,添加两个断点,保证程序在实际崩溃之前的那行代码停止,更直观的让我们发现问题的所在.

步骤如下:
  • 打开断点左标签,点击左下角的“+”按钮。
  • 选择 Exception Breakpoint.


    选择Exception Breackpoint
  • 系统会生成一个断点.保证断点信息如图所示.


    第一个断点
  • 再点击左下角的"+"按钮,选择 Symbolic Breakpoint.


    选择Symbolic Breakpoint
  • 在Symbol行输入malloc_error_break.保证断点信息如图所示.


    第二个断点
  • 设置结束,结果如图示.


    结果示例

设置完成,实现了我们需要的功能.可以更准确的进行debug了.


When those 2 breakpoints are enabled, xcode will automatically break on the faulting line instead of directly crashing without giving more informations.

To activate them, follow these steps :

  • open the breakpoint left tab, and click the "+" button in the bottom left corner.
  • select Add Exception Breakpoint.
  • Right click on the new breakpoint, and configure it this way :
    • Exception : All
    • Break : On throw
    • Action : Add Action
    • Options : leave the box unchecked.
  • Then add a symbolic break point ("+" button -> Add Symbolic Breakpoint)
  • Configure the breakpoint this way :
    • Symbol : malloc_error_break
    • don't modify all the other options
      You're done for starting debugging !

参考链接: Stackoverflow

相关文章

  • iOS断点调试

    1.断点调试App a.设置常规断点 添加断点:在xcode中代码编辑器中右边单击你想调试的代码处就可以添加断点,...

  • iOS调试 - 断点

    XCode 拥有强大的断点(Breakpoint)调试功能。 普通断点 在代码行旁边点击,就能添加一个断点,再次点...

  • Xcode添加断点调试.

    当我们使用Xcode进行日常开发时,偶尔出现一些错误,Xcode反馈崩溃位置与错误信息并不与实际出现的问题的代码匹...

  • iOS视频播放

    Xcode模拟器调试视频播放时,不能添加全局断点,不然程序会崩溃

  • CUICatalog: Invalid asset name s

    Xcode 图片名称为空警告 添加一个断点调试 Symbolic: +[UIImage imageNamed:]...

  • Xcode编程 详细断点补充

    只会左键断点?是时候试试这样那样断点了 编码不能没调试,调试不能没断点(Break Point)。XCode的断点...

  • iOS 动态真机调试原理

    前言 说起动态调试,大家普遍第一反应是通过Xcode 安装应用到真机,然后通过添加断点,添加打印等方式来动态的调试...

  • 如何去掉bmessage添加的断点

    使用Chisel进行调试的时候回用到bmessage去添加一些特殊断点,这种断点在Xcode中的端点导航中是去不掉...

  • iOS 常用调试方法:断点

    级别: ★☆☆☆☆标签:「Xcode断点调试」「iOS breakpoint」「iOS全局断点」作者: Xs·H...

  • ios 经典面试案例 (三)

    1、xcode在 release 模式下断点调试, 对象在打印的时候有值,断点调试却没值, 这是怎么回事? 答: ...

网友评论

    本文标题:Xcode添加断点调试.

    本文链接:https://www.haomeiwen.com/subject/hohvvqtx.html