Instruments not starting in specified working directory

Instruments is not honouring the working directory that I have specified in the target. It invokes the executable with the specified argument, but the working directory is root! ().

Needless to say this causes problems with my app. Changing the directory within the app doesn't work either. I have granted Instruments Full Disk Access rights within the Security and Privacy settings, but that makes no difference.

As a workaround, I attach to the already running process, but I'd like to know if this is a bug or if there is a trick to do this. XCode 13.1 and macOS 12.0.1.

Note that I had to codesign the executable to over come the "Failed to Get Authorization" error. See https://developer.apple.com/forums/thread/681687.

Thanks,

Stew

Post not yet marked as solved Up vote post of StewMacLean Down vote post of StewMacLean
707 views
  • I'm experiencing a similar issue with Xcode 14.2 on MacOS 13.2.1.The working directory from the Xcode scheme 'Profile' (a relative path) appears in Instruments target chooser (as the absolute path), but has no effect. In my case the actual working directory remains the default (i.e. the one containing the executable), rather than becoming root. The same working directory in the Xcode scheme 'Run' is used successfully, so it does look like an Instruments problem, not an Xcode one.

Add a Comment

Replies

Hi Stew,

specifying the working directory should definitely work. I assume you are specifying the working directory in the target chooser's "working directory" field?

If you did this and it doesn't work, please file a Feedback and we will look into it. If you can provide an example project that clearly demonstrates the issue, it makes it easier for us to reproduce the issue and will be highly appreciated.

  • Hi there,

    Thanks for your reply. Yes, that is exactly what I did.

    Once I've got through my memory leak analysis, I'll put together an example demonstrating the issue.

    Cheers,

    Stew

Add a Comment