使用特定队列调用dispatch_async时的符号断点 [英] Symbolic breakpoint for when dispatch_async is called with a specific queue

查看:98
本文介绍了使用特定队列调用dispatch_async时的符号断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调试项目中涉及中央集中调度的问题.在调试时,有一种在将工作分派到特定队列时得到通知的方式确实很有帮助.

I'm debugging an issue in my project involving grand central dispatch. In debugging this, it would be really helpful to have a way of being notified when work is dispatched to a specific queue.

是否有某种方法可以在dispatch_async上设置符号断点,并且可以检查调度队列参数是否与我可以访问的其他队列相同?

Is there some way of setting a symbolic breakpoint on dispatch_async with a condition that could check whether the dispatch queue argument is the same as some other queue that I have access to?

推荐答案

以下是设置条件断点的方法. (我尚未在队列上完成条件,我在这里假设指针相等将可以正常工作.)

Here's how to set a conditional breakpoint. (I haven't done conditions on queues, I'm making the assumption here that pointer equality will Just Work™.)

首先获取所需队列的地址,假设它是0x12345678.然后创建一个断点:

First get the address of the queue you want, let's say it's 0x12345678. Then create a breakpoint:

breakpoint set -n dispatch_async -c '$register == 0x12345678'

用特定于该体系结构的表达式替换$register.

Replace $register with an expression specific to the architecture.

已更新为从模拟器

  • x86:*(id*)($esp+4)
  • x86-64:$arg1(又名$rdi)
  • x86: *(id*)($esp+4)
  • x86-64: $arg1 (aka $rdi)

设备

  • armv7:$arg1(又名$r0)
  • arm64:$arg1(又名$x0)
  • armv7: $arg1 (aka $r0)
  • arm64: $arg1 (aka $x0)

这篇关于使用特定队列调用dispatch_async时的符号断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆