How to view data in JUCE array containers in Xcode debugger?

For example, if you are looking at a PropertiesFile::keys member, and you want to see all of them, the debugger only shows the first data value:

Screen Shot 2020-03-03 at 3.56.02 PM
The above shows numUsed as 3 items in the array, but the data element only shows the first one.

This is true for any array like this; I just can’t figure how to view the rest of the keys in the array…

I don’t know if they work as expected, since I’ve never used them, but contains some utilities to help with debugging JUCE classes.

I hope this helps.

I was going to post @jimc’s solution, and although I managed to get it apparently installed without issue I just couldn’t get the results I was looking for in XCode, I assumed due to PICNIC and eventually just gave up. If anyone can give some instructions on how to actually use it properly I would be most grateful!

If anyone is in a hurry and their Python skills and LLDB knowledge is up to it, I’m accepting patches as I just haven’t found the time to fix it.

Secret LLDB knowledge is at the bottom of this page under Python Scripting:

And also:
“In order to write effective summary scripts, you need to know the LLDB public API, which is the way Python code can access the LLDB object model. For further details on the API you should look at the LLDB API reference documentation.”

1 Like

So if I understand the discussion:

  1. might allow me to do this - but reading the git I don’t see anything specifically about debugging JUCE object arrays… and…

  2. Anyway, they may not be working at the moment?

  3. There’s no way to natively view other elements besides [0] in the Xcode debugger?

While we’re having this conversation, is there a reason why Array can’t just switch to use std::vector internally instead of HeapBlock?

For trivially copyable types ArrayBase can use realloc to grow in-place, whereas std::vector cannot.

The default size and growth behaviour of ArrayBase also performs better in places like JUCE’s graphics rendering code.

Thanks Tom, that makes sense!

But… isn’t that something that could be adjusted via a template parameter or something?

Most JUCE code isn’t dealing with high performance graphics and being able to debug it would be a huge benefit.

It did used to work for all types of JUCE array, but just needs some kind of tweaking!

I updated the Visual Studio version to work with the latest juce, and even do a little more unraveling of ValueTrees, but I never did that for the xcode version. :frowning:

Any chance of publishing those fixes or getting them to jimc? I use VS2019 as well, although I posted this about XCode… Thanks.

I have published them, and submitted a PR to jim with the changes. :slight_smile:


Sweet, let me work out where to find that in github!

1 Like

You should be able to index into the data element to see the individual values. It’s not terribly ergonomic, especially in Xcode since you cannot edit the generated expressions in-place. But, if you have a StringArray, stringArray, you can view the string at a given index by adding the expression[index] then expanding the text and data members.

1 Like

Thanks! I never knew how to approach that, but based on your post I made it work:

Screen Shot 2020-03-10 at 12.32.58 PM

It’s a lot of typing but it does work. :slight_smile:

1 Like

Indeed, looks like it’s showing empty arrays now.