Travis
Travis

Reputation: 659

Start debugger in c++ code

I am trying to debug some problems in a native C++ COM DLL I have created and would like to launch the Visual Studio (2008) debugger from this. This dll is called by another dll that I was given, so basically my code plugs into another application through this. Anyway, in the past I had used C# to create this dll and was able to use the System.Diagnostics.Debugger.Break() method. Is there anything similar to this that can be used? I saw a few posts about DebugBreak and __debugbreak but this did not seem to work, it just appeared to stop my code from executing beyond that statement.

EDT: I followed the advice of paulsm4 below and found that the breakpoints did not work, it would tell me: "The breakpoint will not currently be hit. No Symbols have been loaded for this document"

Upvotes: 1

Views: 3979

Answers (1)

paulsm4
paulsm4

Reputation: 121849

Ideally, you'll have the project source for your COM/ActiveX .dll.

If that's the case, just set a break point in your .dll code, run your program in the debugger ... and that's it.

Please note the distinction between "managed code" (e.g. a C#/.net .exe or .dll) and "native code" (like your COM/ActiveX .dll). To debug "native code" under MSVS2008, you'll need to specify "mixed mode":

http://msdn.microsoft.com/en-us/library/kbaht4dh%28v=vs.90%29.aspx

Upvotes: 1

Related Questions