.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Programming
General Programming Help others and get yourself helped here!

Reply
 
Thread Tools
I got a MSVC debugging question too....
Old
  (#1)
Maleficus
Member
 
Maleficus's Avatar
 
Status: Offline
Posts: 1,054
Join Date: May 2004
Location: Planet Earth
Default I got a MSVC debugging question too.... - 18-09-2004

I'm having a problem where the "release" build of my code will randomly crash after a while (completely random - or so it seems), but my "debug" builds can run day and night with no problems.

I know its probably a variable I didn't initialize properly, but the question is WHERE.

I've added SO much bot code, and modified so much of the game code since the last release, thats its like finding a needle in a haystack. I checked the option to create "debug" info in the release build, and now when it crashes it lets me see what function it crashed in (just the function name, then the assembly code), but that doesn't help - this function is called EVERYWHERE, but both my code and the game code. I've checked the call stack to see which functions ran last, but its just not giving enough info: it looks like its skipping functions that should have run in between what the call stack info shows.

Is there an easy way to find where a bug is in a release build? Its creeping up on 2 in the morning here and I just feel like I'm missing something.........


Dum Spiro Spero



Last edited by Maleficus; 18-09-2004 at 09:23..
  
Reply With Quote
Re: I got a MSVC debugging question too....
Old
  (#2)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: I got a MSVC debugging question too.... - 18-09-2004

maybe it can be a memory leak that causes the error to be show like it came from somewhere else.. if not you should add whatever code to try and prevent the crash or add "_asm {int 3};" right before where it crashes and run in debug mode then follow through the assembly code as it runs 1 step at a time..
[edit]
another possibility is that you got stuff like #ifdef _DEBUG #endif..
maybe you got some stuff-that-should-go-inside those things, outside.. or something-that-goes-outside, inside...
[/edit]

Last edited by sPlOrYgOn; 18-09-2004 at 09:26..
  
Reply With Quote
Re: I got a MSVC debugging question too....
Old
  (#3)
Maleficus
Member
 
Maleficus's Avatar
 
Status: Offline
Posts: 1,054
Join Date: May 2004
Location: Planet Earth
Default Re: I got a MSVC debugging question too.... - 18-09-2004

But wouldn't a memory leak show up in a debug build too? Like I said - the debug build is rock solid, it will run for hours and no problems.


Dum Spiro Spero


  
Reply With Quote
Re: I got a MSVC debugging question too....
Old
  (#4)
Maleficus
Member
 
Maleficus's Avatar
 
Status: Offline
Posts: 1,054
Join Date: May 2004
Location: Planet Earth
Default Re: I got a MSVC debugging question too.... - 18-09-2004

Checked my _DEBUG defines, didn't see anything amiss.

I've been checking all my variables, but nothing so far.


Dum Spiro Spero


  
Reply With Quote
Re: I got a MSVC debugging question too....
Old
  (#5)
Maleficus
Member
 
Maleficus's Avatar
 
Status: Offline
Posts: 1,054
Join Date: May 2004
Location: Planet Earth
Default Re: I got a MSVC debugging question too.... - 18-09-2004

btw: heres the call stack info

QAGAME_MP_X86! Distance + 13 bytes
QAGAME_MP_X86! Mal_AI_NodeMoveToGoal + 39 bytes
QAGAME_MP_X86! MAL_AI_FindLTG + 130 bytes
QAGAME_MP_X86! Mal_BotAIStartFrame + 179 bytes
QAGAME_MP_X86! G_RunFrame + 760 bytes
QAGAME_MP_X86! vmMain + 176 bytes
WOLFMP! 00441ad2()
WOLFMP! 00445bc0()
KERNEL32! bff7b9e4()
KERNEL32! bff7b896()
KERNEL32! bff7a24f()




vmmain and Runframe are the not mine, they are the main functions in the game code. Distance is just a function that returns the vector lenth of a vector. Its used everywhere. From this, it appears nodemovetogoal was the function that called distance, and caused the crashed, but I've checked whats being passed to distance from that function, and its not invalid. The crash is somewhere else, I think - yet.... it ALWAYS says it happened here!

Hmm.


ALSO - there about half a dozen different functions that are run before the node movement code is called, but they don't appear in the call stack list.


Dum Spiro Spero



Last edited by Maleficus; 18-09-2004 at 09:57..
  
Reply With Quote
Re: I got a MSVC debugging question too....
Old
  (#6)
Rick
Council Member
 
Rick's Avatar
 
Status: Offline
Posts: 690
Join Date: Dec 2003
Location: Holland
Default Re: I got a MSVC debugging question too.... - 18-09-2004

There is an option to enable auto setting variabeles to 0, you could search the name of the option on MSDN and disable it with debug mode
  
Reply With Quote
Re: I got a MSVC debugging question too....
Old
  (#7)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: I got a MSVC debugging question too.... - 18-09-2004

Hahaha, I know that.

The difference in MSVC between DEBUG builds and RELEASE builds, is that when you allocate new variables or memory stuff, MSVC automatically zeroes it out when it's compiled with DEBUG. In RELEASE, your variables are all uninitialized, i.e in unknown state.

Memset all your arrays & buffers, I bet that's it



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: I got a MSVC debugging question too....
Old
  (#8)
koraX
Member
 
koraX's Avatar
 
Status: Offline
Posts: 145
Join Date: Jan 2004
Location: Slovak Republic
Default Re: I got a MSVC debugging question too.... - 18-09-2004

also in DEBUG mode, MSVC allocates more memory for arrays than needed, usually one more element. That is because of zero indexing.
If you create int a[3]; and then access fourth element a[3]=1;, it won't cause access violation in DEBUG mode.


kXBot
koraX's utils
- see my homepage for other projects (OpenGL CSG Editor, FAT16 Sim, NNetwork Sim, ...)
  
Reply With Quote
Re: I got a MSVC debugging question too....
Old
  (#9)
Rick
Council Member
 
Rick's Avatar
 
Status: Offline
Posts: 690
Join Date: Dec 2003
Location: Holland
Default Re: I got a MSVC debugging question too.... - 18-09-2004

Quote:
Originally Posted by Pierre-Marie Baty
Hahaha, I know that.

The difference in MSVC between DEBUG builds and RELEASE builds, is that when you allocate new variables or memory stuff, MSVC automatically zeroes it out when it's compiled with DEBUG. In RELEASE, your variables are all uninitialized, i.e in unknown state.

Memset all your arrays & buffers, I bet that's it
yes....So if you disable this in debug mode perhaps you can find out where the problem is...
  
Reply With Quote
Re: I got a MSVC debugging question too....
Old
  (#10)
Maleficus
Member
 
Maleficus's Avatar
 
Status: Offline
Posts: 1,054
Join Date: May 2004
Location: Planet Earth
Default Re: I got a MSVC debugging question too.... - 20-09-2004

Quote:
Originally Posted by Rick
yes....So if you disable this in debug mode perhaps you can find out where the problem is...
Good idea - now to find out what that option is. I'm searching thru online MSDN, but have never found their help very... helpful.


Dum Spiro Spero


  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com