Debugging the code

Jorgen_CAB

Warlord
Joined
Feb 11, 2004
Messages
132
Location
Sweden
Are there anyone here who know a how to debug the code, I have tried and failed every time. Both through the debug mode directly in Visual Studio 2003 and as an external process attached, but I don't seem to register.

I created the debug dll and started the game and got a message that said something was wrong loading the python part then the game start, I attach Visual Studio to the CivIV process but still I can't seem to get any breakpoint from the dll.
 
Jorgen_CAB said:
Are there anyone here who know a how to debug the code, I have tried and failed every time. Both through the debug mode directly in Visual Studio 2003 and as an external process attached, but I don't seem to register.

I created the debug dll and started the game and got a message that said something was wrong loading the python part then the game start, I attach Visual Studio to the CivIV process but still I can't seem to get any breakpoint from the dll.
Hmmm... strange..
I am doing my debugging just exactly same way as you said. i.e. Running the Civ4 exe and attaching to the process using the MSVS 2003 VC++ Debug/Process.. menu.. But I have no problem in setting break point or proving variables or single stepping in the source code.
Did the DLL include proper Debugging inforamtion? It can be set in the Project Property menu. (/Zi) and DLL size will be around 8-9 MB. Or you may be setting break point in wrong place or your code may not be executed at all. It should be properly initialized and called from anywhere from the existing code.
Faulty python mod or even faulty xml file may hinder debugging. Many Assert failure message box will pop up with faulty XML or python code. Start with clean installation ( No python mod or modded xml) and add one by one until you find same fault.
 
Ok, my debug file is nearly 12MB large, where do you insert the (Zi) switch... this is not my area really... I have had no problem doing debugging at work before.
 
Ok, my debug file is nearly 12MB large, where do you insert the (Zi) switch... this is not my area really... I have had no problem doing debugging at work before.

Thew command line look like this

/OUT:"../Assets/CvGameCoreDLL_DEBUG.dll" /INCREMENTAL /NOLOGO /LIBPATH:"Python24\libs" /LIBPATH:"boost-1.32.0\libs\\" /DLL /NODEFAULTLIB:"msvcprtd.lib" /DEBUG /PDB:"Debug/CvGameCoreDLL_DEBUG.pdb" /SUBSYSTEM:WINDOWS /IMPLIB:"Debug/CvGameCoreDLL.lib" /MACHINE:X86 boost_python-vc71-mt-gd-1_32.lib winmm.lib msvcprt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ".\Boost-1.32.0\libs\boost_python-vc71-mt-gd-1_32.lib"
 
You need to change the output file. Right now it has the wrong filename and is probably being placed in the wrong directory. The correct filename will be CvGameCoreDLL.dll I think. You probably want to specify the absolute path to a Mod direcory or maybe the customassets directory.

Daniel
 
Thats not a problem, I just grab the file rename it and place it where I want to have it. The game starts and use the file as intended, I just don't seem to be able to do any debugging with it. I also get that annoying error message that tells me the python part is not correctly loaded (the dll that is).
 
I'm pretty sure that for debugging to work, copying and renaming the file is not good enough. Try modifying the project properties so that it outputs directly to the DLL Civ4 will load. I don't know anything about the annoying error message you mention though, so that also might be part of the problem.

Daniel
 
Top Bottom