Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View Array contents in Qt Creator debugger

Tags:

c++

qt

qt-creator

I am using Qt on Ubuntu. When I debug I only see the very first value of the array in Locals and Watchers. How can I view all the array contents?

struct node
{
    int *keys;
    void **pointers;
    int num_keys;
    struct node *parent;
    int is_leaf;
    struct node *nextLevelNode;
};

It shows only the first key value in the debugging window.

like image 254
nikhil Avatar asked Sep 23 '11 19:09

nikhil


People also ask

How do I view an array in debugger?

Starting with Visual C++ version 6.0, it's now possible to expand an array pointer to view all array elements in the Visual C++ debugger Watch window. This feature isn't documented. In the Watch window, type an expression that evaluates to a pointer followed by a comma and the number of elements in the array.

How do I view the contents of an array in Visual Studio?

If not, you can view an array for C++ and C# by putting it in the watch window in the debugger, with its contents visible when you expand the array on the little (+) in the watch window by a left mouse-click.


1 Answers

In Expression evaluator, Try (int[10])(*myArray) instead of (int[10])myArray

Or, *myArray@10 instead of myArray@10

like image 170
Peter C. Avatar answered Oct 08 '22 15:10

Peter C.