views:

1683

answers:

3

When debugging my program in the XCode debugger, if I hovered my mouse over an array variable, the XCode debugger used to show me how many objects were in the array and I could even examine the objects themselves.

Somewhere along the line this functionality was broken and now it just says there are "-1812597152 objects" in all my arrays and I do not have access to the individual objects.

Does anyone know what went wrong? or better yet, how to fix this?


Edit:

This happens for all arrays, so I don't think its a retaining problem.

I checked out the custom data views with no luck. Unfortunately moving the plist in

~/Library/Application Support/Apple/Developer Tools/CustomDataViews/

had no effect and there were no files in

~/Library/Application Support/Developer/Shared/Xcode/CustomDataViews/

And here is the entry in for arrays in /Developer/Library/Xcode/CustomDataViews/Foundation.plist

<key>NSArray *</key>
<dict>
 <key>SummaryString</key>
 <string>{(int)[$VAR count]} objects</string>
</dict>

Which looks pretty good to me.

+1  A: 

Edit: As @Ben mentions, first check whether the array variable is out of scope. I would also add that it's possible that the object has been reclaimed (either by -dealloc or GC) so check to make sure it's retained if needed.

If this problem occurs all the time for all arrays, you may have unintentionally changed the data formatter summary string in the Xcode debugger. When you change a data formatter, it overrides the default values. For example, the NSArray formatter is in this file:

/Developer/Library/Xcode/CustomDataViews/Foundation.plist

You can create your own data formatters which can be stored in plist files or bundles in this directory:

~/Library/Application Support/Developer/Shared/Xcode/CustomDataViews/

Dynamically-specified custom data formatters (those that are typed directly into the summary fields of the Xcode debugger) are stored in this directory:

~/Library/Application Support/Apple/Developer Tools/CustomDataViews/

If a CustomDataViews.plist file exists in that directory, I suggest moving it out of the way to see if your problem goes away. If it does, and you don't need any of the custom formatters it defines, (you can examine it with Property List Editor or any text editor) it's probably safe to trash it.

Quinn Taylor
This happens for all arrays, so I don't think its a retaining problem. I checked out the custom data views with no luck. Unfortunately moving the plist in ~/Library/Application Support/Apple/Developer Tools/CustomDataViews/ had no effect and there were no files in ~/Library/Application Support/Developer/Shared/Xcode/CustomDataViews/And here is the entry in for arrays in /Developer/Library/Xcode/CustomDataViews/Foundation.plist <key>NSArray *</key> <dict> <key>SummaryString</key> <string>{(int)[$VAR count]} objects</string> </dict>Which looks pretty good to me.
Kaom Te
Dangit. Crappy formatting.
Kaom Te
+2  A: 

Hi Kaom,

It sounds like the array you're trying to view is out of scope. This sometimes happens if you set a breakpoint on the last line of a function, because the compiler may have optimized that line away and cleaned up local objects. If this is the case, other objects like NSStrings will be unavailable as well.

There is a chance you defined a custom data formatter, but I'd say the scope issue is more likely. Try setting a breakpoint earlier in your code and stepping through to see if the array description becomes garbled at some point.

Hope that helps!

Ben Gotow
A good suggestion — he didn't mention whether it happens for all arrays at all points during debugging, or just for one. Updating my answer to clarify this. :-)
Quinn Taylor
+1  A: 

Just under the wild chance that this hasn't already been done with all of the monkeying with data formats, make sure to try disabling Data Formatters by unchecking the Run->Variables View->Enable Data Formatters option.

This completely disables the custom data formatters and so should eliminate them from any further consideration if it has no impact on the display.

(apologies, can not yet add comments)

Barney Mattox