Debug Console?!

Get answers to all your basic programming questions. No Ogre questions, please!
WanabeCoder
Kobold
Posts: 26
Joined: Sun Jan 09, 2005 11:04 pm

Debug Console?!

Post by WanabeCoder »

Erm.. how can I debug my program if I can't compile it? >.>
(visual c++ 6.0 std)
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia

Post by monster »

you can't
User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark

Post by DWORD »

Erm.. you can't! But I guess you want to fix it, so it can compile. Look at the error messages that the compiler throws at you, and if you can't figure them out, try posting them.
WanabeCoder
Kobold
Posts: 26
Joined: Sun Jan 09, 2005 11:04 pm

Post by WanabeCoder »

Well.. how teh (word) do I enter /Zm800 if I cant type it in debug >_>

Edit : And whats the point of debugging if your program can compile?
Ugh.. microsoft sucks.
Linux++; :|
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia

Post by monster »

to fix bugs
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 8

Post by haffax »

Don't make uneducated guesses about Linux' abilities. Debugging Ogre and programs using it, is much, much easier and more comfortable under Windows.
Your problem is probably VC6, a seven year old IDE/compiler. Compare it with the tools you had in Linux seven years ago.

Go buy a new one, like VC.Net2003 or wait for VC.Net2005.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 538

Post by Kojack »

If your program compiles, that just means that the compiler could compile your code (no syntax errors), it doesn't mean that the end result will do what you want.
Debugging is fixing flaws in a program which cause it to run incorrectly (wrong results, memory leaks, crashes, etc).

Been a while since I've had VC6 installed, but it should be possible to add the /Zm option to the project properties (I'm positive it had an "Additional Options" text box like VS.Net does).


What's really fun is debugging a program on a freaky OS, with a crappy compiler, with no debugger, when the bug is that the program suddenly dies after around 40 hours of continuous running. :)
Stress*=1000.0f;
User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

Kojack wrote: What's really fun is debugging a program on a freaky OS, with a crappy compiler, with no debugger, when the bug is that the program suddenly dies after around 40 hours of continuous running. :)
Stress*=1000.0f;
Looks like a float exponent overflow :-)
AssiDragon
Greenskin
Posts: 145
Joined: Wed Apr 28, 2004 12:10 pm
Location: Hungary

Post by AssiDragon »

Corruption errors are also nice to debug. Sometimes they appear, sometimes not... :?
Hope is the first step on the road to disappointment.
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia

Post by monster »

MSVC's difference between debug and release modes; bugs you don't see in debug do appear in release, but obviously then you can't debug them, arrrgh!
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 8

Post by haffax »

monster wrote:MSVC's difference between debug and release modes; bugs you don't see in debug do appear in release, but obviously then you can't debug them, arrrgh!
These are most often missing initializations, maybe malloc/new/whatsoever memset it to zero beforehand.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia

Post by monster »

i know, but it's very annoying
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 538

Post by Kojack »

A few times recently I've encountered bugs which don't occur in release, don't occur in an F5 run in debug mode, but crash the game every time in a Ctrl-F5 run in debug mode. Tricky, since an F5 run is the one that shows you where errors occur. :)
When freaky stuff like that happens, first thing I tell the students to do is Rebuild All. :) You'd be surprised (or not) how many times that fixes bugs (especially things like stack corruptions or when single stepping jumps around in abnormal ways), Visual Studio tends to forget to recompile files which need to recompiled.

The main thing to remember between debug and release runs is that in debug, all allocated memory is filled with special values, but in release mode it's just got whatever was already there in memory (ie. random stuff).
alphabeta
Kobold
Posts: 34
Joined: Mon Jan 03, 2005 5:07 am

Post by alphabeta »

Debugging is just the act of going step by step through a program to find what's causing a problem, which obviously can't happen if the program won't compile (much less run) :wink:
Look at the errors your compiler throws at you. Try vs2005 betas if you need a new ide, but keep in mind with visual studio, the ide has ABSOLUTELY NO IDEA about the real importance of errors. It's prioritization will lead you in loops, so take a look at the order in the output window once in a while (fixing the first error might fix all 165 :) )
User avatar
epopov
Halfling
Posts: 85
Joined: Tue Jun 10, 2003 2:57 pm

Post by epopov »

monster wrote:MSVC's difference between debug and release modes; bugs you don't see in debug do appear in release, but obviously then you can't debug them, arrrgh!
Yes you can, you just have to enable the building of .pdb files (one option to check on the C++ tab and another in the link tab, I think).
It's not as easy as in debug mode to debug in release mode because of some optimisations performed by the compiler that can reorder lines or group several source lines in one 'assembly block', but having the source code at hand is definitively better than dealing with the raw assembly !
User avatar
zarthrag
Greenskin
Posts: 128
Joined: Sat Jul 24, 2004 9:07 am
Location: Tulsa, Oklahoma

Post by zarthrag »

Most compilers take a turn for the worse when you (ab)use templates. If I had a dollar for everytime VS7.1 iced over (ICE = Internal Compiler Error; a really cryptic error handed to you when you're too good of a day.)