1

I'm pretty new to Objective-C development, or indeed XCode & Mac development in general so apologies if this is a quite simple question, but I've been given a legacy product to maintain that is built in a slightly uncommon way.

Essentially the solution is split into 3 projects, one being the Primary, and the other two being Secondary. The primary project starts a process, which, in turn, starts two other processes (both of the Secondary projects).

I am trying to debug one of the Secondary projects, but I cannot properly debug it (Stepping through breakpoints etc.) as the Secondary process requires the Primary process to start it up, otherwise it automatically shuts down. I have attempted to use Xcode's 'Attach to Process via PID or Name' function, and it is partially successful, though offers limited debugging functionality (no breakpointing, limited variable inspection, etc.) which isn't quite as useful as I'd hope.

Is there a way to either debug the Secondary process with full debug functionality somehow, or a way to be able to debug one of the Secondary processes from the xcode instance debugging & running the Primary process? Or am I screwed here.

tl;dr - Full xcode debugging abilities on a process that requires another app to start (starting it by itself causes it to instantly close, it requires interaction with the primary app to function properly) - is it possible? Or is there a workaround I'm missing?

kgyts
  • 203
  • 1
  • 2
  • 8
  • Simplest way would be to just comment out the code that is causing the app to close if the other app has not opened it. You can check if the build is in release mode or debug and have it automatically enable or disable the code that closes your app. Check here for how to do that: https://stackoverflow.com/questions/9063100/xcode-ios-how-to-determine-whether-code-is-running-in-debug-release-build – Nordeast Jan 11 '18 at 16:30
  • I have considered/attempted that but as said at the bottom of my original post, unfortunately it requires interaction with the primary app to function properly. I may look into how much work it would require to mock/circumvent these interactions if all else fails, though. – kgyts Jan 12 '18 at 11:02

2 Answers2

1

'Attach to Process via PID or Name' doesn't inherently limit the debug functionality. (I have used this feature myself successfully, and it's recommended here and elsewhere)

Make sure you've rebuilt and installed the Secondary project from Xcode, before launching it via the Primary process, so that you know you have the proper debug symbols for the build that you're running.

cbutton9
  • 148
  • 6
1

Try this. Goto Edit Scheme and set Launch to "Wait for executable to be launched"

Goto Edit Scheme and set Launch to "Wait for executable to be launched"

Diptesh
  • 383
  • 1
  • 5
  • 14