如何在LLDB中附加到子进程 [英] How to attach to child process in LLDB

查看:537
本文介绍了如何在LLDB中附加到子进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的进程启动了子进程,我也想在OS X上使用LLDB对其进行调试.我在调试器中找不到自动附加的任何选项.怎么做?

My process starts child processes and I want to debug these as well, using LLDB on OS X. I can't find any option in the debugger to auto-attach. How to do it?

推荐答案

Google确实对此问题保持沉默,但我找到了解决方法.

Google is really silent on this issue, but I found a workaround.

运行主进程并停止它,然后再剥离所有子进程.然后在函数fork上放置一个断点:

Run your main process and stop it before it spins off any children. Then put a breakpoint on the function fork:

b fork

,然后让程序继续.当它将要启动子进程时,将命中断点.此时,运行另一个LLDB实例,让它等待并自动附加到您的进程:

and let the program continue. When it is about to launch a child process, the breakpoint will be hit. At this moment, run another instance of LLDB and let it wait and autoattach to your process:

attach -w -n yourapp

现在让父程序继续.

这篇关于如何在LLDB中附加到子进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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