How to tell Xcode to attach debugger to a process as soon as the process will start?
Asked Answered
L

1

16

I'm working on something that happens just when my app restarts, and I'm trying to get logs for that. So I build my app, kill it, and restart it.

Killing the app makes Xcode disconnect from the running process.

After I restart the app, I can select Debug > Attach to Process to attach Xcode to the new process, but I'll miss everything that happens between the app start and when I manually attach to the process.

Is there a way to tell Xcode there no process running currently, but as soon as process X starts, attach the debugger to it?

Liatris answered 3/9, 2016 at 17:46 Comment(0)
N
4

Use the Attach to process by PID or Name feature.

It's under the Debug -> Attach to process by PID or Name menu in Xcode, then simply type in the process name that you normally attach to, and select Attach.

Once your app with said PID or name starts up, the debugger will attach to it immediately.

Make sure to set breakpoints for as early as late as you want to catch the launch.

Neusatz answered 7/12, 2017 at 8:44 Comment(1)
This answer describes a manual process, the question seems to be looking for an automatic wayStormy

© 2022 - 2024 — McMap. All rights reserved.