Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Natvis framework cannot display more than 50 content during debugging with ArrayItems or IndexListItems #1307

Closed
atifkarim opened this issue May 25, 2022 · 1 comment

Comments

@atifkarim
Copy link

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 stack of memory content (eg: Value from index 0 to 500 or more. Depends on which size is given by me in <size>size_val</size> field) using natvis which is pointed by a pointer. I have also tried to use std::vector. But every time the problem I am facing is that, during debugging the visualizer can show only first 50 entry (index 0 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.

foo.h

#include <iostream>
#include <vector>

class Foo
{
    public:
        Foo(){}

        uint32_t *pointer_array;
        std::vector<uint32_t> foo_vec;
};

main.cpp

#include "foo.h"
# define ARRAY_SIZE 5000

int main()
{
    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);
    }

    return 0;
}

The following natvis file I have used.

<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
    <Type Name="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>&amp;foo_vec[0]</ValuePointer>
        </ArrayItems> -->
        </Expand>
    </Type>
</AutoVisualizer>

In the launch.json I have added extra only the following two lines

"visualizerFile": "${workspaceFolder}/natvis_file/file.natvis",
"showDisplayString": true,
  • For better understanding I am giving here a screenshot of the output where in natvis file I have used IndexListItems and given size 80 to see value from index 0 to 79 but the displayed last value is from index 49.
  • And the following image is showing that I have given the size value 6 and natvis perfectly is showing value from index 0 to 5.

If any workaround is guided to achieve all entry of the memory using Natvis, it would be very beneficial for me.

@atifkarim atifkarim changed the title Natvis framework cannot display more than 49 content during debugging Natvis framework cannot display more than 50 content during debugging May 25, 2022
@atifkarim atifkarim changed the title Natvis framework cannot display more than 50 content during debugging Natvis framework cannot display more than 50 content during debugging with ArrayItems or IndexListItems May 27, 2022
@WardenGnaw
Copy link
Member

Duplicate of #821

@WardenGnaw WardenGnaw marked this as a duplicate of #821 Jun 5, 2022
@WardenGnaw WardenGnaw closed this as not planned Won't fix, can't repro, duplicate, stale Jun 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants