Debugging plugin loading

It happens to me quite often that when I am testing a plugin, nothing happens. I get told that last time I opened Glyphs, the plugin crashed, but I don’t know why. Nothing in the Macro window, nothing obvious in the Console log. I do all the usual things - comment out bits of code, make sure MacOS/plugin is the latest version, replace the plugin.py with the template file, … nothing. It just crashes and I have no idea why.

Please, when Glyphs knows that a plugin recently crashed, could it log more diagnostic messages when loading that same plugin next time? Like, something in the Console log before and after the plugin binary is loaded, messages before and after each call to a method on the plugin, log the return value of each method, etc.

Ooh, if I remove the plugin and re-add it, I get an immediate Glyphs crash:

Exception Type:        EXC_BAD_ACCESS (SIGKILL (Code Signature Invalid))

Does the plugin need to be code signed?

$ codesign -v Python\ Templates/Reporter/____PluginName____.glyphsReporter/Contents/MacOS/plugin
Python Templates/Reporter/____PluginName____.glyphsReporter/Contents/MacOS/plugin: code object is not signed at all

That seems odd.

The plugins don’t need code signing. You only need to get them past Gatekeeper. So if you download them through Safari or send them by Mail, you need to strip the quarantine bits. Glyphs is doing that when you “install” it. Just putting them in the Plugins folder will not work. But getting them through git is fine.

Then you start Glyphs from the terminal: /Applications/Glyphs 3.app/Contents/MacOS/Glyphs 3 you should see some log message about the failing plugin.

I tried that too. I got the plugin binary through git (GlyphsSDK repo) and copied it into my plugin path. First run:

$ /Applications/Glyphs\ 3.app/Contents/MacOS/Glyphs\ 3
[1]    57350 killed     /Applications/Glyphs\ 3.app/Contents/MacOS/Glyphs\ 3

Second run:

$ /Applications/Glyphs\ 3.app/Contents/MacOS/Glyphs\ 3
2021-12-10 10:50:02.310 Glyphs 3[57405:5728392] [AppCenterCrashes] WARNING: +[MSACErrorLogFormatter formatStackFrame:report:]/469 Cannot find image for 0x104913d88
2021-12-10 10:50:02.310 Glyphs 3[57405:5728392] [AppCenterCrashes] WARNING: +[MSACErrorLogFormatter formatStackFrame:report:]/469 Cannot find image for 0x104913c88
<lots more like that>
2021-12-10 10:50:02.418 Glyphs 3[57405:5728392] Glyphs listening on port com.GeorgSeifert.Glyphs3
2021-12-10 10:50:02.442 Glyphs 3[57405:5728392] Warning: Column selection is not supported in view-based table and outline views (<NSTableView: 0x1220b7a00>).
CoreGraphics PDF has logged an error. Set environment variable "CG_PDF_VERBOSE" to learn more.
2021-12-10 10:50:02.592 Glyphs 3[57405:5728392] {{0, 0}, {650, 520}}
2021-12-10 10:50:02.592 Glyphs 3[57405:5728392] {{0, 0}, {270, 520}}
2021-12-10 10:50:03.408 Glyphs 3[57405:5728403] [AppCenterCrashes] WARNING: +[MSACErrorLogFormatter formatStackFrame:report:]/469 Cannot find image for 0x104913d88
2021-12-10 10:50:03.408 Glyphs 3[57405:5728403] [AppCenterCrashes] WARNING: +[MSACErrorLogFormatter formatStackFrame:report:]/469 Cannot find image for 0x104913c88

Nothing about the plugin.

Can you send me the plugin?

It’s the Show Anchor Cloud, trying to get it working for G3:

I change a few small things to make it work in Glyphs 3. When you have code signing issues, you might need to delete repo and clone it again.

I’m starting to wonder if it’s my installation - just installed a few plugins from the Plugin Manager; Backdrop and Show Rotated also crashed, with nothing obvious on the console.

What python do you use?

I’m using Glyphs’ 3.9.1. But what I’ve found is that if Glyphs installs them via the package manager, they don’t work. If I git clone the repositories myself, they work.

Perhaps wipe your App Support folder and reinstall from plug-in manager.