FYI: debug build VC7


25-05-2007 10:21:40

Hi VC users,

this is just some information about my results in getting a debug build of Python-Ogre to track down a crash during application quiting, with some results. Use it to your benefits :)

I post my changes below, because i have made some other changes as well, which would make a patch file a bit messy. But i am willing to make a patch against a clean checkout, so please let me know when the steps below are not clear enough.

Step 1

In order to switch between debug- and release builds, i added a 'config' field to the file, like:

config = 'Debug'

And replaced each occurence of 'Release' with that config setting. For example
os.path.join ( PATH_CEGUI, 'lib/Release' )
os.path.join ( PATH_CEGUI, 'lib/%s' %config )

Step 2

The second step is to modify the file as well, by adding a postfix variable like:

postfix = '_d'

and change all 'libs' lists by replacing for example
libs=[Config.LIB_Boost, 'OgreMain']
libs=[Config.LIB_Boost, 'OgreMain%s' %postfix]

I did the same for the 'externalFiles' lists, but i don't think they are used by the compiler because when writing this down i noticed an error in my file ;)

Step 3
Finally, open SConstruct (scons file) and add a '/Zi' option to the CCFLAGS. Can also be done with a same helper string as used above.

After compiling (takes a while!) and running 'python install' i manually had to copy over my DLLs to the site packages directory, but i am not sure if that's okay. Or should '' handle those?

Now when running and you get a crash or an assert, you will first see the VC message box. When you choose 'retry' you will get a windows crash dialog for Python.exe. Choosing 'find errors' (the left button) gets you into VC. This will start with the Python.exe process but on continuing it will open up an Ogre file or something. Of course you can also launch your game and attach the debugger to Python.exe and put breakpoint in all or your used C++ code. Works like a charm :)