Start a new topic

Problems debugging

Original Post by: jrhea Wed Feb 1 18:12:14 2012


I am using MS Visual Studio 2008 and C++. When I try to debug, the mgOpenDb command fails. Is there a trick to getting the debugger to work with the OpenFlight API?


Original Post by: jrhea Thu Feb 2 20:52:16 2012


This is odd, but I copied over the release Dlls and it started working all of the sudden. Something you had me try made it start working...I am still scratching my head though. Thanks for your help.

Original Post by: SteveThompson Thu Feb 2 00:52:32 2012


Is there a chance you could send us the OpenFlight file to see if we can reproduce the problem here at Presagis? (with all textures and x-refs if any)


Also have you tried other (very simple) files? Curious if this really has something to do with the file you are trying to open or does it happen on any db...

Original Post by: jrhea Thu Feb 2 00:41:24 2012


Yep it is a stand alone app


Environment:


OS: Windows XP 64bit

Open Flight v4.2.0

I am actually using the release version of the DLLs

Original Post by: SteveThompson Wed Feb 1 20:44:18 2012


If I run it with the debugger attached (ie I press the little green arrow that has the tooltip “Start Debugging”) then it fails to load the flt file.

That is very strange. I've not seen this happen before. Hmmm...

Can you give me some information about your environment? i.e.


I assumed that you are doing this in your stand alone program, not as a Creator plugin... right?


What version of the OpenFlight API are you using?


Are you running with the debug or release version of OpenFlight API DLLs?

Note: If debug, have you tried the release versions?


What Operating System?

Original Post by: jrhea Wed Feb 1 19:25:01 2012


If I run it with the debugger attached (ie I press the little green arrow that has the tooltip "Start Debugging") then it fails to load the flt file. If I run the executable from the command line (built with debug info) then it runs successfully. Furthermore, if I wait until AFTER it loads the flt file, I can successfully debug by manually attaching the debugger to the running process. The way I do that is by:


1) starting the exe from the command line

2) pressing Crtl-Alt-P (from within VS2008) and searching for the process to attach to

3) once I see that the flt file has been loaded (I wait for a print statement to appear), then I attach to the process


From there it works as normal.

Original Post by: SteveThompson Wed Feb 1 19:15:04 2012


Are you saying that if you run in debug mgOpenDb fails but if you run in release it succeeds?

Original Post by: jrhea Wed Feb 1 19:02:25 2012


Sorry...by fails I mean that this condition evaluates as true.


    

if (!(db = mgOpenDb(filename)))

{

printf("\nError in mgOpenDb(%s)\n",filename);

}

Basically, I can't load the flt file if the debugger is attached.


To reiterate what I put in my second post...."The only way I have been able to accomplish debugging is by waiting for the mgOpenDb command to finish THEN attaching to the process so I can debug it."


Thanks in advance

Original Post by: SteveThompson Wed Feb 1 18:31:42 2012


I am using MS Visual Studio 2008 and C++. When I try to debug, the mgOpenDb command fails. Is there a trick to getting the debugger to work with the OpenFlight API?


First, when you say mgOpenDb fails, do you mean it returns a bad status or crashes? If the latter, a common problem users have is not allocating enough stack space in their stand-alone applications. This thread discusses remedies that problem.

support/discussions/topics/1002


If you are simply getting a bad status return from mgOpenDb, there is no trick to debugging your app in Visual Studio. You should be able run your app from Visual Studio in debug mode. If you are asking if you can step into mgOpenDb, you cannot do that.


Is this your question?

Original Post by: jrhea Wed Feb 1 18:21:51 2012


The only way I have been able to accomplish debugging is by waiting for the mgOpenDb command to finish THEN attaching to the process so I can debug it. NOTE: it seems like this an only an issue for the first mgOpenDb command...??

Login to post a comment