Sign in to follow this  
graveyard filla

why does debugging suck so much in VS.NET 2k3/C++?

Recommended Posts

Hi, I am using VS.NET 2003... why is it that coding a C# or VB.NET application, the debugger works just as you would expect..... you can hover over variables and it will easily give you the value, etc... but when you try to step through any C++ code, you cant view any variables 90% of the time it feels. Right now I am trying to step through some code, and just trying to Watch a simple integer gives me "CXX0069: Error: variable needs stack frame"... And with containers, there is absolutely NO chance of seeing the data in it..... pretty frustrating because me and the rest of the world works with them a lot..... I think it is plain retarded that I have to put COUT statements to see this data...... Does anyone have any advice for this? Any alternative IDE's that are free? I know there is a plugin for VS.NET 2003 which helps with debugging containers, but for some reason I doubt it will solve all my problems..... What does the future hold? Has anyone used VS 2005 yet with C++? I use it at work for .NET and its great, aside from the random crashings I get sometimes... but I really hope that at least the 2005 version of this IDE will be able to do the very basic things such as a funtioning Watch panel... surely this isn't a limitation because of the language itself? Thanks for any help. [Edited by - graveyard filla on September 6, 2006 11:02:13 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
One option is using 2005 version of VS, like the express version etc. It provides solid STL debugging and you are able to dive into it.

Freebie IDE's one letdown usually is the debugging unfortunately, a lot are based off a internal version of GDB and tend to be even worse then VS.

Also there are hacks out there available to make STL containers visible in VC 2003.

Also wholetomato.com has visual assist that may help you a little. Don't think it helps much with debugging though.

Share this post


Link to post
Share on other sites
I've only had those kinds of issues under one condition: missing or inaccurate debug information, such when debugging optimized code or code for which no valid PDB is available, et cetera.

It sounds to me like your project's debug information is not being generated correctly, or is being corrupted.

Share this post


Link to post
Share on other sites
Did you, by chance, happen to prevent the compiler from generating code to keep track of the stack frame? Stack frames are necessary if you want to be able to reconstruct the function call stack and the arguments that go with each function.

Edit: The option is called 'omit frame pointer' under C/C++ -> Optimizations in your project properties.

Share this post


Link to post
Share on other sites
Dude, VC++ has the best debugger out there. And STL is notorious for being damned near impossible to debug... that's why a lot of people refuse to use it. (I know respectable people who handcode their containers on a case-by-case basis for this reason).

It sounds like you are trying to look at variables that don't exist at the time you are looking at them. If the variables aren't in scope when you look at them, they won't be there... hence the "needs stack frame" thing.


void myFunction(void)
{
// You can't look at this stuff unless you are at a breakpoint
// IN this function.. they only exist in the stack frame.
int x;
x = 5;
}



EDIT: I agree with the previous guys, check out the settings. But I can say first-hand that VisualAssist doesn't do too much for the STL debugging. And I second the notion that 2005 is significantly better.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Also check out http://www.highprogrammer.com/alan/windev/visualstudio.html for debugging tips with 2003.

Share this post


Link to post
Share on other sites
Sounds like a malfunction between the chair and the keyboard. :) jk

I've seen the stackframe message before, and it was because i didnt double click on the callstack line i wanted to observer, to jump the arrow thing to it. Debugging containers is a pain for sure, but that has been addressed in 2005. I've never tried the plugin that was supposed to improve it for 2003. Other than that debugging works perfectly fine. I've never had problems seeing the data(besides release builds). Make sure you jump the callstack arrow cursor thingy to the part of the code you want values for.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
for tips on adding STL container debugging when hovering over check out http://www.findarticles.com/p/articles/mi_m0FOX/is_4_5/ai_60805631

There are other articles online about it, do a search for autoexp.dat and stl and you'll get a ton of links

Share this post


Link to post
Share on other sites
Thanks for the replies.....

I think my project must be corrupted then...., yes, I feel stupid... for some reason it keeps giving me that message, and yes the variables are in scope obviously... well, except for containers... then I get that _myfirst/etc stuff... I'll have to try creating a new project... It's been a long time since I have messed with C++, and picked up the dusty old source, so I apologize for whining so much, it's just that I've been so spoiled by .NET for the last year or so.... after forgetting a bracket and getting 27 errors I remembered fast why I prefer .NET [grin].

Thanks again

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
VS.NET 2005 debugging support for viewing variables is better than VS.NET 2003. However, you can provide information for how you want variables to appear. Assuming you installed to the default location, look at the file "C:/Program Files/Microsoft Visual Studio .NET 2003/Common7/Packages/Debugger/autoexp.dat".
The comments in this file make it clear how to add entries for your own classes. You can even modify how STL data appears during debugging.

If you look at the equivalent autoexp.dat file in VS.NET 2005, you will see why the debug display is better for STL :)

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
VS.NET 2005 debugging support for viewing variables is better than VS.NET 2003. However, you can provide information for how you want variables to appear. Assuming you installed to the default location, look at the file "C:/Program Files/Microsoft Visual Studio .NET 2003/Common7/Packages/Debugger/autoexp.dat".
The comments in this file make it clear how to add entries for your own classes. You can even modify how STL data appears during debugging.

If you look at the equivalent autoexp.dat file in VS.NET 2005, you will see why the debug display is better for STL :)


The fromat autoexp.dat for VS.NET 2005 even supports complex enough functionality to display most of the boost classes.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this