You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First all, I will be very sorry if this is not the right place to ask the question related to natvis debugging. If I have chosen the wrong platform to ask the query would be great if anyone can point me the right location (except stackoverflow) will be grateful.
Now the issue. I am trying to visualize a memory content using natvis which is pointed by a pointer. I have also tried to declare the memory as a vector. But every time the problem I am facing is that, during debugging the visualizer can show only first 50 entry (index o to 49).
I am giving here a very minimal example. Suppose, the pointer_array is a member of Foo class. In the driver file an array of size 5000 is created which is pointed by the array. I would like to observe the value of the array with the variable pointer_array. Also I have tried to understand how natvis reacts with std::vector and that's why as a member variable a vector (foo_vec) is also declared.
#include"foo.h"
# defineARRAY_SIZE5000intmain()
{
Foo obj_1;
uint32_t foo_array[ARRAY_SIZE];
for(int i = 0; i < ARRAY_SIZE; i++)
{
foo_array[i] = i*2;
}
obj_1.pointer_array = foo_array;
for(uint32_t i = 0; i < ARRAY_SIZE; i++)
{
obj_1.foo_vec.push_back(i*3);
}
return0;
}
The following natvis file I have used.
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizerxmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<TypeName="Foo">
<DisplayString>Testing_Natvis</DisplayString>
<Expand>
<ArrayItems>
<Size>5000</Size>
<ValuePointer>pointer_array</ValuePointer>
</ArrayItems>
<!-- Tested with IndexListItems but failed to fetch all data, still only first 49 entry --><!-- <IndexListItems> <Size>5000</Size> <ValueNode>pointer_array[$i]</ValueNode> </IndexListItems> --><!-- Same result as like as pointer_array. Only first 49 entry is appeared --><!-- <IndexListItems> <Size>foo_vec.size()</Size> <ValueNode>foo_vec[$i]</ValueNode> </IndexListItems> --><!-- <ArrayItems> <Size>foo_vec.size()</Size> <ValuePointer>&foo_vec[0]</ValuePointer> </ArrayItems> -->
</Expand>
</Type>
</AutoVisualizer>
In the launch.json I have added extra only the following two lines
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First all, I will be very sorry if this is not the right place to ask the question related to
natvis debugging
. If I have chosen the wrong platform to ask the query would be great if anyone can point me the right location (exceptstackoverflow
) will be grateful.Now the issue. I am trying to visualize a memory content using natvis which is pointed by a pointer. I have also tried to declare the memory as a vector. But every time the problem I am facing is that, during debugging the visualizer can show only first
50 entry (index o to 49)
.I am giving here a very minimal example. Suppose, the
pointer_array
is a member ofFoo
class. In the driver file anarray
of size 5000 is created which is pointed by the array. I would like to observe the value of the array with the variablepointer_array
. Also I have tried to understand hownatvis
reacts withstd::vector
and that's why as a member variable a vector (foo_vec
) is also declared.foo.h
main.cpp
The following
natvis file
I have used.In the
launch.json
I have added extra only the following two linesIf any workaround is guided to achieve all entry of the memory using Natvis, it would be very beneficial for me.
Beta Was this translation helpful? Give feedback.
All reactions