Richard Smith
Richard Smith

Reputation: 151

View elements of an array when debugging in Netbeans

Netbeans has a variable tab that appears when debugging. It works great for for example booleans as I see the name of the variable and its value (e.g. "true") and Strings (as I see e.g. "Dog") but I in the case of arrays, for example an array of Strings, I see something like #57(length=13) but would like to see its contents i.e. {"a", "b", "c", "d"}. Is this possible in Netbeans?

Upvotes: 0

Views: 2278

Answers (4)

Olivier Levrey
Olivier Levrey

Reputation: 115

A very old question, but I've found an easy solution for Netbeans 12.0.

When debugging, in the Variables tab, right-click on the table's header (for example Value header), and check String value: String representation of the value.

A new column String value will be added with the toString() value.

Upvotes: 1

Mahouk
Mahouk

Reputation: 922

In variable tab, just add a new watch,

like *table_name@table_size

Upvotes: 0

Izik
Izik

Reputation: 948

u can use the "Expression Evaluation" windows. It's less comfortable then "Variables" window but still helpful. to get this windows go to "WIndows" --> "Debugging" --> "Expression Evaluation".

there if you have, for example, array of type "items_t" called "items" , u just type "items[0]" and it shows you all what inside that index.

I still have not managed to find out how to print the whole array.

Upvotes: 0

Lajos Arpad
Lajos Arpad

Reputation: 76426

You can add expressions to the watch expressions. They are expandable.

Upvotes: 0

Related Questions