Stacks Dev Journal - Xcode, Instruments, and Mojave

Securiteh!!!

Mojave includes many more system level protections to keep out malware. But with this security comes some annoying side effects. One that hit me recently is that I can’t attach Instruments to some apps. This has made plugin development difficult, particularly because RapidWeaver is one of those apps.

Plugins are weird

To debug and profile Stacks, I launch RapidWeaver, with Stacks installed of course, and attach the debugger or an Instruments tool (is that called an instrument? Ha! That’s very Stacks-like verbiage). The tool won’t see much useful info from the app if it has been symbol-stripped, but my plugin code does have symbols, so lldb and Instruments work just like you’d expect. I’ve been using this system since 2005 when I started writing plugins for RapidWeaver.

All this changed in Mojave. Now, when running some Instruments like Allocations, I get a very unhelpful error message (see image below). Not every instrument is broken however, many work fine.

What works and what doesn’t

I’ll be honest, I haven’t researched this problem very far. Security “features” seem far more irritating than interesting, which tends to keep me ignorant about them. I expect there’s a great WWDC talk it somewhere. I really hope I never have to watch it.

What I do know is that some released apps don’t seem to work. More importantly, RapidWeaver doesn’t. But apps I build myself work just fine.

I was slow coming to this realization. This summer when I first bumped into this problem in the Mojave beta, I assumed it was just a beta quirk. When public release didn’t resolve the issue, I then assumed it was a bug I introduced into the Xcode project config. But after an accidentally ⌘-I in my test fixture I was pleasantly surprised to find Instruments working perfectly.

Side project pays off

As a side project, I’ve been slowly building up my little test fixture to be more capable. This week I merged the side project branch after I hit a pretty significant milestone: the test fixture can now display the Stacks user interface complete with library, 3rd party stacks, and an info-sidebar.

I still can’t do anything real, like open a project file or even do a real export. I’m not sure I’ll ever need to take it that far just to exercise my code.

If Apple locked plugins out of Instruments today, then lldb could be on the chopping block. Without a debugger development of a tool like Stacks would be impossible. I sleep a little easier knowing that if lldb is locked out, I can rely on my little test app to help me out even more.

Halp!

If anyone knows more about these errors, especially if you know how to fix them, please let me know. Until then I’ll just keep adding bits to my side project every weekend.

Instruments Error

#dotblog #devjournal

*What is this: these are random snippets from my dev journal working various projects. Some of these projects are for work, some are just for fun.

isaiah @isaiah