How can I get full string value of variable in VC6 watch window?
Asked Answered
O

6

6

I'm wanting to get the full value of a char[] variable in the VC6 watch window, but it only shows a truncated version. I can copy the value from a debug memory window, but that contains mixed lines of hex and string values. Surely there is a better way??

Okeefe answered 19/9, 2008 at 17:44 Comment(0)
S
4

For large strings, you're pretty much stuck with the memory window - the tooltip would truncate eventually.

Fortunately, the memory window is easy to get data from - I tend to show it in 8-byte chunks so its easy to manage, find your string data and cut&paste the lot into a blank window, then use alt+drag to select columns and delete the hex values. Then start at the bottom of the string and continually page up/delete (the newline) to build your string (I use a macro for that bit).

I don't think there's any better way once you get long strings.

Skid answered 19/9, 2008 at 18:46 Comment(3)
This is the method I now use, but I would add a caveat for others: when you paste as text and edit, you need to consider the possibility of embedded nulls that truncate the string but are converted to non-printable characters. These, combined with 'junk' in memory can make a string appear to be longer than it really is.Okeefe
How do you get to the memory window?Gripsack
@Gripsack learn.microsoft.com/en-us/visualstudio/debugger/…Skid
F
1

Push come to shove you can put in the watch

given

char bigArray[1000];

watch:

&bigArray[0]
&bigArray[100]
&bigArray[200]
...

or change the index for where in the string you want to look...

Its clunky, but its worked for me in the past.

Farceur answered 19/9, 2008 at 17:48 Comment(0)
C
1

I do not have VC6 any more, so I cannot try it. I do not know if it works, but maybe you can enter

(char*)textArray;

in the watch window.

The bettter solution maybe: VS2008 automatically displays the text the way you want. And there is a Express Edition for VS2008 free of change, which can, as far as I know, be used to develop commerecial applications. You can even try to continue developing with VC6, and use VS2008 for debugging only. With VS2003 it was possible. About 5 year ago I had to maintain an app which was developed with VC6. I kept using VC6 for developing, but for debugging I used VS2003.

Camelot answered 19/9, 2008 at 18:29 Comment(1)
The cast won't work, since the problem is that VC6 truncates strings in the watch window. e.g. your post would show up as "I do not have..." with no way to get the rest of the string short of opening the memory window. The the VC2008 express idea should work.Misdemean
S
1

The only technique i have seen is to watch the string then the string + 50, + 100 etc.

Eugene Ivakhiv wrote an addin for msvc 6 that lets you display the full string in an edit box.

Shortcoming answered 19/9, 2008 at 21:54 Comment(0)
M
1

There's a cute plugin for VC6 called XDebug. It adds a dialog for viewing different types of strings. It worked great for me.

Mutant answered 26/6, 2010 at 21:54 Comment(1)
I have just installed this and it works wonderfully! On Windows 7 (and probably other newer OSs) there was a complication when using the install instructions included with the plugin. You must run cmd with admin rights and use the command regsvr32 \path\XDebug.dll. Then follow the install instructions. If you don't do this first the plugin can't register. I've edited the answer with a direct link rather than a link to a hard-to-read blog.Rockery
S
0

Perhaps, get used to creating logfiles, and write output into the file directly, then bring up in your favorite text editor.

Savory answered 19/9, 2008 at 20:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.