Watching functions with Debug.dll

Ferocca

Warlord
Joined
Nov 21, 2011
Messages
179
I've got a quick question; how can you watch functions etc. with your debug dll?
I thought that was possible. At the moment I can only watch functions that crash the game, but the error I'm trying to fix does not crash the game, so I have to see which functions it uses otherwise I have no idea where in the SDK the mistake is. Thanks:)
 
You can set a breakpoint wherever you need to by clicking on the margin-like area to the left of the line of code (it should get marked with a red dot over there for an active breakpoint). Typically in something that you know should be run shortly before the problem starts and hopefully somewhere that is not going to be hit a billion times by other things which happen before you get to what it is you are trying to look at.

When it gets to the breakpoint it will stop executing and let you look around and manually advance the execution of the code (i.e. step to the next line "over" a function, step into the function being called, step to the end of the current function, and so on - the usual stuff). It's pretty much the same as when it breaks from an error, except there was no error (yet) so stepping through the code should work fine until you hit the part with the problem and all of the variables should hold valid values (unless something has already gone wrong but not yet caused a problem).
 
I am also trying to use some breakpoints to debug some code, and I'm running into trouble. I've successfully compiled a debug .dll but when I use VS2008 to debug, I get this message: "The breakpoint will not currently be hit. No symbols have been loaded for this document. "

Anyone point me in the right direction to get this working?
 
In addition to copying the debug .dll file into the mod's Assets folder, you need to also copy the .pdb file from the same place as the DLL to the same Assets folder location. That file holds all of the "symbol" related stuff - the things that match up what is in the binary code to what is in the source code.
 
I've run into a strange problem where I am getting a "No Source Available", "No symbols are loaded for any call stack frame" error in Visual C++ 2010 when attempting to debug. I can't access the Call Stack at all. I have the debug .dll and the .pdb file in the Assets folder of the mod.

Does anyone know why I might be encountering this behavior? By all indication I should be able to view the call stack for CvGameCoreDLL.dll, but I am unable to.
 
I once got this error when I tried to debug a dll that hasn't been compiled with the present source code. The odd thing was that there was actually no difference between the present source and the one used to compile the dll. So, although this seem obvious and you most likely did this, you may try to recompile the dll to ensure that source and dll match.
 
Hi Ripple
Had a similar issue debugging Civ5 today. If you get the red blob that for sure means that the symbol database is linked with the DLL you are running. Also check the output to see what the debugger is saying. It should in a round about way say that it has found your DLL. If the call stack output is empty, that just means that the code has not hit your break point.

Another weird thing is that in Civ5 I can debug the release version, but in Civ4 I could only ever use breakpoints when I compiled it as a debug build. Hope that helps.
 
I have recently come back to try and solve this issue, but am still running into a brick wall. I've tried compiling in VS 2008 and 2010. I can successfully compile a debug .dll, and I copy it and the .pdb file into my mod's Assets directory. However, I still get messages when debugging saying the symbols are not loaded, and I can't do any meaningful debugging without the call stack and other debugging tools. Can anyone please help? I'm about at wits end.
 
Hi Ripple been a long time hope you are well if not frustrated (normal for modders). It has been a long time for me as well. Over the next few weeks I intend to compile RevDCM290 so I should be able to get back into the swing. In the meantime, did you attach first before you start debugging? I'm not sure how 2010 works but in 2008 I used to start the mod then "attach to process" first. Then the symbols would load (but yes it can be fickle if something breaks down in the process). Once I fire up the project again I can be of more help. Somebody wants me to do a build of RevDCM300 so I should get back into the swing too.
 
The .pdb is not required to be in the Civ folder hierarchy anywhere, VS will use the location of the one it created when you compiled the source.

I have only seen this when I had inadvertently placed the wrong dll in the Assets folder so it didn't match what was loaded in VS, but you state that you have double checked that already.

How are you attaching VS to Civ? I know you can have Civ start from within VS and attach it that way, but I have always started Civ independently and used the "Debug -> Attach to Process" menu option from VS.

Does VS indicate that it has attached successfully? I am using VS2012 which has the attached process name just under the toolbar on the left, but 2010 may be different.
 
I've tried the Attach to Process way as well and I'm still getting the same problem.

It seems that it is attached successfully. I've attached a screenshot.

One thing to mention: I am running the Win7 installation under Parallels in Mac OS X. I doubt that is the problem, but I thought I'd mention it.
 

Attachments

  • Screen Shot 2014-10-23 at 10.26.14 AM.png
    Screen Shot 2014-10-23 at 10.26.14 AM.png
    287.2 KB · Views: 81
Back
Top Bottom