xCode - can't add to Watch - debbuging issue

It’s not Juce issue, but I hope maybe someone would be so nice and help me.
From the beginning of my xCode experience I have some problem with debugging.
Sometimes it works quite well, but sometimes I have following issues (“sometimes” because I can’t find the dependency of it):

  1. I can’t investigate variables, there is just no info in debug mode. It looks like that:

  2. When I hover directly on variable and click on eye icon I get this:

  3. When I click “view memory off myValue” I get just empty screen, and address is indicating 0x0

All of those above sometimes work well. And sometimes not.
But next and last one issue happens always from the beginning of my xCode experience: I can’t add anything to “watch”. I know how it works in Visual Studio, but in xCode I’ve never seen that feature in action because I always get error like that:

‘this->aaa’ is in that case my bool which you can find on first screenshot also.

Why is that? Could anyone help me?
Thanks in advance for any help.

PS. Of course I know that naming variables like aaa or something like that is stupid. But it’s just for debugging. I that case my if(aaa && bbb && !ccc && ddd) doesn’t pass. But I don’t know which value is false, or for ccc case true. That’s why I want to debug that part of code.

Xcode what?


Sorry, don’t understand your question. What you are asking exactly?

Seems likely he is asking which version you are using.

1 Like

Aha :slight_smile:
I use xCode Version 10.0 (10A255) . But the same issues I had with two versions before also. And to be clear, I am in Mojave. But the same issue was with High Sierra.

Are you 100% sure you haven’t compiled with optimizations?

1 Like

No, I am not sure. I am also not sure what are you asking for. I have optimisation level set to “Fastest, aggressive optimization”. But I am almost sure I have always that optimization level and sometimes it works.

And there are 3 possible option for optimization, like:

  1. myPlugin - AU - I suppose it’s for specific target - I have it always for Fastest aggressive. And I always debug on that target.

  2. myPlugin - Project - this sometimes is empty after reopen project (now I’ve found out when I set it to some value, debuging works, but if it’s empty I have dubugging issue as I described, but why if I still have some value on the target which I use currently)

  3. macOS Default - this is always set to Fastest, smallest. I don’t even sure how to change it.

Finally what does mean macOS Default, and how to change it?

I think one of the reasons that these sometimes can’t be shown is that with optimisations, these variables don’t actually exist in memory. They could be optimised out or live entirely in registers etc.

It’s annoying but it’s how CPUs are fast. If you really need to know the value of a variable sometimes you need to force it to be logged to the console which can restrict optimisations like this.

OK, thanks. That’s true, now after I disable optimisation at all, everything works great.