Afforess
The White Wizard
This thread is meant mainly for 45* and myself, and anyone else familiar with the SDK and Visual Studio.
So what I have discovered coming back to RAND 2 is that I can't do any real time debugging with the Debug DLL. When the debug DLL is built, it doesn't include many optimizations made in the release DLLs and includes debugging symbols, which allow real-time inspection of the code.
Normally, to debug BTS, you build a debug DLL, replace the existing DLL in the mod, and launch the game. Once the game starts loading (either XML or at the main menu, both work) you can use the Visual Studio option to attach a debugger to a process, and select the Civ4BeyondTheSword.exe to debug. While attached, you can set breakpoints, which will pause the game and let you debug, and the game will jump to code if an exception is thrown (normally an exception causes the game to crash). I first thought my setup was to blame. I was using Visual Studio 2008 Express, but I went and installed Visual Studio 2013 Ultimate Edition (I have the license key, yay) and set it up to build civ4 DLL's. It has exactly the same problem.
So right now when I attach Visual Studio to the process, I see the normal debug window console output. But if I attempt to set a breakpoint and debug, or encounter an exception, the game crashes immediately, without jumping to the debugger. This makes the debugger fairly useless.
I'm not sure what changes occurred to break this process. I know debugging worked fine when I left (rev571).
This is currently a week of final exams for me, so I can't really help until this coming weekend. If 45* or another wants to look into this, here is how I suggest they tackle the problem:
Load revision 571 of RAND, build a fresh debug dll, copy that into the mod, and start a new game, and set a breakpoint at the beginning of "void CvGame::doTurn()", which should cause the debugger to pause at each turn. If that works, we know the revision is good. (I highly recommend you use windowed mode while using the debugger, otherwise alt-tab gets annoying)
Then preform a binary search on the revisions since then. Revision 635 is about half way between now and then. Try and see if debugging works there. If so, check at the half-way point between 635 and 700. If not, check the half-way point between 571 and 635. It should only take 5-10 attempts to find the revision that breaks it. Once we determine that, we can figure out where to go from there.
So what I have discovered coming back to RAND 2 is that I can't do any real time debugging with the Debug DLL. When the debug DLL is built, it doesn't include many optimizations made in the release DLLs and includes debugging symbols, which allow real-time inspection of the code.
Normally, to debug BTS, you build a debug DLL, replace the existing DLL in the mod, and launch the game. Once the game starts loading (either XML or at the main menu, both work) you can use the Visual Studio option to attach a debugger to a process, and select the Civ4BeyondTheSword.exe to debug. While attached, you can set breakpoints, which will pause the game and let you debug, and the game will jump to code if an exception is thrown (normally an exception causes the game to crash). I first thought my setup was to blame. I was using Visual Studio 2008 Express, but I went and installed Visual Studio 2013 Ultimate Edition (I have the license key, yay) and set it up to build civ4 DLL's. It has exactly the same problem.
So right now when I attach Visual Studio to the process, I see the normal debug window console output. But if I attempt to set a breakpoint and debug, or encounter an exception, the game crashes immediately, without jumping to the debugger. This makes the debugger fairly useless.
I'm not sure what changes occurred to break this process. I know debugging worked fine when I left (rev571).
This is currently a week of final exams for me, so I can't really help until this coming weekend. If 45* or another wants to look into this, here is how I suggest they tackle the problem:
Load revision 571 of RAND, build a fresh debug dll, copy that into the mod, and start a new game, and set a breakpoint at the beginning of "void CvGame::doTurn()", which should cause the debugger to pause at each turn. If that works, we know the revision is good. (I highly recommend you use windowed mode while using the debugger, otherwise alt-tab gets annoying)
Then preform a binary search on the revisions since then. Revision 635 is about half way between now and then. Try and see if debugging works there. If so, check at the half-way point between 635 and 700. If not, check the half-way point between 571 and 635. It should only take 5-10 attempts to find the revision that breaks it. Once we determine that, we can figure out where to go from there.