How to debug array of char with more than 210 elements

675 Views Asked by At

I'm working with Visual Studio Express 2013 for Windows Desktop, and I would like to see the value of a variable.

This looks very easy: either open the "Locals" window and check the value, or add it to the "Watch" window, and the value can be read.

This is true indeed, but my variable is a char array (typedef char T_BufCommandLine [32768];), containing more than 210 characters, and I only see the first 210. After that, there are three dots ("..."), just mentioning that the array is not finished yet.

I know that I could expand the value of this variable, but the result is not very readable, and copying a part of this is completely impossible.

So my question: does anybody know how I can visualise the value of an array of char, which contains more than 210 characters, as one string without the "..."?

3

There are 3 best solutions below

2
On BEST ANSWER

While on a breakpoint in the debugger, hover over your variable and click the down-arrow next to a "looking glass" icon; select "Text Visualizer".

enter image description here

Alternatively, use the Memory window:

enter image description here

0
On

One easy trick is to copy the element you want to a separate variable (or assign a pointer to the element) and add a breakpoint right after it is assigned to snoop it's value.

0
On

If you want to keep using the Watch window, you can just explicitly specify the starting address. After all, it is just a plain old array. The debugger knows how to do pointer arithmetic. To watch the values beyond the first 210 elements, just do something like: T_BufCommandLine+210,500.

You could also use the Immediate Window, but you'll need to tell it exactly how long the array is. Something like: ?T_BufCommandLine[0],32768 will give you a massive dump.