如何用lldb动态调试 一个服务(xpc server)

如题!

我直接用debugserver *:2234 -a “STServer”,会报下面错误:
Attaching to process STServer…
Segmentation fault: 11

然后我用
debugserver -x backboard *:1234 /Applications/STGame.app/STServer
它会先启动app,然后启动app的服务。
接着我用lldb连接,它是连接到STGame了,而不是STServer.

所以我没法调试STServer,没法打断点。。。。

大神们,有什么办法可以解决吗?谢谢了!!!

App的进程名是什么?

app 的进程名是 “STGame”

你运行debugserver -x backboard *:1234 /Applications/STGame.app/STServer,结果起来的进程是STGame

嗯,它先是起来STGame.

lldb 也是接连到STGame.然后我在lldb中执行以c命令

STGame的某个类的init方法就会用system(’/Applications/STGame.app/STServer’)来启动这个服务。

最后STGame起来了,STServer也起来了。

我就不知道要怎么来断点STServer 的main方法了。。。

你把Info.plist里的可执行文件改一下,改成STServer,再调试看看

谢谢狗神提供的思路。

现在解决了,我把这个服务copy到/usr/bin下面,这样它就不会启动app了。。。

1 个赞