Author Topic: Debuging build inconsistent with Compile & Run  (Read 5407 times)

Impaler[WrG]

  • Guest
Debuging build inconsistent with Compile & Run
« on: April 22, 2009, 12:51:49 pm »
I'm working on a OpenGL engine that's being developed with Code Blocks and GCC, and I've got a bizarre problem.  When I do a Debug build and step through the code I get one behavior from the program but when I do a Compile & Run or Compile and then separately run the SAME Debug build I get different behavior, major pieces of geometry have been initialized and flagged differently preventing them from rendering and I can't figure out why if my Debug build isn't giving me consistent behavior.  I've tried Cleaning the whole project and rebuilding from scratch, and I'm using only the Debug build (not any other Target) which has only -g set for Options and no Options on the root Project build.  The Project code is in Source Forge at https://sourceforge.net/projects/khazad/ if anyone wants to have a look.

Long time Code Blocks user, first time poster, thanks in advance

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Debuging build inconsistent with Compile & Run
« Reply #1 on: April 22, 2009, 05:03:03 pm »
I get different behavior
Nove: The memory footprint is different between the release and debug build. "Positioning" of variables in memory results therefore in different memory addresses -> thus, their initial value is different. This most likely is the cause of your problem.

Make sure you properly initialise *all* variables. You cannot rely on a certain default value being set at creation time.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Impaler[WrG]

  • Guest
Re: Debuging build inconsistent with Compile & Run
« Reply #2 on: April 22, 2009, 09:02:33 pm »
That seems to have worked, thanks for the assistance MortenMacFly  :D