如何在 xcode 中跟踪程序执行? [英] how to trace program execution in xcode?

查看:54
本文介绍了如何在 xcode 中跟踪程序执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用 xcode 跟踪程序执行我想知道在方法中添加断点时现在调用的是哪个方法

I want to know how i can trace program execution using xcode I want to know which method being called right now as when you add break point in method

有没有办法在不添加断点的情况下做类似的事情??

Is there any way to do such alike thing without adding breakpoints??

推荐答案

有几个与调试器相关的 WWDC 2012 视频,其中之一向您展示了如何添加在运行调试器命令后自动继续的断点.这比添加日志更可取,因为无需继续执行写入-编译-调试循环.

There are a couple of Debugger-related WWDC 2012 videos, one of which shows you how to add a breakpoint that continues automatically after running a debugger command. This is preferred to adding logging as there is no need to keep doing the write-compile-debug loop.

您可以向调用的断点添加操作:

You can add an action to the breakpoint that calls:

expr (void)NSLog(@"self=%p Method1", self);

话虽如此,我仍然使用日志调用,但我使用了自己的日志框架,该框架会自动打印类和方法的名称(使用编译器生成的 __FUNCTION__ 字符串).

Having said that I still use log calls, but I use my own logging framework which prints the name of the class and method automatically (using __FUNCTION__ string generated by the compiler).

这篇关于如何在 xcode 中跟踪程序执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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