以编程方式启用符号断点吗

以编程方式启用符号断点吗

本文介绍了XCode:以编程方式启用符号断点吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法以编程方式启用断点?通常我会使用断点条件,但是我需要使用符号断点.

Is there a way to programmatically enable a breakpoint? Normally I'd use a breakpoint condition, but I need to use a symbolic breakpoint.

具体来说,是在对scrollToIndexPath的调用与对reloadData的调用之间更改了UIScrollView的contentOffset.我只想在调用scrollToIndexPath之后启用符号断点.

Specifically, something is changing the contentOffset of my UIScrollView between a call to scrollToIndexPath and a call to reloadData. I'd like to enable the symbolic breakpoint only after the call to scrollToIndexPath.

推荐答案

Jim Ingham的答案适用于x86系统.对于iOS设备,我可以使用此答案中所述的方法以编程方式创建断点.插入行

Jim Ingham's answer works on a x86 system. For an iOS device I was able to use the method described in this answer to programmatically create a breakpoint. Inserting the line

asm("svc 0");

使调试器在XCode中停止以下指令.

Causes the debugger to stop on the following instruction in XCode.

有趣的是,如果您没有连接到XCode,程序将继续正常执行.

Interestingly if you're not connected to XCode the program continues to execute normally.

这篇关于XCode:以编程方式启用符号断点吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 04:50