This tutorial shows how to visualize complex data structures using the Microsoft Natvis files and VisualGDB. Before you begin, install VisualGDB 5.1 or later.
Start Visual Studio and open any of the VisualGDB Project Wizards. In this example we will create a Linux project, however the same technique will also work for Embedded, Windows and Android projects.
Then press F5 to build and debug your project: Hover the mouse over the instance of your list. Notice that by default you won't easily see the contents of the entire list, as only the first and the last elements are directly referenced from the list object.
We will now create a .natvis file that will tell VisualGDB how to display the contents of your list. Right-click in the Solution Explorer, select Add->New Item and pick the Debugger visualization file from Visual C++->Utility: If this item type does not appear, simply create a .txt file and change its extension to .natvis later.
Now start debugging again by pressing F5 (no rebuild is required) and hover the mouse over 'list'. VisualGDB will display the actual contents of the list according to the rules you specified in the .natvis file: You can use other Natvis constructs described here to describe displaying rules for strings, arrays, trees and other structures. Note that as of v5.1 VisualGDB does not support the CustomListItems rule.