P3D v3 Breakpoint will not be hit, debugging dll gauge VS2015

#1
Hi there,

I'm just getting into the world of aircraft dev and I'm playing around with making some instruments using c++ and Direct2D in Visual Studio Community 2015.

I'm trying to debug my gauge in P3Dv3 but when I
-set a breakpoint,
-build the solution (I've tried copying the .dll to the gauges folder and the entire debug output to the gauges folder)
-open P3Dv3
-select default AC
-Attach to process Prepar3D.exe

The breakpoint turns grey and hovering over it reveals: "The breakpoint will not currently be hit. No symbols have been loaded for this document."

Google returns a lot of suggestions about not set debugging flags. Has anyone experienced this with fsx/p3d?
 
#3
Your gauge has to be loaded by an aircraft.
Ah ok.
Now I've loaded the aircraft (the gauge is defined in the panel cfg and the gauge draws on the display so it is being loaded and works correctly).

If I Debug > Attach to Process :prepar3D.exe before I load the aircraft or after I load the aircraft (doesn't seem to matter), the breakpoint still turns grey and says it won't be hit. The gauge doesn't stop and it continues to draw and update in p3d.

Here's an image of VS if it helps.



Is that the correct steps? I was going by this post

Cheers,

Nick
 
Last edited:

JB3DG

Resource contributor
#4
Check and make sure when attaching the debugger that your debugging mode is set to "Native" not "Managed".
 
#5
Check and make sure when attaching the debugger that your debugging mode is set to "Native" not "Managed".
Unfortunately it's still the same result. I notice the Prepar3d.exe type is Managed though... is that the same for you?



I did get the breakpoint to not turn grey once by attaching to process when I already had the aircraft loaded.....but then the sim crashed. I imagine that's what it's supposed to do? :)
 

JB3DG

Resource contributor
#6
The breakpoint will only go solid when your aircraft is loaded. The other thing to make double sure about is that you are using the latest module for your source code. And yes the P3D type is managed but your code is not managed and so the debugger must be set to native. Also, depending on the type of error that caused the crash, you can go into the Debug menu->Exceptions and enable break on that particular exception so it can show you which line of code is causing the crash.
 

JB3DG

Resource contributor
#7
The other alternative is to view the active modules list, find your dll, and try to manually load the pdb symbols file for it (should be in the same location as your build folder).
 
#9
Of course, you'll need to set the target folder for the compiled Gauge to the actual Gauge folder used by that airplane in FSX.
Try to set Project Settings in VS for General -> OutputDirectory to your gauges folder. After project build check that there are *.pdb near the dll itself.
Also try to set breakpoint as early as possible in your code.
 
Top