# Plugin works fine, but fails to attach to debugger

**URL:** <https://forum.juce.com/t/plugin-works-fine-but-fails-to-attach-to-debugger/49327>\
**Category:** General JUCE discussion\
**Created:** [December 19, 2021, 12:51am UTC](https://forum.juce.com/t/plugin-works-fine-but-fails-to-attach-to-debugger/49327 "2021-12-19T00:51:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![duvrin](https://avatars.discourse-cdn.com/v4/letter/d/a88e4f/32.png) [@duvrin](https://forum.juce.com/u/duvrin)\
**Post date:** [December 19, 2021, 12:51am UTC](https://forum.juce.com/t/plugin-works-fine-but-fails-to-attach-to-debugger/49327/1 "2021-12-19T00:51:33Z")

</div>

My plugin recovered from a mysterious crash, and all of a sudden I can’t attach it to auvaltool in debug mode.  
But when simply running `auvaltool -v ...` from the terminal it passes validation.

This is the output I’m getting in debug mode:

```auto
ERROR: Cannot get Component's Name strings
ERROR: Error from retrieving Component Version: -50

* * FAIL
--------------------------------------------------
TESTING OPEN TIMES:
FATAL ERROR: didn't find the component
Program ended with exit code: 2

```

Same goes for Logic: When I try to attach the debugger the plugin won’t show up at all in plugin manager.  
But if I just build the project and open Logic, the plugin is there. Always updated with the latest changes I made.

Anyone can give pointers on that? Does it makes sense at all?  
I would really like to get my debugger back…

---

<div class="post-metadata">

**Author:** ![rory](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rory/32/534_2.png) [@rory](https://forum.juce.com/u/rory)\
**Post date:** [December 19, 2021, 11:23am UTC](https://forum.juce.com/t/plugin-works-fine-but-fails-to-attach-to-debugger/49327/2 "2021-12-19T11:23:29Z")

</div>

You can’t currently debug AU plugins in Logic unless you disable SIP. Search the forum for _debug AU logic_ and you’ll find plenty of comments from irate developers about this.

---

<div class="post-metadata">

**Author:** ![duvrin](https://avatars.discourse-cdn.com/v4/letter/d/a88e4f/32.png) [@duvrin](https://forum.juce.com/u/duvrin)\
**Post date:** [December 19, 2021, 11:56am UTC](https://forum.juce.com/t/plugin-works-fine-but-fails-to-attach-to-debugger/49327/3 "2021-12-19T11:56:09Z")

</div>

Thanks. Did that a while ago. When I run `csrutil status` I get `System Integrity Protection status: disabled`.

The issue though is not that I can’t debug, its that auvaltool will not find my plugin if I attach it in Xcode.  
This behavior started after a crash, so I feel like auvaltool has a bad version of the plugin in some cache somewhere, so it refuses to load it.

So to recap:

- running `auval -a` from terminal - plugin is shown
- running `auvaltool -v <args>` from terminal - plugin passes validation
- in Xcode, edit scheme and attach plugin to auvaltool - component not found error.

---

<div class="post-metadata">

**Author:** ![rory](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rory/32/534_2.png) [@rory](https://forum.juce.com/u/rory)\
**Post date:** [December 19, 2021, 4:29pm UTC](https://forum.juce.com/t/plugin-works-fine-but-fails-to-attach-to-debugger/49327/4 "2021-12-19T16:29:36Z")

</div>

> [@duvrin](#):
>
> This behavior started after a crash, so I feel like auvaltool has a bad version of the plugin in some cache somewhere, so it refuses to load it.

I assume you’ve cleared AU cache?

---

<div class="post-metadata">

**Author:** ![duvrin](https://avatars.discourse-cdn.com/v4/letter/d/a88e4f/32.png) [@duvrin](https://forum.juce.com/u/duvrin)\
**Post date:** [December 19, 2021, 5:05pm UTC](https://forum.juce.com/t/plugin-works-fine-but-fails-to-attach-to-debugger/49327/5 "2021-12-19T17:05:17Z")

</div>

Yes. I think I did every trick in the book:  
Clear AU cache, clear build folder, clear components folder, drag out of components folder to desktop and back, restart the machine…

The thing is that if I just build the project and open Logic directly and not from Xcode, it loads the plugin just fine. It even shows the latest changes I made without having to do any of the steps mentioned above.

The problem occurs only when I try to attach the debugger to Logic, auvaltool or juce AudioPluginHost.  
If I try to attach the debugger to pluginval, it shows up correctly.

---

<div class="post-metadata">

**Author:** ![rory](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rory/32/534_2.png) [@rory](https://forum.juce.com/u/rory)\
**Post date:** [December 20, 2021, 11:04am UTC](https://forum.juce.com/t/plugin-works-fine-but-fails-to-attach-to-debugger/49327/6 "2021-12-20T11:04:14Z")

</div>

Is this relevant?

> [@How to debug auval?](https://forum.juce.com/t/how-to-debug-auval/17869/4):
>
> Great, that helped me. One thing to add, since 10.11 the debugger will not be able to debug auvaltool: Message from debugger: cannot attach to process due to System Integrity Protection Program ended with exit code: -1 The solution is to copy auvaltool over to the /Applications folder (and possibly rename it, to avoid confusion).

---

<div class="post-metadata">

**Author:** ![duvrin](https://avatars.discourse-cdn.com/v4/letter/d/a88e4f/32.png) [@duvrin](https://forum.juce.com/u/duvrin)\
**Post date:** [December 20, 2021, 11:29am UTC](https://forum.juce.com/t/plugin-works-fine-but-fails-to-attach-to-debugger/49327/7 "2021-12-20T11:29:25Z")

</div>

It is, but I already performed this step. This worked for a while but lately I did something wrong and now I’m getting exit code -2, which usually means some 32/64 bit issue or something similar.

I did manage to make some progress: Until now I build the plugin for Rosetta on my M1. When switched to Arm64, I am now able to load the plugin in Logic in debug mode.  
However, in this setup the breakpoints are not getting hit and DBG statements are not printed to the console. That was the reason I switched to Rosetta in the first place.

So this whole thing is related to M1 architecture more than anything else.  
Thanks for trying to help.

---

<div class="post-metadata">

**Author:** ![rory](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rory/32/534_2.png) [@rory](https://forum.juce.com/u/rory)\
**Post date:** [December 20, 2021, 11:38am UTC](https://forum.juce.com/t/plugin-works-fine-but-fails-to-attach-to-debugger/49327/8 "2021-12-20T11:38:03Z")

</div>

Sorry I can’t be more of a help. Please let me know if you find the solution. I moved to an M1 machine myself recently, and it’s been anything but smooth sailing.
