Custom Debug Engine - Help with debug generated source in custom debug engine & IDebugActivateDocumentEvent2 event
-
2012年7月24日 18:47
Hi,
I have a custom debug engine working in Visual Studio,
I have been showing the current file to debug, by creating a temporal file in the file system then setting its full path.
But now I want to generate the file dynamically (I already have a custom editor for Visual Studio that can edit that kind of files).
However, doesn't seem to work (while starting debug session a window opens up, stating the no source was found, even though I can go on pressing F11 to step into, see locals, etc.).
So the changes I have done so far are:
- I returned the file in call IDebugDocument2.GetName(enum_GETNAME_TYPE gnType, out string pbstrFileName)
(also tried filtering to just return it when ((gnType == enum_GETNAME_TYPE.GN_MONIKERNAME) || (gnType == enum_GETNAME_TYPE.GN_URL)) but didn't work).
- I am also returning the name (moniker) in the call int IDebugStackFrame2.GetName(out string pbstrName).
- I am sending the implementation of IDebugActivateDocumentEvent2 event in the constructor of the class IDebugStackFrame2
(I am not sure from where to send that event, documentation is not clear, by stack frames are created after every step, so seems right to put it there).
- Also I found the following info in the documentation:
http://msdn.microsoft.com/en-us/library/bb145153.aspx (IDebugDocument2).
Visual Studio typically implements this interface. A debug engine (DE) can also implement this interface when it needs to supply the source code
and the source does not exist on disk. In such cases, the DE would also implement IDebugDocumentContext2 and IDebugActivateDocumentEvent2 interfaces,
as well as some additional methods on the IDebugDisassemblyStream2 and IDebugDocumentPosition2 interfaces.
I am already implementing IDebugDocument2, IDebugDocumentContext2 & IDebugActivateDocumentEvent2, not implementing IDebugDisassemblyStream2 neither IDebugDocumentPosition2
(although for IDebugDocumentPosition2 I get an already created one in IDebugPendingBreakpoint2.Bind() with IDebugDocumentPosition2 docPosition = (IDebugDocumentPosition2)(Marshal.GetObjectForIUnknown(_bpRequestInfo.bpLocation.unionmember2)); ).
Do I need to implement the IDebugDisassemblyStream2 interface? If that is the case I may be missing something else, because I don't see a call to IDebugProgram2.GetDisassemblyStream
in my logs.
Here's a relevant chunk of the log of AD7 calls:
AD7Engine ResumeProcess
AD7ProgramNode: Entering GetHostPid
AD7ProgramNode: Entering GetEngineInfo
AD7ProgramNode: Entering OnAttach
AD7Engine Attach
Event EngineCreated
AD7Breakpoint: ctor
Event ProgramCreated
Event EngineLoaded
Event DebugEntryPoint
AD7Engine GetEngineId
AD7ProgramNode: Entering GetProgramId
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetHostName
AD7ProgramNode: Entering CanDetach
AD7ProgramNode: Entering CanDetach
AD7ProgramNode: Entering GetThreadId
AD7ProgramNode: Entering GetHostName
AD7ProgramNode: Entering GetHostName
AD7ProgramNode: Entering EnumFrameInfo
AD7StackFrameCollection: ctor
AD7StackFrame: ctor
AD7DocumentContext: ctor
Event DebugActivateDocumentEvent
AD7StackFrameCollection: Next
AD7StackFrameCollection: Reset
AD7StackFrameCollection: Next
AD7ProgramNode: Entering GetThreadId
AD7ProgramNode: Entering GetThreadId
AD7ProgramNode: Entering EnumThreads
AD7ProgramNode: Entering GetCount
AD7ProgramNode: Entering Next
AD7ProgramNode: Entering GetThreadId
AD7ProgramNode: Entering GetThreadId
AD7ProgramNode: Entering GetThreadId
AD7StackFrameCollection: GetCount
AD7StackFrameCollection: Reset
AD7StackFrameCollection: Next
AD7StackFrame: GetCodeContext
AD7ProgramNode: Entering GetThreadProperties
AD7ProgramNode: Entering GetThreadId
AD7StackFrame: GetLanguageInfo
AD7StackFrame: GetCodeContext
AD7StackFrame: GetDocumentContext
AD7StackFrame: GetInfo
AD7DocumentContext: GetStatementRange
AD7DocumentContext: GetName
AD7DocumentContext: GetInfo
AD7DocumentContext: GetLanguageInfo
AD7ProgramNode: Entering CanSetNextStatement
AD7DocumentContext: GetDocument
AD7DocumentContext: GetName
AD7DocumentContext: GetName
AD7StackFrame: GetInfo
AD7StackFrameCollection: Reset
AD7StackFrameCollection: Next
AD7StackFrame: GetInfo
AD7StackFrame: GetDocumentContext
AD7StackFrame: GetCodeContext
AD7StackFrame: GetLanguageInfo
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetThreadProperties
AD7ProgramNode: Entering GetThreadProperties
AD7ProgramNode: Entering GetThreadId
AD7StackFrameCollection: Reset
AD7StackFrameCollection: Next
AD7StackFrame: GetCodeContext
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetName
AD7StackFrame: EnumProperties
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetName
AD7ProgramNode: Entering GetThreadIdThanks.
全部回复
-
2012年7月25日 8:41版主
Hi Fernando,
I am not familiar with Debug Engine.
I try to learn it from:http://msdn.microsoft.com/en-us/library/bb145934
There are too much to learn. I can't get it very clearly.
I think your issue focus on choosing how to attach the program which you can refer to
http://msdn.microsoft.com/en-us/library/bb147141
If I missed your purpose, please feel free to let us know.
Best regards,
Ego [MSFT]
MSDN Community Support | Feedback to us
-
2012年8月3日 8:02版主
Hi Fernando,
Is your issue solved now?
Best regards,
Ego [MSFT]
MSDN Community Support | Feedback to us

