• 15
• 15
• 11
• 9
• 10

# Is there a way to force/trigger array view of certain pointers in the (VS) debugger

This topic is 1243 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

The VS debugger is capable of resolving STL container contents in a neatly organized view. Like this:

[attachment=24393:vecview.jpg]

I'm assuming this is built into the IDE. In short, is there any way I can force the IDE to do the same with my container assuming a layout like this?

template<class T>
struct VECTOR	{
private:
ISharedPtr<T> ptr;
int iNumElementsAllocated;
int iNumElements;
};


A more general question is whether it'd be possible to force VS to "hide" some level of indirection while debugging. For instance, ISharedPtr wraps its own raw pointer in a variable called 'T* ptr', so the actual array in the above example actually resides in 'VECTOR::ptr.ptr'. Thing is, after a while it becomes fantastically annoying to keep expanding the debug views in order to get to the actual data and then I'm still looking at a raw pointer, which needs to be indexed to gain access to its contents.

In debug mode I wouldn't even mind adding a dummy proxy variable to the container if it gave me direct access to ptr's contents, eg:

template<class T>
struct VECTOR	{
private:
ISharedPtr<T> ptr;
int iNumElementsAllocated;
int iNumElements;
T* view_data;

public:
void reserve(int n)
{
ptr = NewArray(T, n);
view_data = ptr.GetRawPointer();
}
};


But that won't help either since to the debugger view_data may either not be an array or is a pointer to an array of indeterminate size.

On the debugging side, Visual Assist X provides preliminary support for automatically skipping over certain functions while stepping through code, which is really useful. It'd be nice to be able to automatically force array-style view for certain variables as well. Sure, I can manually view the raw pointer in the watch or quick watch windows, but that resolves to a whole lot of steps that need to be performed manually:

1) right-click on variable -> open debugger quick view

2) browse to raw pointer

3) enter range

4) expand view

That's around two million clicks that could be spent elsewhere.

[attachment=24392:debug_view.jpg]

##### Share on other sites

Aw man - I think I even had that page open, but accidentally closed before getting around to reading it. Then I kept googling using more specific terms and never came across it again. That's what happens when you close your tabs once every two days.

Anyway - the native visualizer does precisely what I need it to do and works like a charm. Here's the bit relevant to array expansion.