Xcode/GDB——继续调试器中指定的方法调用?

发布于 2024-12-01 08:38:57 字数 177 浏览 0 评论 0原文

这可能吗?

基本上,我想做的是,当我停在断点处时,我想让它调用 [someObject someMethod],然后继续。重要的是方法调用作为继续的一部分发生,而不是与之分开,因为如果它作为方法调用的一部分遇到另一个断点,我希望它以正常方式在该断点处停止。

即使它仅限于类方法或 C 函数,这也会有很大帮助。

Is this possible?

Basically, what I want to do is, when I am stopped at a breakpoint, I want to have it call [someObject someMethod], then continue. It is important that the method call happen as a part of the continue, rather than separately from it, because if it should hit another breakpoint as a part of the method call, I want it to stop at that breakpoint in the normal way.

Even if it were restricted to class methods, or C functions, this would be a big help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

是的,这是可能的,但不幸的是这并不简单。

基本上,您想要做的就是在程序中的任意点更改正在运行的进程的执行上下文(更改为您选择的函数)。

理论上,您可以通过发出 GDB 命令并在正在调试的进程中调用函数来创建新的执行上下文,但这可能会比您最初预期的工作量更多。

我认为如果您真的想要此功能,最好的选择是使用某种仪器库,例如 ValgrindPin。这些库基本上负责在进程执行中的任意点创建新执行上下文的所有细节,并且它们提供了一个合理的接口来对正在运行的进程进行操作。

Yes, this is possible, but unfortunately it is not straightforward.

Basically, what you are wanting to do is change the execution context (to the function of your choice) of the running process at an arbitrary point in the program.

You could theoretically create a new execution context by issuing GDB commands and calling functions in the process being debugged, but it will probably be more work than you originally intended it to be.

I think your best bet if you really want this functionality is to use some sort of instrumentation library such as Valgrind or Pin. These libraries basically take care of all the nitty-gritty details of creating a new execution context at an arbitrary point in a process' execution, and they present a reasonable interface to operating on a running process.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文