Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3223 lines
120 KiB

  1. // ActivDbg.idl : ActiveX Debugging Interfaces
  2. /* Overview
  3. Active Debugging is a set of interfaces that allow language-neutral, host-neutral debugging,
  4. with support for a wide variety of development environments.
  5. <INSERT SRC="..\..\doc\figures.doc!Architecture">
  6. By <I> language neutral </I>, we mean that a debugging environment can support essentially any
  7. programming language, without having to have specific knowledge of that language
  8. built into the environment. (Today, the interfaces focus primarily on support
  9. scripting languages such as VBScript and JScript, as well as Java, but in the
  10. future we intended evolve them to support native code in languages such as C++.)
  11. Furthermore, the debugger automatically has the ability to debug applications
  12. written in a mixture of multiple languages, with cross-language stepping and
  13. breakpoints.
  14. By <I> host neutral </I>, we mean that the debugger can be automatically be used with any Active
  15. Scripting host, such as Internet Explorer, Spruuids, or any any other host written in
  16. the future. We also mean that the host has control over the structure of the document
  17. tree presented to the user and the contents and syntax coloring of the documents being
  18. debugged. This allows the host to present the source code being debugged in the context
  19. of the host document (for example, scripts can be show on an HTML page.)
  20. In the subsections below, we consider each of the key components in Active Debugging and
  21. their associated interfaces.
  22. Before proceeding further, we should define several key Active Debugging concepts:
  23. <I> host application: </I> The application that hosts the script engines and provides
  24. a scriptable set of objects (or "object model").
  25. <I> language engine: </I> A component that provides parsing, execution, and debugging
  26. abstractions for a particular languages.
  27. <I> debugger IDE: </I> The application that provides debugging UI by communicating with
  28. the host application and language engines.
  29. <I> machine debug manager: </I> A component that maintains a registry of debuggable
  30. application processes.
  31. <I> process debug manager: </I> A component that maintains the tree of debuggable documents
  32. a particular application, tracks the running threads, etc.
  33. <I> document context: </I> : A document context is an abstraction representing
  34. a specific range in the source code of a host document.
  35. <I> code context: </I> A code context represents a particular location in the running
  36. code of a language engine (a "virtual instruction pointer".)
  37. <I> expression context: </I> A particular context (for example, a stack frame) in which
  38. expressions may be evaluated by a language engine.
  39. <I> object browsing: </I> A structured, language-independent representation of an objects
  40. name, type, value, and subobjects, suitable for implementating a "watch window" UI.
  41. Below, we provide an overview of each of the key Active Debugging components
  42. and their associated interfaces, followed by the details of those interfaces.
  43. */
  44. // <HIDE>
  45. // Note to the reader: This IDL can be automatically transferred into a nicely
  46. // formatted Word document using a set of Word macros. Please contact [email protected]
  47. // for details on the macros that do this. The section you are now ready is excluded from the
  48. // Word doc because it's just boilerplate goop.
  49. cpp_quote("//=--------------------------------------------------------------------------=")
  50. cpp_quote("// ActivDbg.h")
  51. cpp_quote("//=--------------------------------------------------------------------------=")
  52. cpp_quote("// (C) Copyright 2000 Microsoft Corporation. All Rights Reserved.")
  53. cpp_quote("//")
  54. cpp_quote("// THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF")
  55. cpp_quote("// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO")
  56. cpp_quote("// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A")
  57. cpp_quote("// PARTICULAR PURPOSE.")
  58. cpp_quote("//=--------------------------------------------------------------------------=")
  59. cpp_quote("//")
  60. cpp_quote("#pragma comment(lib,\"uuid.lib\")")
  61. cpp_quote("//")
  62. cpp_quote("// Declarations for ActiveX Scripting authoring/Debugging.")
  63. cpp_quote("//")
  64. cpp_quote("")
  65. cpp_quote("#ifndef __ActivDbg_h")
  66. cpp_quote("#define __ActivDbg_h")
  67. cpp_quote("")
  68. #ifndef DO_NO_IMPORTS
  69. import "ocidl.idl";
  70. import "oleidl.idl";
  71. import "oaidl.idl";
  72. import "activscp.idl";
  73. import "dbgprop.idl";
  74. #endif
  75. #ifdef USER_TYPES
  76. #define BSTR UserBSTR
  77. #endif
  78. // </HIDE>
  79. /* <H2> Language Engine </H2>
  80. The language engine provides:
  81. - Language parsing and execution
  82. - Debugging support (breakpoints,etc..).
  83. - Expression evaluation.
  84. - Syntax coloring.
  85. - Object browsing.
  86. - Stack enumeration and parsing.
  87. Below is a list of the key interfaces implemented by a language engine. These interfaces
  88. are used by the host application to map between its document context and the engine's
  89. code contexts, and also by the debugger UI to do expression evaluation, stack enumeration,
  90. and object browsing.
  91. */
  92. interface IActiveScriptDebug32; // provides syntax coloring and code context enumeration (32bit PDM)
  93. interface IActiveScriptDebug64; // provides syntax coloring and code context enumeration (64bit PDM)
  94. interface IActiveScriptErrorDebug; // returns document contexts and stack frames for errors
  95. interface IActiveScriptSiteDebug32; // host provided link from script engine to debugger (32bit PDM)
  96. interface IActiveScriptSiteDebug64; // host provided link from script engine to debugger (64bit PDM)
  97. interface IActiveScriptTextInfo;
  98. // Language engine debugging abstractions
  99. interface IDebugCodeContext; // a virtual "instruction pointer" in a thread
  100. interface IEnumDebugCodeContexts;
  101. interface IDebugStackFrame; // logical stack frame on the stack of a thread
  102. interface IDebugExpressionContext; // a context in which expressions can be evaluated.
  103. interface IDebugStackFrameSniffer; // enumerator for stack frames known by an engine
  104. // Asynchronous Expression Evaluation
  105. interface IDebugExpressionContext; // context for expression evaluation
  106. interface IDebugExpression; // an asynchronously evaluated expression
  107. interface IDebugSyncOperation;
  108. interface IDebugAsyncOperation;
  109. interface IDebugAsyncOperationCallBack;
  110. interface IDebugExpressionCallBack; // status events for IDebugExpression evaluation progress
  111. interface IEnumDebugExpressionContexts;
  112. interface IProvideExpressionContexts;
  113. // Object browsing
  114. interface IDebugFormatter;
  115. /* <H2> Hosts </H2>
  116. The host:
  117. - Hosts the language engines.
  118. - Provides an object model (set of objects that can be scripted)
  119. - defines a tree of documents that can be debugged and their contents
  120. - Organizes scripts into virtual applications.
  121. There are two kinds of hosts:
  122. 1. A dumb host supports just the basic ActiveScripting interfaces.
  123. It has no control over document structure or organizations; this is determined
  124. entirely by the scripts provided to the language engines.
  125. 2. A smart host supports a larger set of interface that allow it to define
  126. the document tree, document contents, and syntax coloring. There are a set of
  127. helper interfaces, described in the next subsection, which make it much easier for
  128. a host to be a smart host.
  129. <H3> Smart host Helper Interfaces </H3>
  130. The IDebugDocumentHelper are a greatly simplified set of interfaces that a host
  131. can use to gain the benefits of smart-hosting without having to handle the full
  132. complexity (and power) of the full host interfaces.
  133. A host is not required to use these interfaces, of course, but by using these
  134. can avoid having to implement or use a number of more complicated interfaces.*/
  135. interface IDebugDocumentHelper32; // implemented by PDM (32-bit)
  136. interface IDebugDocumentHelper64; // implemented by PDM (64-bit)
  137. interface IDebugDocumentHost; // implemented (optionally) by the host
  138. /* <H3> Full smart-host interfaces. </H3>
  139. Below is the full set of interfaces that a smart-host needs to implement or use if
  140. it's not using the helper interfaces.
  141. */
  142. // implemented by host
  143. interface IDebugDocumentInfo; // provides info on (possibily uninstantiated) doc
  144. interface IDebugDocumentProvider; // allows doc to be instantiated on demand
  145. interface IDebugDocument; // base document interface
  146. interface IDebugDocumentText; // provides access to source text of document
  147. interface IDebugDocumentTextEvents; // events fired when source text changes
  148. interface IDebugDocumentTextAuthor;
  149. interface IDebugDocumentContext; // represents a range within the document
  150. // implemented by PDM on behalf of the host
  151. interface IDebugApplicationNode; // represents the position of a doc in the hierarchy
  152. interface IDebugApplicationNodeEvents; // events fired by PDM when document hierarchy changes
  153. /* <H2> Debugger IDE </H2>
  154. The IDE is a fully language independent debugging UI. It provides:
  155. - Document viewers/editors.
  156. - Breakpoint management.
  157. - Expression evaluation and watch windows.
  158. - Stack frame browsing.
  159. - Object/Class browsing.
  160. - Browsing the virtual application structure.
  161. */
  162. // Debugger implementation
  163. interface IDebugSessionProvider; // establishes a debug session for a running application.
  164. interface IApplicationDebugger; // primary interface exposed by a debugger IDE session
  165. /* <H2> Machine Debug Manager </H2>
  166. The machine debug manager provides the hookup point between virtual applications and debuggers
  167. by maintaining and enumerating a list of active virtual applications.
  168. <INSERT SRC="..\..\doc\figures.doc!IMachineDebugManager">
  169. */
  170. interface IMachineDebugManager;
  171. interface IMachineDebugManagerCookie;
  172. interface IMachineDebugManagerEvents;
  173. interface IEnumRemoteDebugApplications;
  174. /* <H2> Process Debug Manager </H2>
  175. The PDM does the following:
  176. - Synchronizes the debugging of multiple language engines.
  177. - Maintains a tree of debuggable documents
  178. - Merges stack frames.
  179. - Coordinates breakpoints and stepping across language engines.
  180. - Tracks threads.
  181. - Maintains a debugger thread for asynchronous processing.
  182. - Communicates with the machine debug manager and the debugger IDE.
  183. <Issue>
  184. We need a way for native to run a thread into the PDM. This way the thread can be used for expression evaluation on higher frames. Likewise native needs a way to retrieve this thread from the PDM. Both teams are in agreement on this
  185. *Action item*
  186. SamMck and JimSa to define these methods and how to expose them. ShonK should comment on feasibility as well.
  187. </Issue>
  188. The following are the interfaces provided by the process debug manager.
  189. */
  190. interface IProcessDebugManager; // creates, adds and removes virtual applications, etc.
  191. interface IRemoteDebugApplication; // virtual application abstraction
  192. interface IDebugApplication32;
  193. interface IDebugApplication64;
  194. interface IRemoteDebugApplicationThread; // virtual thread abstraction
  195. interface IDebugApplicationThread;
  196. interface IEnumRemoteDebugApplicationThreads;
  197. interface IDebugThreadCall32; // dispatches marshalled calls
  198. interface IDebugThreadCall64; // dispatches marshalled calls
  199. interface IDebugApplicationNode; // maintains a position for a document in the hierarchy
  200. interface IEnumDebugApplicationNodes;
  201. interface IEnumDebugStackFrames; // merged enumeration of stack frames from engines
  202. interface IEnumDebugStackFrames64;
  203. // <HIDE>
  204. // Don't include this stuff in the printed docs because its either
  205. // not interesting enough or not ready enough
  206. interface IEnumActiveScriptDebugs;
  207. interface IEnumDebugDocumentContexts;
  208. interface IEnumDebugObjectBrowsers;
  209. // </HIDE>
  210. /* Structures and Enumerations
  211. These structures and enumerations are used in a number of the interfaces below.
  212. <H2> BREAKPOINT_STATE </H2>
  213. Indicates the state of a breakpoint.
  214. */
  215. typedef enum tagBREAKPOINT_STATE {
  216. BREAKPOINT_DELETED = 0, // The breakpoint no longer exists but there are still references
  217. BREAKPOINT_DISABLED = 1, // The breakpoint exists but is disabled
  218. BREAKPOINT_ENABLED = 2 // The breakpoint exists and is enabled
  219. } BREAKPOINT_STATE;
  220. /* <H2> APPBREAKFLAGS </H2>
  221. Application break flags. Indicates the current debug state for the application
  222. and the current thread.
  223. When certain of these bits are set (some are per-thread and some are for all threads),
  224. language engines should break at the next opportunity
  225. */
  226. typedef DWORD APPBREAKFLAGS;
  227. // DEBUGGER_BLOCK
  228. // languages should break immediately with BREAKREASON_DEBUGGER_BLOCK
  229. const APPBREAKFLAGS APPBREAKFLAG_DEBUGGER_BLOCK = 0x00000001;
  230. // DEBUGGER_HALT
  231. // languages should break immediately with BREAKREASON_DEBUGGER_HALT
  232. const APPBREAKFLAGS APPBREAKFLAG_DEBUGGER_HALT = 0x00000002;
  233. // STEP
  234. // languages should break immediately in the stepping thread with BREAKREASON_STEP
  235. const APPBREAKFLAGS APPBREAKFLAG_STEP = 0x00010000;
  236. // NESTED - the application is in nested execution on a breakpoint
  237. const APPBREAKFLAGS APPBREAKFLAG_NESTED = 0x00020000;
  238. // STEP TYPES - defines whether we are stepping at
  239. // source, bytecode, or machine level.
  240. const APPBREAKFLAGS APPBREAKFLAG_STEPTYPE_SOURCE = 0x00000000;
  241. const APPBREAKFLAGS APPBREAKFLAG_STEPTYPE_BYTECODE = 0x00100000;
  242. const APPBREAKFLAGS APPBREAKFLAG_STEPTYPE_MACHINE = 0x00200000;
  243. const APPBREAKFLAGS APPBREAKFLAG_STEPTYPE_MASK = 0x00F00000;
  244. // BREAKPOINT IN_PROGRESS
  245. const APPBREAKFLAGS APPBREAKFLAG_IN_BREAKPOINT = 0x80000000;
  246. /* <H2> BREAKREASON <H2>
  247. Indicates the cause of hitting a breakpoint.
  248. */
  249. typedef enum tagBREAKREASON{
  250. BREAKREASON_STEP, // Caused by the stepping mode
  251. BREAKREASON_BREAKPOINT, // Caused by an explicit breakpoint
  252. BREAKREASON_DEBUGGER_BLOCK, // Caused by another thread breaking
  253. BREAKREASON_HOST_INITIATED, // Caused by host requested break
  254. BREAKREASON_LANGUAGE_INITIATED, // Caused by a scripted break
  255. BREAKREASON_DEBUGGER_HALT, // Caused by debugger IDE requested break
  256. BREAKREASON_ERROR, // Caused by an execution error
  257. BREAKREASON_JIT // Caused by JIT Debugging startup
  258. } BREAKREASON;
  259. /* <H2> BREAKRESUME_ACTION </H2>
  260. Describes how to continue from a breakpoint
  261. */
  262. typedef enum tagBREAKRESUME_ACTION{
  263. BREAKRESUMEACTION_ABORT, // Abort the application
  264. BREAKRESUMEACTION_CONTINUE, // Continue running
  265. BREAKRESUMEACTION_STEP_INTO, // Step into a procedure
  266. BREAKRESUMEACTION_STEP_OVER, // Step over a procedure
  267. BREAKRESUMEACTION_STEP_OUT, // Step out of the current procedure
  268. BREAKRESUMEACTION_IGNORE, // Continue running with state
  269. } BREAKRESUMEACTION;
  270. /* <H2> ERRORRESUME_ACTION </H2>
  271. Describes how to continue from a runtime error
  272. */
  273. typedef enum tagERRORRESUMEACTION {
  274. ERRORRESUMEACTION_ReexecuteErrorStatement, // try executing the erroneous line again
  275. ERRORRESUMEACTION_AbortCallAndReturnErrorToCaller, // let the language engine handle the error
  276. ERRORRESUMEACTION_SkipErrorStatement, // resume execution from beyond the error
  277. } ERRORRESUMEACTION;
  278. /* <H2> DOCUMENTNAMETYPE </H2>
  279. Describes what type of name you'd like to get for a document:
  280. */
  281. typedef enum tagDOCUMENTNAMETYPE {
  282. DOCUMENTNAMETYPE_APPNODE, // Gets the name ass it appears in the app tree
  283. DOCUMENTNAMETYPE_TITLE, // Gets the name as it appears on the doc viewer title bar
  284. DOCUMENTNAMETYPE_FILE_TAIL, // Gets the filename without a path (for save as...)
  285. DOCUMENTNAMETYPE_URL, // Gets the URL of the document, if any
  286. } DOCUMENTNAMETYPE;
  287. /* <H2> SOURCE_TEXT_ATTR </H2>
  288. Describes the attributes of a single character of source text.
  289. */
  290. typedef WORD SOURCE_TEXT_ATTR;
  291. // The character is a part of a language keyword. Example: while
  292. const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_KEYWORD = 0x0001;
  293. // The character is a part of a comment block.
  294. const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_COMMENT = 0x0002;
  295. // The character is not part of compiled language source text. Example:
  296. // the HTML surrounding script blocks.
  297. const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_NONSOURCE = 0x0004;
  298. // The character is a part of a language operator. Example: *
  299. const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_OPERATOR = 0x0008;
  300. // The character is a part of a language numeric constant. Example: 1234
  301. const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_NUMBER = 0x0010;
  302. // The character is a part of a language string constant. Example: "Hello World"
  303. const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_STRING = 0x0020;
  304. // The character indicates the start of a function block
  305. const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_FUNCTION_START = 0x0040;
  306. /* <H2> TEXT_DOC_ATTR </H2>
  307. Describes the attributes of the document
  308. */
  309. typedef DWORD TEXT_DOC_ATTR;
  310. // Indicates that the document is read-only.
  311. const TEXT_DOC_ATTR TEXT_DOC_ATTR_READONLY = 0x00000001;
  312. /* <H2> Parse Flags </H2>
  313. Option flags used during IDebugExpressionContext::ParseLanguageText
  314. */
  315. // Indicates that the text is an expression as opposed to a statement. This
  316. // flag may affect the way in which the text is parsed by some languages.
  317. const DWORD DEBUG_TEXT_ISEXPRESSION = 0x00000001;
  318. // If a return value is available, it will be used by the caller.
  319. const DWORD DEBUG_TEXT_RETURNVALUE = 0x00000002;
  320. // Don't allow side effects. If this flag is set, the evaluation of the
  321. // expression should change no runtime state.
  322. const DWORD DEBUG_TEXT_NOSIDEEFFECTS = 0x00000004;
  323. // Allow breakpoints during the evaluation of the text. If this flag is not
  324. // set then breakpoints will be ignored during the evaluation of the text.
  325. const DWORD DEBUG_TEXT_ALLOWBREAKPOINTS = 0x00000008;
  326. // Allow error reports during the evaluation of the text. If this flag is not
  327. // set then errors will not be reported to the host during the evaluation.
  328. const DWORD DEBUG_TEXT_ALLOWERRORREPORT = 0x00000010;
  329. // Indicates the expression is to be evaluated to a code context rather than
  330. // running the expression itself
  331. const DWORD DEBUG_TEXT_EVALUATETOCODECONTEXT = 0x00000020;
  332. /* <I> Script Engine Debugging Interfaces </I>
  333. Below are the interfaces that a script engine needs to support to provide
  334. debugging, expression evaluation, and object browsing.
  335. <H1> IActiveScriptDebug </H1>
  336. This interface is implemented by script engines that support debugging, and is QI-able from IActiveScript. It provides the means for:
  337. 1. Smart hosts to take over document management.
  338. 2. Process debug manager to synchronize debugging of multiple script engines.
  339. */
  340. cpp_quote("#ifndef DISABLE_ACTIVDBG_INTERFACE_WRAPPERS")
  341. cpp_quote("#ifdef _WIN64")
  342. cpp_quote("#define IActiveScriptDebug IActiveScriptDebug64")
  343. cpp_quote("#define IID_IActiveScriptDebug IID_IActiveScriptDebug64")
  344. cpp_quote("#else")
  345. cpp_quote("#define IActiveScriptDebug IActiveScriptDebug32")
  346. cpp_quote("#define IID_IActiveScriptDebug IID_IActiveScriptDebug32")
  347. cpp_quote("#endif")
  348. cpp_quote("#endif")
  349. [
  350. object,
  351. uuid(51973C10-CB0C-11d0-B5C9-00A0244A0E7A),
  352. pointer_default(unique)
  353. ]
  354. interface IActiveScriptDebug32 : IUnknown
  355. {
  356. // Returns the text attributes for an arbitrary block of script text. Smart hosts
  357. // use this call to delegate GetText calls made on their IDebugDocumentText.
  358. HRESULT GetScriptTextAttributes(
  359. // The script block text. This string need not be null terminated.
  360. [in, size_is(uNumCodeChars)] LPCOLESTR pstrCode,
  361. // The number of characters in the script block text.
  362. [in] ULONG uNumCodeChars,
  363. // See IActiveScriptParse::ParseScriptText for a description of this argument.
  364. [in] LPCOLESTR pstrDelimiter,
  365. // See IActiveScriptParse::ParseScriptText for a description of this argument.
  366. [in] DWORD dwFlags,
  367. // Buffer to contain the returned attributes.
  368. [in, out, size_is(uNumCodeChars)] SOURCE_TEXT_ATTR *pattr);
  369. // Returns the text attributes for an arbitrary scriptlet. Smart hosts
  370. // use this call to delegate GetText calls made on their IDebugDocumentText.
  371. // Note: this call is provided because scriptlets tend to be expressions and
  372. // may have a different syntax than a script block. For many languages the implementation
  373. // will be identical to GetScriptTextAttributes.
  374. HRESULT GetScriptletTextAttributes(
  375. // The script block text. This string need not be null terminated.
  376. [in, size_is(uNumCodeChars)] LPCOLESTR pstrCode,
  377. // The number of characters in the script block text.
  378. [in] ULONG uNumCodeChars,
  379. // See IActiveScriptParse::AddScriptlet for a description of this argument.
  380. [in] LPCOLESTR pstrDelimiter,
  381. // See IActiveScriptParse::AddScriptlet for a description of this argument.
  382. [in] DWORD dwFlags,
  383. // Buffer to contain the returned attributes.
  384. [in, out, size_is(uNumCodeChars)] SOURCE_TEXT_ATTR *pattr);
  385. // Used by the smart host to delegate IDebugDocumentContext::EnumDebugCodeContexts.
  386. HRESULT EnumCodeContextsOfPosition(
  387. [in] DWORD dwSourceContext, // As provided to IActiveScriptParse::ParseScriptText
  388. // or IActiveScriptParse::AddScriptlet
  389. [in] ULONG uCharacterOffset, // character offset relative
  390. // to start of script text
  391. [in] ULONG uNumChars, // Number of characters in context
  392. // Returns an enumerator of code contexts.
  393. [out] IEnumDebugCodeContexts **ppescc);
  394. }
  395. [
  396. object,
  397. uuid(bc437e23-f5b8-47f4-bb79-7d1ce5483b86),
  398. pointer_default(unique)
  399. ]
  400. interface IActiveScriptDebug64 : IUnknown
  401. {
  402. // Returns the text attributes for an arbitrary block of script text. Smart hosts
  403. // use this call to delegate GetText calls made on their IDebugDocumentText.
  404. HRESULT GetScriptTextAttributes(
  405. // The script block text. This string need not be null terminated.
  406. [in, size_is(uNumCodeChars)] LPCOLESTR pstrCode,
  407. // The number of characters in the script block text.
  408. [in] ULONG uNumCodeChars,
  409. // See IActiveScriptParse::ParseScriptText for a description of this argument.
  410. [in] LPCOLESTR pstrDelimiter,
  411. // See IActiveScriptParse::ParseScriptText for a description of this argument.
  412. [in] DWORD dwFlags,
  413. // Buffer to contain the returned attributes.
  414. [in, out, size_is(uNumCodeChars)] SOURCE_TEXT_ATTR *pattr);
  415. // Returns the text attributes for an arbitrary scriptlet. Smart hosts
  416. // use this call to delegate GetText calls made on their IDebugDocumentText.
  417. // Note: this call is provided because scriptlets tend to be expressions and
  418. // may have a different syntax than a script block. For many languages the implementation
  419. // will be identical to GetScriptTextAttributes.
  420. HRESULT GetScriptletTextAttributes(
  421. // The script block text. This string need not be null terminated.
  422. [in, size_is(uNumCodeChars)] LPCOLESTR pstrCode,
  423. // The number of characters in the script block text.
  424. [in] ULONG uNumCodeChars,
  425. // See IActiveScriptParse::AddScriptlet for a description of this argument.
  426. [in] LPCOLESTR pstrDelimiter,
  427. // See IActiveScriptParse::AddScriptlet for a description of this argument.
  428. [in] DWORD dwFlags,
  429. // Buffer to contain the returned attributes.
  430. [in, out, size_is(uNumCodeChars)] SOURCE_TEXT_ATTR *pattr);
  431. // Used by the smart host to delegate IDebugDocumentContext::EnumDebugCodeContexts.
  432. HRESULT EnumCodeContextsOfPosition(
  433. [in] DWORDLONG dwSourceContext, // As provided to IActiveScriptParse::ParseScriptText
  434. // or IActiveScriptParse::AddScriptlet
  435. [in] ULONG uCharacterOffset, // character offset relative
  436. // to start of script text
  437. [in] ULONG uNumChars, // Number of characters in context
  438. // Returns an enumerator of code contexts.
  439. [out] IEnumDebugCodeContexts **ppescc);
  440. }
  441. /* IActiveScriptSiteDebug
  442. Implemented by smart hosts and is QI-able from IActiveScriptSite. It provides the means by which a smart host takes over document management and participates in debugging.
  443. */
  444. cpp_quote("#ifndef DISABLE_ACTIVDBG_INTERFACE_WRAPPERS")
  445. cpp_quote("#ifdef _WIN64")
  446. cpp_quote("#define IActiveScriptSiteDebug IActiveScriptSiteDebug64")
  447. cpp_quote("#define IID_IActiveScriptSiteDebug IID_IActiveScriptSiteDebug64")
  448. cpp_quote("#else")
  449. cpp_quote("#define IActiveScriptSiteDebug IActiveScriptSiteDebug32")
  450. cpp_quote("#define IID_IActiveScriptSiteDebug IID_IActiveScriptSiteDebug32")
  451. cpp_quote("#endif")
  452. cpp_quote("#endif")
  453. [
  454. object,
  455. uuid(51973C11-CB0C-11d0-B5C9-00A0244A0E7A),
  456. pointer_default(unique),
  457. local
  458. ]
  459. interface IActiveScriptSiteDebug32 : IUnknown
  460. {
  461. // Used by the language engine to delegate IDebugCodeContext::GetSourceContext.
  462. HRESULT GetDocumentContextFromPosition(
  463. [in] DWORD dwSourceContext, // As provided to ParseScriptText
  464. // or AddScriptlet
  465. [in] ULONG uCharacterOffset, // character offset relative
  466. // to start of script block or scriptlet
  467. [in] ULONG uNumChars, // Number of characters in context
  468. // Returns the document context corresponding to this character-position range.
  469. [out] IDebugDocumentContext **ppsc);
  470. // Returns the debug application object associated with this script site. Provides
  471. // a means for a smart host to define what application object each script belongs to.
  472. // Script engines should attempt to call this method to get their containing application
  473. // and resort to IProcessDebugManager::GetDefaultApplication if this fails.
  474. HRESULT GetApplication(
  475. [out] IDebugApplication32 **ppda);
  476. // Gets the application node under which script documents should be added
  477. // can return NULL if script documents should be top-level.
  478. HRESULT GetRootApplicationNode(
  479. [out] IDebugApplicationNode **ppdanRoot);
  480. // Allows a smart host to control the handling of runtime errors
  481. HRESULT OnScriptErrorDebug(
  482. // the runtime error that occurred
  483. [in] IActiveScriptErrorDebug *pErrorDebug,
  484. // whether to pass the error to the debugger to do JIT debugging
  485. [out] BOOL *pfEnterDebugger,
  486. // whether to call IActiveScriptSite::OnScriptError() when the user
  487. // decides to continue without debugging
  488. [out] BOOL *pfCallOnScriptErrorWhenContinuing);
  489. }
  490. [
  491. object,
  492. uuid(d6b96b0a-7463-402c-92ac-89984226942f),
  493. pointer_default(unique),
  494. local
  495. ]
  496. interface IActiveScriptSiteDebug64 : IUnknown
  497. {
  498. // Used by the language engine to delegate IDebugCodeContext::GetSourceContext.
  499. HRESULT GetDocumentContextFromPosition(
  500. [in] DWORDLONG dwSourceContext, // As provided to ParseScriptText
  501. // or AddScriptlet
  502. [in] ULONG uCharacterOffset, // character offset relative
  503. // to start of script block or scriptlet
  504. [in] ULONG uNumChars, // Number of characters in context
  505. // Returns the document context corresponding to this character-position range.
  506. [out] IDebugDocumentContext **ppsc);
  507. // Returns the debug application object associated with this script site. Provides
  508. // a means for a smart host to define what application object each script belongs to.
  509. // Script engines should attempt to call this method to get their containing application
  510. // and resort to IProcessDebugManager::GetDefaultApplication if this fails.
  511. HRESULT GetApplication(
  512. [out] IDebugApplication64 **ppda);
  513. // Gets the application node under which script documents should be added
  514. // can return NULL if script documents should be top-level.
  515. HRESULT GetRootApplicationNode(
  516. [out] IDebugApplicationNode **ppdanRoot);
  517. // Allows a smart host to control the handling of runtime errors
  518. HRESULT OnScriptErrorDebug(
  519. // the runtime error that occurred
  520. [in] IActiveScriptErrorDebug *pErrorDebug,
  521. // whether to pass the error to the debugger to do JIT debugging
  522. [out] BOOL *pfEnterDebugger,
  523. // whether to call IActiveScriptSite::OnScriptError() when the user
  524. // decides to continue without debugging
  525. [out] BOOL *pfCallOnScriptErrorWhenContinuing);
  526. }
  527. /* IActiveScriptErrorDebug
  528. Provides document context information for compile and runtime errors. QI-able from IActiveScriptError.
  529. */
  530. [
  531. object,
  532. uuid(51973C12-CB0C-11d0-B5C9-00A0244A0E7A),
  533. pointer_default(unique)
  534. ]
  535. interface IActiveScriptErrorDebug : IActiveScriptError
  536. {
  537. // Provides the document context for the associated error. The character-position range
  538. // should include the entire offending text.
  539. HRESULT GetDocumentContext(
  540. [out] IDebugDocumentContext **ppssc);
  541. // For runtime errors, provides the stack frame that is in effect.
  542. HRESULT GetStackFrame(
  543. [out] IDebugStackFrame **ppdsf);
  544. }
  545. /* IDebugCodeContext
  546. Abstraction reresenting a position in executable code. It can be thought of as a "virtual program counter".
  547. */
  548. [
  549. object,
  550. uuid(51973C13-CB0C-11d0-B5C9-00A0244A0E7A),
  551. pointer_default(unique)
  552. ]
  553. interface IDebugCodeContext : IUnknown
  554. {
  555. // Returns the document context associated with this code context.
  556. //
  557. // Note: For text documents, the character-position
  558. // range should include the text for the entire statement. This allows the debugger IDE
  559. // to hilight the current source statement.
  560. HRESULT GetDocumentContext(
  561. [out] IDebugDocumentContext **ppsc);
  562. // Sets or clears a breakpoint at this code context.
  563. HRESULT SetBreakPoint(
  564. [in] BREAKPOINT_STATE bps);
  565. }
  566. /* IDebugExpression
  567. Abstract representation of an asynchronously evaluated expression. Normally used
  568. by the debugger IDE to implement an immediate execution window or watch window.
  569. Normally provided by language engines.
  570. Note: Currently, IDebugExpression is only available from a stack frame.
  571. In the future it will be possible to retrieve these from other contexts
  572. (such as debug documents).
  573. <Issue>
  574. We would like to enumerate the language engine namespaces.
  575. We clearly need something to get the global expression context from.
  576. Sam and Bob pointed out many cases where there could possibly be many many namespaces.
  577. We need to consider how to expose something like this a bit further.
  578. Currently there is a namespace but the namespace is IE really since it will persist globals across LE's. Perhaps the namespace we are looking for is HTML, but quite possibly only a smart host could provide this.
  579. We continued to talk about having IDebugProperty be the general containment scheme for processes, namespaces, threads etc... I tending to agree that this is the right approach. We need more investigation in this area.
  580. *Action Item*
  581. BrianCr, BillJoy, SamMck, Philip, etc.. to continue to discuss.
  582. </Issue>
  583. */
  584. [
  585. object,
  586. uuid(51973C14-CB0C-11d0-B5C9-00A0244A0E7A),
  587. pointer_default(unique)
  588. ]
  589. interface IDebugExpression : IUnknown
  590. {
  591. // Begins the evaluation of the expression.
  592. HRESULT Start(
  593. // Provides an event driven means for indicating that the expression evaluation
  594. // is complete. If NULL, no events will be fired and the client will need to
  595. // poll the expression state using QueryIsComplete.
  596. [in] IDebugExpressionCallBack *pdecb);
  597. // Aborts the expression. Evaluation of an expression in progress will be stopped
  598. // at the earliest opportunity. If the expression is actually aborted, GetResultAsString
  599. // will return E_ABORT as phrResult.
  600. HRESULT Abort(void);
  601. // Returns S_FALSE if the operation is still pending.
  602. // Returns S_OK if the operation is complete.
  603. HRESULT QueryIsComplete(void);
  604. // Returns the result of the expression evaluation as a string and an HRESULT. Returns
  605. // E_PENDING if the operation is still pending. Returns S_OK and E_ABORT in phrResult
  606. // when the operation was aborted with Abort.
  607. HRESULT GetResultAsString(
  608. [out] HRESULT *phrResult,
  609. [out] BSTR *pbstrResult);
  610. // Returns the result of the expression evaluation as an
  611. // IDebugProperty and an HRESULT. Returns
  612. // E_PENDING if the operation is still pending. Returns S_OK and E_ABORT in phrResult
  613. // when the operation was aborted with Abort.
  614. HRESULT GetResultAsDebugProperty(
  615. [out] HRESULT *phrResult,
  616. [out] IDebugProperty **ppdp);
  617. }
  618. /* IDebugExpressionContext
  619. Abstract representation of a context in which expressions can be evaluated.
  620. Currently, this interface is only implemented by the stack frame object. In the
  621. future, other objects, such as the document context, may provide this interface.
  622. */
  623. [
  624. object,
  625. uuid(51973C15-CB0C-11d0-B5C9-00A0244A0E7A),
  626. helpstring("IDebugExpressionContext Interface"),
  627. pointer_default(unique)
  628. ]
  629. interface IDebugExpressionContext : IUnknown
  630. {
  631. // Creates an IDebugExpression for the specified text.
  632. HRESULT ParseLanguageText(
  633. // Provides the text of the expression or statement(s).
  634. [in] LPCOLESTR pstrCode,
  635. // Radix to use
  636. [in] UINT nRadix,
  637. // See IActiveScriptParse::ParseScriptText
  638. [in] LPCOLESTR pstrDelimiter,
  639. // See above flags.
  640. [in] DWORD dwFlags,
  641. // Returns the IDebugExpression for the given text.
  642. [out] IDebugExpression **ppe
  643. );
  644. // Returns a name and GUID for the langauge owning this context
  645. HRESULT GetLanguageInfo (
  646. [out] BSTR *pbstrLanguageName, // the name of the language
  647. [out] GUID *pLanguageID // an unique id for this language
  648. );
  649. }
  650. /* IDebugExpressionCallback
  651. Provides status events related to progress of an IDebugExpression evaluation.
  652. */
  653. [
  654. object,
  655. uuid(51973C16-CB0C-11d0-B5C9-00A0244A0E7A),
  656. pointer_default(unique)
  657. ]
  658. interface IDebugExpressionCallBack : IUnknown
  659. {
  660. // Indicates that the expression evaluation is complete. Note that
  661. // IDebugExpression::GetResultAsString can be called from within this event
  662. // handler.
  663. HRESULT onComplete(void);
  664. }
  665. /* IDebugStackFrame
  666. Abstraction representing a logical stack frame on the stack of a thread.
  667. Note that it derives from IDebugExpressionContext. This allows the debugger to
  668. evaluate expressions in the context of a particular stack frame.
  669. Note: In general, you can QI a stack frame for IDebugExpressionContext to allow
  670. expression evaluation and watch windows
  671. <Issue>
  672. Callstacks run on the breaking thread - We would like for the callstack to be run on the PDM's thread but it isn't 100% imperative. If we solve the previous issue, we don't have to have this. However it would be nice to not have to require native t
  673. o run a thread into the PDM just to get a callstack.
  674. <B> Action Item </B>
  675. *ShonK* to list any issues or problems in doing this. This issue maybe tied to a design resolution on how we accomplish cross process or cross thread callstacks.
  676. </Issue>
  677. */
  678. [
  679. object,
  680. uuid(51973C17-CB0C-11d0-B5C9-00A0244A0E7A),
  681. pointer_default(unique)
  682. ]
  683. interface IDebugStackFrame : IUnknown
  684. {
  685. // Returns the current code context associated with the stack frame.
  686. HRESULT GetCodeContext(
  687. [out] IDebugCodeContext **ppcc);
  688. // Returns a short or long textual description of the stack frame.
  689. // Normally, when fLong if false, this will provide only the name of the
  690. // function associated with the stack frame. When fLong is true it may
  691. // also provide the parameter(s) to the function or whatever else is
  692. // relevant.
  693. HRESULT GetDescriptionString(
  694. [in] BOOL fLong,
  695. [out] BSTR *pbstrDescription);
  696. // Returns a short or long textual description of the language. When fLong
  697. // is false, just the language name should be provided, eg, "Pascal". When
  698. // fLong is true a full product description may be provided, eg,
  699. // "Gnat Software's Flaming Pascal v3.72".
  700. HRESULT GetLanguageString(
  701. [in] BOOL fLong,
  702. [out] BSTR *pbstrLanguage);
  703. // Returns the thread associated with this stack frame.
  704. HRESULT GetThread(
  705. [out] IDebugApplicationThread **ppat);
  706. // Returns a property browser for the current frame (locals, etc.)
  707. HRESULT GetDebugProperty(
  708. [out] IDebugProperty **ppDebugProp);
  709. }
  710. /* IDebugStackFrameSniffer
  711. Provides a means for enumerating logical stack frames known by a certain component.
  712. Generally implemented by each script engine. Used by the process debug manager to
  713. find all stack frames associated with a given thread.
  714. Note: This interface is called from within the thread of interest. It is up to
  715. the implementor to identify the current thread and return an appropriate enumerator.
  716. */
  717. [
  718. object,
  719. uuid(51973C18-CB0C-11d0-B5C9-00A0244A0E7A),
  720. pointer_default(unique)
  721. ]
  722. interface IDebugStackFrameSniffer : IUnknown
  723. {
  724. // Returns an enumerator of stack frames for the current thread. Top of stack should
  725. // be returned first (the most recently pushed frame).
  726. HRESULT EnumStackFrames(
  727. [out] IEnumDebugStackFrames **ppedsf);
  728. }
  729. /* IDebugStackFrameSnifferEx
  730. Provides a means for enumerating logical stack frames known by a certain component.
  731. Generally implemented by each script engine. Used by the process debug manager to
  732. find all stack frames associated with a given thread.
  733. This alternate of the interface will replace IDebugStackFrameSniffer before Caesar's
  734. Beta 1 comes out. It's renamed separately as a placeholder.
  735. Note: This interface is called from within the thread of interest. It is up to
  736. the implementor to identify the current thread and return an appropriate enumerator.
  737. */
  738. cpp_quote("#ifndef DISABLE_ACTIVDBG_INTERFACE_WRAPPERS")
  739. cpp_quote("#ifdef _WIN64")
  740. cpp_quote("#define IDebugStackFrameSnifferEx IDebugStackFrameSnifferEx64")
  741. cpp_quote("#define IID_IDebugStackFrameSnifferEx IID_IDebugStackFrameSnifferEx64")
  742. cpp_quote("#define EnumStackFramesEx EnumStackFramesEx64")
  743. cpp_quote("#else")
  744. cpp_quote("#define IDebugStackFrameSnifferEx IDebugStackFrameSnifferEx32")
  745. cpp_quote("#define IID_IDebugStackFrameSnifferEx IID_IDebugStackFrameSnifferEx32")
  746. cpp_quote("#define EnumStackFramesEx EnumStackFramesEx32")
  747. cpp_quote("#endif")
  748. cpp_quote("#endif")
  749. [
  750. object,
  751. uuid(51973C19-CB0C-11d0-B5C9-00A0244A0E7A),
  752. pointer_default(unique)
  753. ]
  754. interface IDebugStackFrameSnifferEx32 : IDebugStackFrameSniffer
  755. {
  756. // Returns an enumerator of stack frames for the current thread.
  757. // dwSpMin is the minimum address to begin enumerating stack frames
  758. // Stack frames before this address will be omitted from the enumeration.
  759. // Top of stack should be returned first (the most recently pushed frame).
  760. HRESULT EnumStackFramesEx32( [in] DWORD dwSpMin, [out] IEnumDebugStackFrames **ppedsf);
  761. };
  762. [
  763. object,
  764. uuid(8cd12af4-49c1-4d52-8d8a-c146f47581aa),
  765. pointer_default(unique)
  766. ]
  767. interface IDebugStackFrameSnifferEx64 : IDebugStackFrameSniffer
  768. {
  769. // Returns an enumerator of stack frames for the current thread.
  770. // dwSpMin is the minimum address to begin enumerating stack frames
  771. // Stack frames before this address will be omitted from the enumeration.
  772. // Top of stack should be returned first (the most recently pushed frame).
  773. HRESULT EnumStackFramesEx64( [in] DWORDLONG dwSpMin, [out] IEnumDebugStackFrames64 **ppedsf);
  774. };
  775. /* IDebugSyncOperation
  776. IDebugSyncOperation is generally implemented by a language engine to expose
  777. expression evaluation, etc. It allows the implementor to abstract an operation
  778. that needs to be performed nested in a particular blocked thread, and it
  779. provides a mechanism for cancelling hung operations.
  780. */
  781. [
  782. object,
  783. uuid(51973C1a-CB0C-11d0-B5C9-00A0244A0E7A),
  784. pointer_default(unique),
  785. local
  786. ]
  787. interface IDebugSyncOperation : IUnknown
  788. {
  789. // Get TargetThread is called by PDM to determine what thread
  790. // to call Evaluate() in
  791. HRESULT GetTargetThread(
  792. [out] IDebugApplicationThread **ppatTarget);
  793. // Execute is called synchronously by the PDM in the target thread. It
  794. // synchronously peforms the operation and returns. It returns E_ABORT if
  795. // the operation was aborted with InProgressAbort();
  796. HRESULT Execute(
  797. [out] IUnknown **ppunkResult);
  798. // InProgressAbort() is called by the PDM, from within the debugger thread,
  799. // to cancel an operation which is in progress in another thread. The
  800. // operation should be completed or error out with E_ABORT as soon as
  801. // possible. E_NOTIMPL can be returned if the operation cannot be cancelled.
  802. HRESULT InProgressAbort(void);
  803. }
  804. /* IDebugAsyncOperation
  805. IDebugAsyncOperation is generally implemented by the PDM, and is obtained by a
  806. language engine through IDebugApplication::CreateAsyncDebugOperation().
  807. The language engine can use it to provide asynchronous access to a SyncDebugOperation.
  808. */
  809. [
  810. object,
  811. uuid(51973C1b-CB0C-11d0-B5C9-00A0244A0E7A),
  812. pointer_default(unique),
  813. local
  814. ]
  815. interface IDebugAsyncOperation : IUnknown
  816. {
  817. HRESULT GetSyncDebugOperation(
  818. [out] IDebugSyncOperation **ppsdo);
  819. // Start() causes the asynchronous operation to begin. It asynchronously
  820. // causes IDebugSyncOperation::Execute() to be called in the thread obtained
  821. // from IDebugSyncOperation::GetTargetThread(). It should only
  822. // be called from within the debugger thread, or it will not return until
  823. // the operation is complete (it degenerates to synchronous).
  824. // Returns E_UNEXPECTED if an operation is already pending.
  825. HRESULT Start(IDebugAsyncOperationCallBack *padocb);
  826. // Abort() causes InProgressAbort() to be called on the IDebugSyncOperation
  827. // object. It is normally called from within the debugger thread to cancel
  828. // a hung operation. If the abort happens before the request completes,
  829. // GetResult() will return E_ABORT. E_NOTIMPL may be returned from this
  830. // function if the operation is not cancellable.
  831. HRESULT Abort(void);
  832. // QueryIsComplete() returns S_OK if the operation is complete; otherwise it
  833. // returns S_FALSE;
  834. HRESULT QueryIsComplete(void);
  835. // If the request is complete, returns the HRESULT and object parameter
  836. // returned from IDebugSyncOperation::Execute(). Otherwise, returns
  837. // E_PENDING.
  838. HRESULT GetResult(
  839. [out] HRESULT *phrResult,
  840. [out] IUnknown **ppunkResult);
  841. }
  842. /* IDebugAsyncOperationCallBack
  843. This interface is used to signal events from an IDebugAsyncOperation.
  844. */
  845. [
  846. object,
  847. uuid(51973C1c-CB0C-11d0-B5C9-00A0244A0E7A),
  848. pointer_default(unique),
  849. local
  850. ]
  851. interface IDebugAsyncOperationCallBack : IUnknown
  852. {
  853. // onComplete() is fired by the AsyncDebugOperation when a result is available.
  854. // The event is fired in the debugger thread.
  855. HRESULT onComplete(void);
  856. }
  857. /* IEnumDebugCodeContexts
  858. Enumerates code contexts. Generally used to enumerate the code
  859. contexts corresponding to a document context.
  860. */
  861. [
  862. object,
  863. uuid(51973C1d-CB0C-11d0-B5C9-00A0244A0E7A),
  864. helpstring("IEnumDebugCodeContexts Interface"),
  865. pointer_default(unique)
  866. ]
  867. interface IEnumDebugCodeContexts : IUnknown {
  868. [local]
  869. HRESULT __stdcall Next(
  870. [in] ULONG celt,
  871. [out] IDebugCodeContext **pscc,
  872. [out] ULONG *pceltFetched);
  873. [call_as(Next)]
  874. HRESULT __stdcall RemoteNext(
  875. [in] ULONG celt,
  876. [out, size_is(celt), length_is(*pceltFetched )]
  877. IDebugCodeContext **pscc,
  878. [out] ULONG *pceltFetched);
  879. HRESULT Skip(
  880. [in] ULONG celt);
  881. HRESULT Reset(void);
  882. HRESULT Clone(
  883. [out] IEnumDebugCodeContexts **ppescc);
  884. }
  885. /* DebugStackFrameDescriptor
  886. Used to enumerate stack frames and merge output from several enumerators (on the same thread).
  887. dwMin and dwLim provide a machine dependent representation of the range
  888. of physical addresses associated with this stack frame. This is used by
  889. the process debug manager to sort the stack frames from multiple script engines.
  890. By convention, stacks grow down and, as such, on architectures where stacks grow
  891. up the addresses should be twos-complemented.
  892. The punkFinal is used during enumerator merging. If punkFinal is non-null,
  893. It indicates that the that the current enumerator merging should stop and
  894. a new one should be started. The object indicates how the new enumeration is to be started.
  895. */
  896. typedef struct tagDebugStackFrameDescriptor
  897. {
  898. IDebugStackFrame *pdsf;
  899. DWORD dwMin;
  900. DWORD dwLim;
  901. BOOL fFinal;
  902. IUnknown *punkFinal;
  903. } DebugStackFrameDescriptor;
  904. typedef struct tagDebugStackFrameDescriptor64
  905. {
  906. IDebugStackFrame *pdsf;
  907. DWORDLONG dwMin;
  908. DWORDLONG dwLim;
  909. BOOL fFinal;
  910. IUnknown *punkFinal;
  911. } DebugStackFrameDescriptor64;
  912. /* IEnumDebugStackFrames
  913. Enumerates stack frames. Generally used to enumerate the stack frames corresponding to a thread.
  914. */
  915. [
  916. object,
  917. uuid(51973C1e-CB0C-11d0-B5C9-00A0244A0E7A),
  918. helpstring("IEnumDebugStackFrames Interface"),
  919. pointer_default(unique)
  920. ]
  921. interface IEnumDebugStackFrames : IUnknown
  922. {
  923. [local]
  924. HRESULT __stdcall Next(
  925. [in] ULONG celt,
  926. [out] DebugStackFrameDescriptor *prgdsfd,
  927. [out] ULONG *pceltFetched);
  928. [call_as(Next)]
  929. HRESULT __stdcall RemoteNext(
  930. [in] ULONG celt,
  931. [out, size_is(celt), length_is(*pceltFetched )]
  932. DebugStackFrameDescriptor *prgdsfd,
  933. [out] ULONG *pceltFetched);
  934. HRESULT Skip(
  935. [in] ULONG celt);
  936. HRESULT Reset(void);
  937. HRESULT Clone(
  938. [out] IEnumDebugStackFrames **ppedsf);
  939. }
  940. //
  941. // This interface was added in v7, but is not in the office RTM.
  942. [
  943. object,
  944. uuid(0dc38853-c1b0-4176-a984-b298361027af),
  945. helpstring("IEnumDebugStackFrames Interface"),
  946. pointer_default(unique)
  947. ]
  948. interface IEnumDebugStackFrames64 : IEnumDebugStackFrames
  949. {
  950. [local]
  951. HRESULT __stdcall Next64(
  952. [in] ULONG celt,
  953. [out] DebugStackFrameDescriptor64 *prgdsfd,
  954. [out] ULONG *pceltFetched);
  955. [call_as(Next64)]
  956. HRESULT __stdcall RemoteNext64(
  957. [in] ULONG celt,
  958. [out, size_is(celt), length_is(*pceltFetched )]
  959. DebugStackFrameDescriptor64 *prgdsfd,
  960. [out] ULONG *pceltFetched);
  961. }
  962. /* <I> Smart Host Interfaces </I>
  963. Below are the details of the interfaces implemented by a smart host.
  964. As mentioned earlier, it is possible to avoid implementing these interfaces by
  965. using the smart host helper interfaces.
  966. <H1> IDebugDocumentInfo </H1>
  967. Provides information on a document, which may or may not be instantiated. */
  968. [
  969. object,
  970. uuid(51973C1f-CB0C-11d0-B5C9-00A0244A0E7A),
  971. helpstring("IDebugDocumentInfo Interface"),
  972. pointer_default(unique)
  973. ]
  974. interface IDebugDocumentInfo : IUnknown {
  975. // Returns the specified name for the document. If the indicated name is
  976. // not known, E_FAIL is returned.
  977. HRESULT GetName(
  978. [in] DOCUMENTNAMETYPE dnt,
  979. [out] BSTR *pbstrName);
  980. // Returns a CLSID describing the document type. This allows the debugger IDE
  981. // to host custom viewers for this document. returns CLSID_NULL if this document
  982. // does not have viewable data.
  983. HRESULT GetDocumentClassId(
  984. [out] CLSID *pclsidDocument);
  985. }
  986. /* IDebugDocumentProvider
  987. Provides the means for instantiating a document on demand. This indirect means for instanciating a document:
  988. 1. Allows lazy loading of the document.
  989. 2. Allows the document object to live at the debugger IDE.
  990. 3. Allows more then one way of getting to the identical document object.
  991. This effectively segregates the document from its provider; this allows the
  992. provider to carry additional runtime context information.
  993. <INSERT SRC="..\..\doc\figures.doc!IDebugDocument">
  994. */
  995. [
  996. object,
  997. uuid(51973C20-CB0C-11d0-B5C9-00A0244A0E7A),
  998. helpstring("IDebugDocumentProvider Interface"),
  999. pointer_default(unique)
  1000. ]
  1001. interface IDebugDocumentProvider : IDebugDocumentInfo {
  1002. // Causes the document to be instantiated if it does not already exist.
  1003. HRESULT GetDocument(
  1004. [out] IDebugDocument **ppssd);
  1005. }
  1006. /* IDebugDocument
  1007. The base interface to all debug documents.
  1008. */
  1009. [
  1010. object,
  1011. uuid(51973C21-CB0C-11d0-B5C9-00A0244A0E7A),
  1012. pointer_default(unique)
  1013. ]
  1014. interface IDebugDocument : IDebugDocumentInfo {
  1015. }
  1016. /* IDebugDocumentText
  1017. The interface to a text only debug document.
  1018. Conventions:
  1019. 1. Both character positions and line numbers are zero based.
  1020. 2. Character-positions represent character offsets; they do not represent
  1021. byte or word offsets. For Win32, a character-position is an Unicode offset.
  1022. Note: the use of line-number based text management is not recommended; instead it
  1023. is recommended that character-position based management be used. The line to character-position mapping functions described in this interface may be removed.
  1024. */
  1025. [
  1026. object,
  1027. uuid(51973C22-CB0C-11d0-B5C9-00A0244A0E7A),
  1028. pointer_default(unique)
  1029. ]
  1030. interface IDebugDocumentText : IDebugDocument {
  1031. // Returns the attributes of the document.
  1032. HRESULT GetDocumentAttributes(
  1033. [out] TEXT_DOC_ATTR *ptextdocattr);
  1034. // Returns the size of the document.
  1035. HRESULT GetSize(
  1036. [out] ULONG *pcNumLines, // NULL means do not return the number of lines.
  1037. [out] ULONG *pcNumChars); // NULL means do not return the number of characters.
  1038. // Returns character-position corresponding to the first character of a line.
  1039. HRESULT GetPositionOfLine(
  1040. [in] ULONG cLineNumber,
  1041. [out] ULONG *pcCharacterPosition);
  1042. // Returns the line-number and, optionally, the character offset within the line
  1043. // that corresponds to the given character-position.
  1044. HRESULT GetLineOfPosition(
  1045. [in] ULONG cCharacterPosition,
  1046. [out] ULONG *pcLineNumber,
  1047. [out] ULONG *pcCharacterOffsetInLine); // NULL means do not return a value.
  1048. // Retrieves the characters and/or the character attributes associated with
  1049. // a character-position range; where a character position range is specified by
  1050. // a character-position and a number of characters.
  1051. HRESULT GetText(
  1052. [in] ULONG cCharacterPosition,
  1053. // Specifies a character text buffer. NULL means do not return characters.
  1054. [in, out, length_is(*pcNumChars), size_is(cMaxChars)] WCHAR *pcharText,
  1055. // Specifies a character attribute buffer. NULL means do not return attributes.
  1056. [in, out, length_is(*pcNumChars), size_is(cMaxChars), ptr] SOURCE_TEXT_ATTR *pstaTextAttr,
  1057. // Indicates the actual number of characters/attributes returned. Must be set to zero
  1058. // before the call.
  1059. [in, out] ULONG *pcNumChars,
  1060. // Specifies the number maximum number of character desired.
  1061. [in] ULONG cMaxChars);
  1062. // Returns the character-position range corresponding to a document context. The document
  1063. // context provided must be associated with this document.
  1064. HRESULT GetPositionOfContext(
  1065. [in] IDebugDocumentContext *psc,
  1066. [out] ULONG *pcCharacterPosition,
  1067. [out] ULONG *cNumChars);
  1068. // Creates a document context object corresponding to the provided character position range.
  1069. HRESULT GetContextOfPosition(
  1070. [in] ULONG cCharacterPosition,
  1071. [in] ULONG cNumChars,
  1072. [out] IDebugDocumentContext **ppsc);
  1073. }
  1074. /* IDebugDocumentTextEvents
  1075. Provides events indicating changes to the associated text document.
  1076. Note: The text alterations are reflected in the document at the time the
  1077. events on this interface are fired. Event handlers may retrieve the new text
  1078. using IDebugDocumentText.
  1079. */
  1080. [
  1081. object,
  1082. uuid(51973C23-CB0C-11d0-B5C9-00A0244A0E7A),
  1083. pointer_default(unique)
  1084. ]
  1085. interface IDebugDocumentTextEvents : IUnknown
  1086. {
  1087. // Indicates that the underlying document has been destroyed and is no longer valid.
  1088. HRESULT onDestroy(void);
  1089. // Indicates that new text has been added to the document. Example: progressive loading
  1090. // of HTML.
  1091. //
  1092. HRESULT onInsertText(
  1093. // The position where the new text is inserted.
  1094. [in] ULONG cCharacterPosition,
  1095. // The number of characters that have been inserted.
  1096. [in] ULONG cNumToInsert);
  1097. // Indicates that text has been removed from the document.
  1098. HRESULT onRemoveText(
  1099. // The character-position of the first character removed.
  1100. [in] ULONG cCharacterPosition,
  1101. // The number of characters removed.
  1102. [in] ULONG cNumToRemove);
  1103. // Indicates that text has been replaced.
  1104. HRESULT onReplaceText(
  1105. // The starting character-position of the character-position range
  1106. // that is being replaced.
  1107. [in] ULONG cCharacterPosition,
  1108. // The number of characters replaced.
  1109. [in] ULONG cNumToReplace);
  1110. // Indicates that the text attributes associated with the underlying character-position
  1111. // range has changed.
  1112. HRESULT onUpdateTextAttributes(
  1113. // The character-position of the first character whose attributes have changed.
  1114. [in] ULONG cCharacterPosition,
  1115. // The number of characters in the range.
  1116. [in] ULONG cNumToUpdate);
  1117. // Indicates that the document attributes have changed.
  1118. HRESULT onUpdateDocumentAttributes(
  1119. // The new document attributes.
  1120. [in] TEXT_DOC_ATTR textdocattr);
  1121. }
  1122. // <HIDE>
  1123. /* IDebugDocumentTextAuthor
  1124. This preliminary interface is provided by text documents that support editing.
  1125. Notes:
  1126. 1. In the future transactioning and undo support will be added to this interface.
  1127. 2. The events on IDebugDocumentTextEvents will fire as a result of calls to
  1128. this interface. The caller should use this interface to modify the document but rely
  1129. on the events to update the display.
  1130. */
  1131. [
  1132. object,
  1133. uuid(51973C24-CB0C-11d0-B5C9-00A0244A0E7A),
  1134. pointer_default(unique)
  1135. ]
  1136. interface IDebugDocumentTextAuthor : IDebugDocumentText {
  1137. // Insert new text into the document.
  1138. HRESULT InsertText(
  1139. [in] ULONG cCharacterPosition,
  1140. [in] ULONG cNumToInsert,
  1141. // A buffer containing the characters to insert.
  1142. [in, size_is(cNumToInsert)]
  1143. OLECHAR pcharText[]);
  1144. // Remove text from the document.
  1145. HRESULT RemoveText(
  1146. [in] ULONG cCharacterPosition,
  1147. [in] ULONG cNumToRemove);
  1148. // Replace text in the document.
  1149. HRESULT ReplaceText(
  1150. [in] ULONG cCharacterPosition,
  1151. [in] ULONG cNumToReplace,
  1152. // A buffer containing the characters with which to replace the old characters.
  1153. [in, size_is(cNumToReplace)]
  1154. OLECHAR pcharText[]);
  1155. }
  1156. /* IDebugDocumentTextExternalAuthor
  1157. An extremely preliminary interface to allow external editors to edit file-based
  1158. debugger documents, and to notify the document when the source file has been changed.
  1159. */
  1160. [
  1161. object,
  1162. uuid(51973C25-CB0C-11d0-B5C9-00A0244A0E7A),
  1163. pointer_default(unique)
  1164. ]
  1165. interface IDebugDocumentTextExternalAuthor : IUnknown{
  1166. // Return the full path (including file name) to the document's source file.
  1167. // *pfIsOriginalPath is TRUE if the path refers to the original file for the document.
  1168. // *pfIsOriginalPath is FALSE if the path refers to a newly created temporary file
  1169. // Returns E_FAIL if no source file can be created/determined.
  1170. HRESULT GetPathName(
  1171. [out] BSTR *pbstrLongName,
  1172. [out] BOOL *pfIsOriginalFile);
  1173. // Return just the name of the document, with no path information.
  1174. // (Used for "Save As...")
  1175. HRESULT GetFileName(
  1176. [out] BSTR *pbstrShortName);
  1177. // Notify the host that the document's source file has been saved and
  1178. // that its contents should be refreshed.
  1179. HRESULT NotifyChanged();
  1180. }
  1181. // </HIDE>
  1182. /* IDebugDocumentHelper
  1183. IDebugDocumentHelper greatly simplifies the task of creating a smart host
  1184. for ActiveDebugging.
  1185. IDebugDocumentHelper automatically provides implementations for IDebugDocumentProvider,
  1186. IDdebugDocument, IDebugDocumentText, IDebugDocumentContext, IDebugDocumentTextEvents,
  1187. and many of the other interfaces necessary for smart hosting.
  1188. To be a smart host using IDebugDocumentHelper, a host application only to do only
  1189. three two things:
  1190. (1) CoCreate an IProcessDebugManager and use it to add your application to the list
  1191. of debuggable applications.
  1192. (2) create an IDebugDocumentHelper for each host document and make the appropriate
  1193. calls to define the document name, parent document, text, and script blocks.
  1194. (3) Implement IActiveScriptSiteDebug on your IActiveScriptSite object (implemented
  1195. already for Active Scripting. The only non-trivial method on IActiveScriptSiteDebug
  1196. simply delegates to the helper.
  1197. Additionally, the host can optionally implement IDebugDocumentHost if it needs additional
  1198. control over syntax color, document context creation, and other extended functionality.
  1199. The main limitation on the smart host helper is that can only handle documents whose contents
  1200. change or shrink after they have been added (though documents can expand, of course.) For
  1201. many smart hosts, however, the functionality it provides is exactly what is needed.
  1202. Below we go into each of the steps in more detail.
  1203. <H2> Create an Application Object </H2>
  1204. Before the smart host helper can be used, it is necessary to create an IDebugApplication
  1205. object to represent your application in the debugger.
  1206. The steps for creating an application object are as follows:
  1207. (1) Create an instance of the process debug manager using CoCreateInstance.
  1208. (2) Call IProcessDebugManager::CreateApplication().
  1209. (3) Set the name on the application using SetName().
  1210. (4) Add the application object to the list of debuggable applications using
  1211. AddApplication().
  1212. Below is code to do this, minus error-check and other niceties.
  1213. CoCreateInstance(CLSID_ProcessDebugManager, NULL,
  1214. CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER,
  1215. IID_IProcessDebugManager, (void **)&g_ppdm);
  1216. g_ppdm->CreateApplication(&g_pda);
  1217. g_pda->SetName(L"My cool application");
  1218. g_ppdm->AddApplication(g_pda, &g_dwAppCookie);
  1219. <H2> Using IDebugDocumentHelper </H2>
  1220. The minimal sequence of steps for using the helper is as follows:
  1221. (1) For each host document, create a helper using
  1222. IProcessDebugManager::CreateDebugDocumentHelper.
  1223. (2) Call Init on the helper, giving the name, document attributes, etc.
  1224. (3) Call Attach with parent helper for the document (or NULL if the document is
  1225. the root) to define the position of the document in the tree and make it visible
  1226. to the debugger
  1227. (4) Call AddDBCSText() or AddUnicodeText() to define the text of the document.
  1228. (These can be called multiple times if document is downloaded incrementally,
  1229. as in the case of a browser.)
  1230. (5) Call DefineScriptBlock to define the ranges for each script block and the
  1231. associated script engines.
  1232. <H2> Implementing IActiveScriptSiteDebug </H2>
  1233. To implement <I> GetDocumentContextFromPosition </I>, get the helper corresponding to
  1234. the given site, then get the starting document offset for the given source context, as
  1235. follows:
  1236. pddh->GetScriptBlockInfo(dwSourceContext, NULL, &ulStartPos, NULL);
  1237. Next, use the helper to create a new document context for the given character offset:
  1238. pddh->CreateDebugDocumentContext(ulStartPos + uCharacterOffset, cChars, &pddcNew);
  1239. To implement <I> GetRootApplicationNode </I>, simply call IDebugApplication::GetRootNode.
  1240. To implement <I> GetDebugApplication </I>, simply return the IDebugApplication you initially
  1241. created using the process debug manager.
  1242. <H2> The optional IDebugDocumentHost interface <H2>
  1243. The host can provide an implementation of IDebugDocumentHost using IDebugDocumentHelper::SetHost
  1244. that gives it additional control over the helper. Here are some of the key things the host
  1245. interface allows you to do:
  1246. (1) Add text using AddDeferredText so that the host doesn't have to provide the actual
  1247. characters immediately. When the characters are really needed, the helper will call
  1248. IDebugDocumentHost::GetDeferredCharacters on the host.
  1249. (2) Override the default syntax coloring provided by the helper. The helper will call
  1250. IDebugDocumentHost::GetScriptTextAttributes when it needs to know the coloring for a range
  1251. of characters, falling back on its default implementation if the host return E_NOTIMPL.
  1252. (3) Providing a controlling unknown for document contexts created by the helper my implementing
  1253. IDebugDocumentHost::OnCreateDocumentContext. This allows the host to override the functionality
  1254. of the default document context implementation.
  1255. (4) Provide a path name in the file system for the document. Some debugging UIs will use this
  1256. to permit the user to edit and save changes to the document. IDebugDocumentHost::NotifyChanged
  1257. will be called to notify the host after the document has been saved.
  1258. */
  1259. cpp_quote("#ifndef DISABLE_ACTIVDBG_INTERFACE_WRAPPERS")
  1260. cpp_quote("#ifdef _WIN64")
  1261. cpp_quote("#define IDebugDocumentHelper IDebugDocumentHelper64")
  1262. cpp_quote("#define IID_IDebugDocumentHelper IID_IDebugDocumentHelper64")
  1263. cpp_quote("#else")
  1264. cpp_quote("#define IDebugDocumentHelper IDebugDocumentHelper32")
  1265. cpp_quote("#define IID_IDebugDocumentHelper IID_IDebugDocumentHelper32")
  1266. cpp_quote("#endif")
  1267. cpp_quote("#endif")
  1268. [
  1269. object,
  1270. uuid(51973C26-CB0C-11d0-B5C9-00A0244A0E7A),
  1271. helpstring("IDebugDocumentHelper Interface"),
  1272. pointer_default(unique)
  1273. ]
  1274. interface IDebugDocumentHelper32 : IUnknown
  1275. {
  1276. // Initialize a debug doc helper with the given name and
  1277. // initial attributes.
  1278. //
  1279. // Note: The document will not actually appear in the tree
  1280. // until Attach is called.
  1281. HRESULT Init(
  1282. [in] IDebugApplication32 *pda,
  1283. [in, string] LPCOLESTR pszShortName,
  1284. [in, string] LPCOLESTR pszLongName,
  1285. [in] TEXT_DOC_ATTR docAttr
  1286. );
  1287. // Add the document to the doc tree, using pddhParent as the parent.
  1288. // If the ppdhParent is NULL, the document will be top-level.
  1289. HRESULT Attach([in] IDebugDocumentHelper32 *pddhParent);
  1290. // Remove the document from the doc tree.
  1291. HRESULT Detach();
  1292. // Add the given set of unicode characters to end of the document.
  1293. // (This will generate IDebugDocumentTextEvent notifications.)
  1294. //
  1295. // If this method is called after AddDeferredText has been called,
  1296. // E_FAIL will be returned.
  1297. HRESULT AddUnicodeText(
  1298. [in, string] LPCOLESTR pszText
  1299. );
  1300. // Add the given set of DBCS characters to end of the document.
  1301. // (This will generate IDebugDocumentTextEvent notifications.)
  1302. //
  1303. // If this method is called after AddDeferredText has been called,
  1304. // E_FAIL will be returned.
  1305. HRESULT AddDBCSText(
  1306. [in, string] LPCSTR pszText
  1307. );
  1308. // Set the DebugDocumentHost interface.
  1309. // If provided, this interface will be used for
  1310. // smart-host syntax coloring, fetching deferred text, and returning
  1311. // controlling unknowns for newly created document contexts.
  1312. HRESULT SetDebugDocumentHost(
  1313. [in] IDebugDocumentHost* pddh
  1314. );
  1315. // Notify the helper that the given text is available, but don't actually
  1316. // provide the characters.
  1317. // This allows the host to defer providing the characters unless they
  1318. // are actually needed, while still allowing the helper to generate
  1319. // accurate notifications and size information.
  1320. //
  1321. // dwTextStartCookie is a cookie, defined by the host, that represents
  1322. // the starting position of the text. (For example, in a host that
  1323. // represents text in DBCS, the cookie could be a byte offset.)
  1324. // This cookie will be provided in subsequent calls to GetText.
  1325. //
  1326. // NB: It is assumed that a single call to
  1327. // GetText can get characters from multiple calls to AddDeferredText.
  1328. // The helper classes may also ask for the same range of deferred
  1329. // characters more than once.
  1330. //
  1331. // It is an error to mix calls to AddDeferredText with calls to
  1332. // AddUnicodeText or AddDBCSText-- Doing so will cause E_FAIL to be
  1333. // returned.
  1334. HRESULT AddDeferredText(
  1335. [in] ULONG cChars, // number of (Unicode) characters to add
  1336. [in] DWORD dwTextStartCookie
  1337. // host-defined cookie representing the starting position of the text.
  1338. );
  1339. // Notify the helper that a particular range of
  1340. // characters is a script block handled by the given script engine.
  1341. // All syntax coloring and code context lookups for that range will be
  1342. // delegated to that script engine.
  1343. //
  1344. // This method would be used by a smart host whose documents contained
  1345. // embedded script blocks, or by a language engine containing embedded
  1346. // scripts for other languages.
  1347. //
  1348. // DefineScriptBlock should be called <I> after </I> the text has been
  1349. // added (via AddDBCSText, etc) but before the script script block
  1350. // has been parsed (via IActiveScriptParse).
  1351. HRESULT DefineScriptBlock(
  1352. [in] ULONG ulCharOffset,
  1353. [in] ULONG cChars,
  1354. [in] IActiveScript *pas,
  1355. [in] BOOL fScriptlet,
  1356. [out] DWORD* pdwSourceContext
  1357. );
  1358. // Set the default attribute to use for text that is not in a
  1359. // script block. (If not explicitly set, the default attributes for
  1360. // text outside of a script block is SOURCETEXT_ATTR_NONSOURCE.)
  1361. //
  1362. // This would allow, for example, for text outside of script blocks
  1363. // to be colored grey and marked read-only.
  1364. HRESULT SetDefaultTextAttr(SOURCE_TEXT_ATTR staTextAttr);
  1365. // Explicilty set the attributes on a range of text, overriding any
  1366. // other attributes on that text.
  1367. //
  1368. // It is an error to set the attributes on a text range that has not
  1369. // yet been added using AddText.
  1370. HRESULT SetTextAttributes(
  1371. [in] ULONG ulCharOffset,
  1372. [in] ULONG cChars,
  1373. [in, length_is(cChars), size_is(cChars)]
  1374. SOURCE_TEXT_ATTR* pstaTextAttr);
  1375. // Set a new long name for the document
  1376. HRESULT SetLongName(
  1377. [in, string] LPCOLESTR pszLongName);
  1378. // Set a new short name for the document
  1379. HRESULT SetShortName(
  1380. [in, string] LPCOLESTR pszShortName);
  1381. // Define a new set of document attributes
  1382. HRESULT SetDocumentAttr(
  1383. [in] TEXT_DOC_ATTR pszAttributes
  1384. );
  1385. // Return the debug application node corresponding to this document
  1386. HRESULT GetDebugApplicationNode(
  1387. [out] IDebugApplicationNode **ppdan);
  1388. // Once a script block has been defined, this method allows the
  1389. // associate range and script engine to be retrieved.
  1390. HRESULT GetScriptBlockInfo(
  1391. [in] DWORD dwSourceContext,
  1392. [out] IActiveScript **ppasd,
  1393. [out] ULONG *piCharPos,
  1394. [out] ULONG *pcChars);
  1395. // Allows the host to create a new debug document context
  1396. HRESULT CreateDebugDocumentContext(
  1397. [in] ULONG iCharPos,
  1398. [in] ULONG cChars,
  1399. [out] IDebugDocumentContext** ppddc);
  1400. // Bring this document to the top in the debugger UI.
  1401. // If the debugger isn't started already, start it now.
  1402. HRESULT BringDocumentToTop();
  1403. // Bring the given context in this document to the top
  1404. // in the debugger UI.
  1405. HRESULT BringDocumentContextToTop(IDebugDocumentContext *pddc);
  1406. };
  1407. [
  1408. object,
  1409. uuid(c4c7363c-20fd-47f9-bd82-4855e0150871),
  1410. helpstring("IDebugDocumentHelper Interface"),
  1411. pointer_default(unique)
  1412. ]
  1413. interface IDebugDocumentHelper64 : IUnknown
  1414. {
  1415. // Initialize a debug doc helper with the given name and
  1416. // initial attributes.
  1417. //
  1418. // Note: The document will not actually appear in the tree
  1419. // until Attach is called.
  1420. HRESULT Init(
  1421. [in] IDebugApplication64 *pda,
  1422. [in, string] LPCOLESTR pszShortName,
  1423. [in, string] LPCOLESTR pszLongName,
  1424. [in] TEXT_DOC_ATTR docAttr
  1425. );
  1426. // Add the document to the doc tree, using pddhParent as the parent.
  1427. // If the ppdhParent is NULL, the document will be top-level.
  1428. HRESULT Attach([in] IDebugDocumentHelper64 *pddhParent);
  1429. // Remove the document from the doc tree.
  1430. HRESULT Detach();
  1431. // Add the given set of unicode characters to end of the document.
  1432. // (This will generate IDebugDocumentTextEvent notifications.)
  1433. //
  1434. // If this method is called after AddDeferredText has been called,
  1435. // E_FAIL will be returned.
  1436. HRESULT AddUnicodeText(
  1437. [in, string] LPCOLESTR pszText
  1438. );
  1439. // Add the given set of DBCS characters to end of the document.
  1440. // (This will generate IDebugDocumentTextEvent notifications.)
  1441. //
  1442. // If this method is called after AddDeferredText has been called,
  1443. // E_FAIL will be returned.
  1444. HRESULT AddDBCSText(
  1445. [in, string] LPCSTR pszText
  1446. );
  1447. // Set the DebugDocumentHost interface.
  1448. // If provided, this interface will be used for
  1449. // smart-host syntax coloring, fetching deferred text, and returning
  1450. // controlling unknowns for newly created document contexts.
  1451. HRESULT SetDebugDocumentHost(
  1452. [in] IDebugDocumentHost* pddh
  1453. );
  1454. // Notify the helper that the given text is available, but don't actually
  1455. // provide the characters.
  1456. // This allows the host to defer providing the characters unless they
  1457. // are actually needed, while still allowing the helper to generate
  1458. // accurate notifications and size information.
  1459. //
  1460. // dwTextStartCookie is a cookie, defined by the host, that represents
  1461. // the starting position of the text. (For example, in a host that
  1462. // represents text in DBCS, the cookie could be a byte offset.)
  1463. // This cookie will be provided in subsequent calls to GetText.
  1464. //
  1465. // NB: It is assumed that a single call to
  1466. // GetText can get characters from multiple calls to AddDeferredText.
  1467. // The helper classes may also ask for the same range of deferred
  1468. // characters more than once.
  1469. //
  1470. // It is an error to mix calls to AddDeferredText with calls to
  1471. // AddUnicodeText or AddDBCSText-- Doing so will cause E_FAIL to be
  1472. // returned.
  1473. HRESULT AddDeferredText(
  1474. [in] ULONG cChars, // number of (Unicode) characters to add
  1475. [in] DWORD dwTextStartCookie
  1476. // host-defined cookie representing the starting position of the text.
  1477. );
  1478. // Notify the helper that a particular range of
  1479. // characters is a script block handled by the given script engine.
  1480. // All syntax coloring and code context lookups for that range will be
  1481. // delegated to that script engine.
  1482. //
  1483. // This method would be used by a smart host whose documents contained
  1484. // embedded script blocks, or by a language engine containing embedded
  1485. // scripts for other languages.
  1486. //
  1487. // DefineScriptBlock should be called <I> after </I> the text has been
  1488. // added (via AddDBCSText, etc) but before the script script block
  1489. // has been parsed (via IActiveScriptParse).
  1490. HRESULT DefineScriptBlock(
  1491. [in] ULONG ulCharOffset,
  1492. [in] ULONG cChars,
  1493. [in] IActiveScript *pas,
  1494. [in] BOOL fScriptlet,
  1495. [out] DWORDLONG *pdwSourceContext
  1496. );
  1497. // Set the default attribute to use for text that is not in a
  1498. // script block. (If not explicitly set, the default attributes for
  1499. // text outside of a script block is SOURCETEXT_ATTR_NONSOURCE.)
  1500. //
  1501. // This would allow, for example, for text outside of script blocks
  1502. // to be colored grey and marked read-only.
  1503. HRESULT SetDefaultTextAttr(SOURCE_TEXT_ATTR staTextAttr);
  1504. // Explicilty set the attributes on a range of text, overriding any
  1505. // other attributes on that text.
  1506. //
  1507. // It is an error to set the attributes on a text range that has not
  1508. // yet been added using AddText.
  1509. HRESULT SetTextAttributes(
  1510. [in] ULONG ulCharOffset,
  1511. [in] ULONG cChars,
  1512. [in, length_is(cChars), size_is(cChars)]
  1513. SOURCE_TEXT_ATTR* pstaTextAttr);
  1514. // Set a new long name for the document
  1515. HRESULT SetLongName(
  1516. [in, string] LPCOLESTR pszLongName);
  1517. // Set a new short name for the document
  1518. HRESULT SetShortName(
  1519. [in, string] LPCOLESTR pszShortName);
  1520. // Define a new set of document attributes
  1521. HRESULT SetDocumentAttr(
  1522. [in] TEXT_DOC_ATTR pszAttributes
  1523. );
  1524. // Return the debug application node corresponding to this document
  1525. HRESULT GetDebugApplicationNode(
  1526. [out] IDebugApplicationNode **ppdan);
  1527. // Once a script block has been defined, this method allows the
  1528. // associate range and script engine to be retrieved.
  1529. HRESULT GetScriptBlockInfo(
  1530. [in] DWORDLONG dwSourceContext,
  1531. [out] IActiveScript **ppasd,
  1532. [out] ULONG *piCharPos,
  1533. [out] ULONG *pcChars);
  1534. // Allows the host to create a new debug document context
  1535. HRESULT CreateDebugDocumentContext(
  1536. [in] ULONG iCharPos,
  1537. [in] ULONG cChars,
  1538. [out] IDebugDocumentContext** ppddc);
  1539. // Bring this document to the top in the debugger UI.
  1540. // If the debugger isn't started already, start it now.
  1541. HRESULT BringDocumentToTop();
  1542. // Bring the given context in this document to the top
  1543. // in the debugger UI.
  1544. HRESULT BringDocumentContextToTop(IDebugDocumentContext *pddc);
  1545. };
  1546. /* IDebugDocumentHost
  1547. The interface from the IDebugDocumentHelper back to
  1548. the smart host or language engine. This interface
  1549. exposes host specific functionality such as syntax coloring,
  1550. */
  1551. [
  1552. object,
  1553. uuid(51973C27-CB0C-11d0-B5C9-00A0244A0E7A),
  1554. helpstring("IDebugDocumentHost Interface"),
  1555. pointer_default(unique)
  1556. ]
  1557. interface IDebugDocumentHost : IUnknown
  1558. {
  1559. // Return a particular range of characters in the original host document,
  1560. // added using AddDeferredText.
  1561. //
  1562. // It is acceptable for a host to return E_NOTIMPL for this method,
  1563. // as long as the host doesn't call AddDeferredText.
  1564. //
  1565. // (Note that this is text from the _original_ document. The host
  1566. // does not need to be responsible for keeping track of edits, etc.)
  1567. HRESULT GetDeferredText(
  1568. [in] DWORD dwTextStartCookie,
  1569. // Specifies a character text buffer. NULL means do not return characters.
  1570. [in, out, length_is(*pcNumChars), size_is(cMaxChars)] WCHAR *pcharText,
  1571. // Specifies a character attribute buffer. NULL means do not return attributes.
  1572. [in, out, length_is(*pcNumChars), size_is(cMaxChars)] SOURCE_TEXT_ATTR *pstaTextAttr,
  1573. // Indicates the actual number of characters/attributes returned. Must be set to zero
  1574. // before the call.
  1575. [in, out] ULONG *pcNumChars,
  1576. // Specifies the number maximum number of character desired.
  1577. [in] ULONG cMaxChars);
  1578. // Return the text attributes for an arbitrary block of document text.
  1579. // It is acceptable for hosts to return E_NOTIMPL, in which case the
  1580. // default attributes are used.
  1581. HRESULT GetScriptTextAttributes(
  1582. // The script block text. This string need not be null terminated.
  1583. [in, size_is(uNumCodeChars)] LPCOLESTR pstrCode,
  1584. // The number of characters in the script block text.
  1585. [in] ULONG uNumCodeChars,
  1586. // See IActiveScriptParse::ParseScriptText for a description of this argument.
  1587. [in] LPCOLESTR pstrDelimiter,
  1588. // See IActiveScriptParse::ParseScriptText for a description of this argument.
  1589. [in] DWORD dwFlags,
  1590. // Buffer to contain the returned attributes.
  1591. [in, out, size_is(uNumCodeChars)] SOURCE_TEXT_ATTR *pattr);
  1592. // Notify the host that a new document context is being created
  1593. // and allow the host to optionally return a controlling unknown
  1594. // for the new context.
  1595. //
  1596. // This allows the host to add new functionality to the helper-provided
  1597. // document contexts. It is acceptable for the host to return E_NOTIMPL
  1598. // or a null outer unknown for this method, in which case the context is
  1599. // used "as is".
  1600. HRESULT OnCreateDocumentContext(
  1601. [out] IUnknown** ppunkOuter);
  1602. // Return the full path (including file name) to the document's source file.
  1603. // *pfIsOriginalPath is TRUE if the path refers to the original file for the document.
  1604. // *pfIsOriginalPath is FALSE if the path refers to a newly created temporary file
  1605. // Returns E_FAIL if no source file can be created/determined.
  1606. HRESULT GetPathName(
  1607. [out] BSTR *pbstrLongName,
  1608. [out] BOOL *pfIsOriginalFile);
  1609. // Return just the name of the document, with no path information.
  1610. // (Used for "Save As...")
  1611. HRESULT GetFileName(
  1612. [out] BSTR *pbstrShortName);
  1613. // Notify the host that the document's source file has been saved and
  1614. // that its contents should be refreshed.
  1615. HRESULT NotifyChanged();
  1616. };
  1617. /* IDebugDocumentContext
  1618. Abstract representation of a portion of the debug document. For text documents
  1619. this consists of a character-position range.
  1620. */
  1621. [
  1622. object,
  1623. uuid(51973C28-CB0C-11d0-B5C9-00A0244A0E7A),
  1624. pointer_default(unique)
  1625. ]
  1626. interface IDebugDocumentContext : IUnknown
  1627. {
  1628. // Returns the document that contains this context.
  1629. HRESULT GetDocument(
  1630. [out] IDebugDocument **ppsd);
  1631. // Enumerates the code contexts associated with this document context. Generally there will
  1632. // only be one code context but there are important exceptions, such as include file
  1633. // or templates (in C++).
  1634. HRESULT EnumCodeContexts(
  1635. [out] IEnumDebugCodeContexts **ppescc);
  1636. }
  1637. /* <I> Debugger UI interfaces </I>
  1638. Below are the interfaces that allow other components to launch
  1639. and interfact with the debugger UI.
  1640. <H1> IDebugSessionProvider </H1>
  1641. The primary interface provided by a debugger IDE to enable host and
  1642. language initiated debugging. Its sole purpose is to establish a debug
  1643. session for a running application.
  1644. */
  1645. [
  1646. object,
  1647. uuid(51973C29-CB0C-11d0-B5C9-00A0244A0E7A),
  1648. helpstring("IDebugSessionProvider Interface"),
  1649. pointer_default(unique)
  1650. ]
  1651. interface IDebugSessionProvider : IUnknown
  1652. {
  1653. // Initiates a debug session with the specified application. The debugger should
  1654. // call IRemoteDebugApplication::ConnectDebugger before returning from this call.
  1655. HRESULT StartDebugSession(
  1656. [in] IRemoteDebugApplication *pda);
  1657. };
  1658. /* IApplicationDebugger
  1659. This is the primary interface exposed by a debugger IDE.
  1660. */
  1661. [
  1662. object,
  1663. uuid(51973C2a-CB0C-11d0-B5C9-00A0244A0E7A),
  1664. helpstring("IApplicationDebugger Interface"),
  1665. pointer_default(unique)
  1666. ]
  1667. interface IApplicationDebugger : IUnknown
  1668. {
  1669. // Indicates if the debugger is alive. Should always return S_OK. If the debugger
  1670. // has rudely shut down COM will return an error from the marshalling proxy.
  1671. HRESULT QueryAlive(void);
  1672. // Provides a mechanism for hosts and language engines running out-of-process to the
  1673. // debugger to create objects in the debugger process. This can be used for any purpose,
  1674. // including extending the debugger UI. This method simply delegates to CoCreateInstance.
  1675. HRESULT CreateInstanceAtDebugger(
  1676. [in] REFCLSID rclsid, // Class identifier (CLSID) of the object
  1677. [in] IUnknown *pUnkOuter, // Object is or isn't part of an aggregate
  1678. [in] DWORD dwClsContext, // Context for running executable code
  1679. [in] REFIID riid, // Interface identifier
  1680. [out, iid_is(riid)] IUnknown **ppvObject);
  1681. // Points to requested interface pointer
  1682. // This method is called when IDebugApplication::DebugOutput is called. The debugger
  1683. // can use this to display the string in an output window.
  1684. HRESULT onDebugOutput(
  1685. [in] LPCOLESTR pstr);
  1686. // This method is called when a breakpoint is hit. The application will remain
  1687. // suspended until the debugger IDE calls IDebugApplication::ResumeFromBreakPoint.
  1688. HRESULT onHandleBreakPoint(
  1689. // Indicates the thread in which the breakpoint occured.
  1690. [in] IRemoteDebugApplicationThread *prpt,
  1691. // Indicates the reason for the breakpoint.
  1692. [in] BREAKREASON br,
  1693. // optional runtime error info (for when br == BREAKREASON_ERROR)
  1694. [in] IActiveScriptErrorDebug *pError);
  1695. // This method is called when IDebugApplication::Close is called.
  1696. HRESULT onClose(void);
  1697. // Handle a custom event.
  1698. // The semantics of the GUID and IUnknown are entirely application/debugger defined
  1699. // This method may return E_NOTIMPL.
  1700. HRESULT onDebuggerEvent(
  1701. [in] REFIID riid,
  1702. [in] IUnknown *punk);
  1703. };
  1704. /* IApplicationDebuggerUI
  1705. This is a secondary interface exposed by some debugger IDE
  1706. that allows an external component to have additional control
  1707. over the debuggers UI. <preliminary>
  1708. */
  1709. [
  1710. object,
  1711. uuid(51973C2b-CB0C-11d0-B5C9-00A0244A0E7A),
  1712. helpstring("IApplicationDebuggerUI Interface"),
  1713. pointer_default(unique)
  1714. ]
  1715. interface IApplicationDebuggerUI : IUnknown
  1716. {
  1717. // Bring the window corresponding to the given debug document to the front.
  1718. // Returns E_INVALIDARG if the document is not known.
  1719. HRESULT BringDocumentToTop([in] IDebugDocumentText* pddt);
  1720. // Bring the window containing the given doc context to the front,
  1721. // and scroll it to the correct location.
  1722. // Returns E_INVALIDARG if the context is not known.
  1723. HRESULT BringDocumentContextToTop([in] IDebugDocumentContext* pddc);
  1724. };
  1725. /* IMachineDebugManager
  1726. The primary interface to the Machine Debug Manager.
  1727. */
  1728. cpp_quote("EXTERN_C const CLSID CLSID_MachineDebugManager;")
  1729. [
  1730. object,
  1731. uuid(51973C2c-CB0C-11d0-B5C9-00A0244A0E7A),
  1732. helpstring("IMachineDebugManager Interface"),
  1733. pointer_default(unique)
  1734. ]
  1735. interface IMachineDebugManager : IUnknown
  1736. {
  1737. // Adds an application to the running application list. This method is called by the
  1738. // process debug manager whenever IProcessDebugManager::AddApplication is called.
  1739. HRESULT AddApplication(
  1740. [in] IRemoteDebugApplication *pda,
  1741. [out] DWORD *pdwAppCookie);
  1742. // Removes an application from the running application list. This method is called by the
  1743. // process debug manager whenever IProcessDebugManager::RemoveApplication is called.
  1744. HRESULT RemoveApplication(
  1745. [in] DWORD dwAppCookie);
  1746. // Returns an enumerator of the current list of running applications. Used by the debugger
  1747. // IDE to display and attach applications for debugging purposes.
  1748. HRESULT EnumApplications(
  1749. [out] IEnumRemoteDebugApplications **ppeda);
  1750. };
  1751. /* IMachineDebugManagerCookie - As IMachineDebugManager with Debug Cookie support
  1752. */
  1753. [
  1754. object,
  1755. uuid(51973C2d-CB0C-11d0-B5C9-00A0244A0E7A),
  1756. helpstring("IMachineDebugManagerCookie Interface"),
  1757. pointer_default(unique)
  1758. ]
  1759. interface IMachineDebugManagerCookie : IUnknown
  1760. {
  1761. // Adds an application to the running application list. This method is called by the
  1762. // process debug manager whenever IProcessDebugManager::AddApplication is called.
  1763. HRESULT AddApplication(
  1764. [in] IRemoteDebugApplication *pda,
  1765. [in] DWORD dwDebugAppCookie,
  1766. [out] DWORD *pdwAppCookie);
  1767. // Removes an application from the running application list. This method is called by the
  1768. // process debug manager whenever IProcessDebugManager::RemoveApplication is called.
  1769. HRESULT RemoveApplication(
  1770. [in] DWORD dwDebugAppCookie,
  1771. [in] DWORD dwAppCookie);
  1772. // Returns an enumerator of the current list of running applications. Used by the debugger
  1773. // IDE to display and attach applications for debugging purposes.
  1774. HRESULT EnumApplications(
  1775. [out] IEnumRemoteDebugApplications **ppeda);
  1776. };
  1777. /* IMachineDebugManagerEvents
  1778. This event interface is used to signal changes in the running application
  1779. list maintained by the machine debug manager. It can be used by the debugger
  1780. IDE to display a dynamic list of applications.
  1781. */
  1782. [
  1783. object,
  1784. uuid(51973C2e-CB0C-11d0-B5C9-00A0244A0E7A),
  1785. helpstring("IMachineDebugManagerEvents Interface"),
  1786. pointer_default(unique)
  1787. ]
  1788. interface IMachineDebugManagerEvents : IUnknown
  1789. {
  1790. // Indicates that a new application has appeared on the running application list.
  1791. HRESULT onAddApplication(
  1792. [in] IRemoteDebugApplication *pda,
  1793. [in] DWORD dwAppCookie);
  1794. // Indicates that an application has been removed from the running application list.
  1795. HRESULT onRemoveApplication(
  1796. [in] IRemoteDebugApplication *pda,
  1797. [in] DWORD dwAppCookie);
  1798. };
  1799. /* <I> Process Debug Manager Interfaces </I>
  1800. Below are the details of the interfaces for the process debug manager.
  1801. <H1> IProcessDebugManager </H1>
  1802. The primary interface to the process debug manager.
  1803. */
  1804. cpp_quote("EXTERN_C const CLSID CLSID_ProcessDebugManager;")
  1805. cpp_quote("#ifndef DISABLE_ACTIVDBG_INTERFACE_WRAPPERS")
  1806. cpp_quote("#ifdef _WIN64")
  1807. cpp_quote("#define IProcessDebugManager IProcessDebugManager64")
  1808. cpp_quote("#define IID_IProcessDebugManager IID_IProcessDebugManager64")
  1809. cpp_quote("#else")
  1810. cpp_quote("#define IProcessDebugManager IProcessDebugManager32")
  1811. cpp_quote("#define IID_IProcessDebugManager IID_IProcessDebugManager32")
  1812. cpp_quote("#endif")
  1813. cpp_quote("#endif")
  1814. [
  1815. object,
  1816. uuid(51973C2f-CB0C-11d0-B5C9-00A0244A0E7A),
  1817. helpstring("IProcessDebugManager Interface"),
  1818. pointer_default(unique),
  1819. local
  1820. ]
  1821. interface IProcessDebugManager32 : IUnknown
  1822. {
  1823. // Creates a new debug application object. The new object is not added to the
  1824. // running application list and has no name.
  1825. HRESULT CreateApplication(
  1826. [out] IDebugApplication32 **ppda);
  1827. // Returns a default application object for the current process, creating one and adding
  1828. // it to the running application list if necessary. Language engines should use this
  1829. // application if they are running on a host that does not provide an application.
  1830. HRESULT GetDefaultApplication(
  1831. [out] IDebugApplication32 **ppda);
  1832. // Adds an application to the running application list in the machine debug manager.
  1833. HRESULT AddApplication(
  1834. [in] IDebugApplication32 *pda,
  1835. // Returns a cookie used to remove the application from the machine debug manager.
  1836. [out] DWORD *pdwAppCookie);
  1837. // Removes an application from the running application list.
  1838. HRESULT RemoveApplication(
  1839. // The cookie provided by AddApplication.
  1840. [in] DWORD dwAppCookie);
  1841. HRESULT CreateDebugDocumentHelper(
  1842. [in] IUnknown *punkOuter,
  1843. [out] IDebugDocumentHelper32** pddh);
  1844. };
  1845. [
  1846. object,
  1847. uuid(56b9fc1c-63a9-4cc1-ac21-087d69a17fab),
  1848. helpstring("IProcessDebugManager Interface"),
  1849. pointer_default(unique),
  1850. local
  1851. ]
  1852. interface IProcessDebugManager64 : IUnknown
  1853. {
  1854. // Creates a new debug application object. The new object is not added to the
  1855. // running application list and has no name.
  1856. HRESULT CreateApplication(
  1857. [out] IDebugApplication64 **ppda);
  1858. // Returns a default application object for the current process, creating one and adding
  1859. // it to the running application list if necessary. Language engines should use this
  1860. // application if they are running on a host that does not provide an application.
  1861. HRESULT GetDefaultApplication(
  1862. [out] IDebugApplication64 **ppda);
  1863. // Adds an application to the running application list in the machine debug manager.
  1864. HRESULT AddApplication(
  1865. [in] IDebugApplication64 *pda,
  1866. // Returns a cookie used to remove the application from the machine debug manager.
  1867. [out] DWORD *pdwAppCookie);
  1868. // Removes an application from the running application list.
  1869. HRESULT RemoveApplication(
  1870. // The cookie provided by AddApplication.
  1871. [in] DWORD dwAppCookie);
  1872. HRESULT CreateDebugDocumentHelper(
  1873. [in] IUnknown *punkOuter,
  1874. [out] IDebugDocumentHelper64** pddh);
  1875. };
  1876. /* IRemoteDebugApplication
  1877. An abstraction representing a running application. It need not correspond to an OS process. Applications are the smallest debuggable unit; that is, the debugger IDE normally targets an application for debugging.
  1878. The application object is normally implemented by the Process Debug Manager.
  1879. <Issue>
  1880. Stepping from interpreted code to native code needs additional help from the LE's. The LE's need to source an event that they are leaving the namespace. Additionally the LE's will need to provide some PC info of either where they are going to at le
  1881. ast where they are (assuming some thin thunk prior to calling out from the namespace). Both teams are in agreement on this.
  1882. *Action Item*
  1883. PiersH and SamMck to investigate and come up with events and PC's. Additionally ShonK may need be involved to explain what info JS and VBS can give.
  1884. </Issue>
  1885. */
  1886. [
  1887. object,
  1888. uuid(51973C30-CB0C-11d0-B5C9-00A0244A0E7A),
  1889. helpstring("IRemoteDebugApplication Interface"),
  1890. pointer_default(unique)
  1891. ]
  1892. interface IRemoteDebugApplication : IUnknown
  1893. {
  1894. // Continue an application which is currently in a breakpoint.
  1895. HRESULT ResumeFromBreakPoint(
  1896. // For stepping modes, the thread which is to be affected by the stepping mode.
  1897. [in] IRemoteDebugApplicationThread *prptFocus,
  1898. // The action to take (step mode, etc.) upon resuming the application
  1899. [in] BREAKRESUMEACTION bra,
  1900. // the action to take in the case that we stopped because of an error
  1901. [in] ERRORRESUMEACTION era);
  1902. // Causes the application to break into the debugger at the earliest opportunity. Note
  1903. // that a long time may elapse before the application actually breaks, particularly if
  1904. // the application is not currently executing script code.
  1905. HRESULT CauseBreak(void);
  1906. // Connects a debugger to the application. Only one debugger may be connected at a
  1907. // time; this method fails if there is already a debugger connected
  1908. HRESULT ConnectDebugger(
  1909. [in] IApplicationDebugger *pad);
  1910. // Disconnects the current debugger from the application.
  1911. HRESULT DisconnectDebugger(void);
  1912. // Returns the current debugger connected to the application.
  1913. HRESULT GetDebugger(
  1914. [out] IApplicationDebugger **pad);
  1915. // Provides a mechanism for the debugger IDE, running out-of-process to the
  1916. // application, to create objects in the application process.
  1917. // This method simply delegates to CoCreateInstance.
  1918. HRESULT CreateInstanceAtApplication(
  1919. [in] REFCLSID rclsid, // Class identifier (CLSID) of the object
  1920. // Note: This parameter may have to be removed.
  1921. [in] IUnknown *pUnkOuter, // Object is or isn't part of an aggregate
  1922. [in] DWORD dwClsContext, // Context for running executable code
  1923. [in] REFIID riid, // Interface identifier
  1924. [out, iid_is(riid)] IUnknown **ppvObject);
  1925. // Points to requested interface pointer
  1926. // Indicates if the application is alive. Should always return S_OK. If the application
  1927. // process has rudely shut down COM will return an error from the marshalling proxy.
  1928. HRESULT QueryAlive(
  1929. void);
  1930. // Enumerates all threads known to be associated with the application.
  1931. // New threads may be added at any time.
  1932. HRESULT EnumThreads(
  1933. [out] IEnumRemoteDebugApplicationThreads **pperdat);
  1934. // Returns the application node under which all nodes associated with the
  1935. // application are added.
  1936. HRESULT GetName(
  1937. [out] BSTR *pbstrName);
  1938. // Returns a node for the application
  1939. HRESULT GetRootNode(
  1940. [out] IDebugApplicationNode **ppdanRoot);
  1941. // Returns an enumerator that lists the global expression
  1942. // contexts for all languages running in this application
  1943. HRESULT EnumGlobalExpressionContexts (
  1944. [out] IEnumDebugExpressionContexts **ppedec);
  1945. };
  1946. /* IDebugApplication
  1947. This interface is an extension of IRemoteDebugApplication, exposing
  1948. non-remotable methods for use by language engines and hosts.
  1949. */
  1950. cpp_quote("#ifndef DISABLE_ACTIVDBG_INTERFACE_WRAPPERS")
  1951. cpp_quote("#ifdef _WIN64")
  1952. cpp_quote("#define IDebugApplication IDebugApplication64")
  1953. cpp_quote("#define IID_IDebugApplication IID_IDebugApplication64")
  1954. cpp_quote("#else")
  1955. cpp_quote("#define IDebugApplication IDebugApplication32")
  1956. cpp_quote("#define IID_IDebugApplication IID_IDebugApplication32")
  1957. cpp_quote("#endif")
  1958. cpp_quote("#endif")
  1959. [
  1960. object,
  1961. uuid(51973C32-CB0C-11d0-B5C9-00A0244A0E7A),
  1962. helpstring("IDebugApplication Interface"),
  1963. pointer_default(unique),
  1964. local
  1965. ]
  1966. interface IDebugApplication32 : IRemoteDebugApplication
  1967. {
  1968. // Sets the name of the application. The provided name will be returned in subsequent calls
  1969. // to IRemoteDebugApplication::GetName.
  1970. HRESULT SetName(
  1971. [in] LPCOLESTR pstrName);
  1972. // This method is called by language engines, in single step mode, just before they
  1973. // return to their caller. The process debug manager uses this opportunity to notify all
  1974. // other script engines that they should break at the first opportunity. This is how
  1975. // cross language step modes are implemented.
  1976. HRESULT StepOutComplete(void);
  1977. // Causes the given string to be displayed by the debugger IDE, normally in an output
  1978. // window. This mechanism provides the means for a language engine to implement language
  1979. // specific debugging output support. Example: Debug.writeln("Help") in JavaScript.
  1980. HRESULT DebugOutput(
  1981. [in] LPCOLESTR pstr);
  1982. // Causes a default debugger IDE to be started and a debug session to be attached to
  1983. // this application if one does not already exist. This is used to implement just-in-time
  1984. // debugging.
  1985. HRESULT StartDebugSession(void);
  1986. // Called by the language engine in the context of a thread that has hit a breakpoint.
  1987. // This method causes the current thread to block and a notification of the breakpoint
  1988. // to be sent to the debugger IDE. When the debugger IDE resumes the application this
  1989. // method returns with the action to be taken.
  1990. //
  1991. // Note: While in the breakpoint the language engine may be called in this thread to do
  1992. // various things such as enumerating stack frames or evaluating expressions.
  1993. HRESULT HandleBreakPoint(
  1994. [in] BREAKREASON br,
  1995. [out] BREAKRESUMEACTION *pbra);
  1996. // Causes this application to release all references and enter a zombie state. Called
  1997. // by the owner of the application generally on shut down.
  1998. HRESULT Close(void);
  1999. // Returns the current break flags for the application.
  2000. HRESULT GetBreakFlags(
  2001. [out] APPBREAKFLAGS *pabf,
  2002. [out] IRemoteDebugApplicationThread **pprdatSteppingThread);
  2003. // Returns the application thread object associated with the currently running thread.
  2004. HRESULT GetCurrentThread(
  2005. [out] IDebugApplicationThread **pat);
  2006. // Creates an IDebugAsyncOperation object to wrap a provided IDebugSyncOperation object.
  2007. // This provides a mechanism for language engines to implement asynchronous expression and
  2008. // evaluation, etc. without having to know the details of synchronization with the
  2009. // debugger thread. See the descriptions for IDebugSyncOperation and IDebugAsyncOperation
  2010. // for more details.
  2011. HRESULT CreateAsyncDebugOperation(
  2012. [in] IDebugSyncOperation *psdo,
  2013. [out] IDebugAsyncOperation **ppado);
  2014. // Adds a stack frame sniffer to this application. Generally called by a language engine
  2015. // to expose its stack frames to the debugger. It is possible for other entities to
  2016. // expose stack frames.
  2017. HRESULT AddStackFrameSniffer(
  2018. [in] IDebugStackFrameSniffer *pdsfs,
  2019. // Returns a cookie that is used to remove this stack frame sniffer
  2020. // from the application.
  2021. [out] DWORD *pdwCookie);
  2022. // Removes a stack frame sniffer from this application.
  2023. HRESULT RemoveStackFrameSniffer(
  2024. // The cookie returned by AddStackFrameSniffer.
  2025. [in] DWORD dwCookie);
  2026. // Returns S_OK if the current running thread is the debugger thread.
  2027. // Otherwise, returns S_FALSE.
  2028. HRESULT QueryCurrentThreadIsDebuggerThread(
  2029. void);
  2030. // Provides a mechanism for the caller to run code in the debugger thread. This is generally
  2031. // used so that language engines and hosts can implement free threaded objects on top
  2032. // of their single threaded implementations.
  2033. HRESULT SynchronousCallInDebuggerThread(
  2034. [in] IDebugThreadCall32 *pptc,
  2035. [in] DWORD dwParam1,
  2036. [in] DWORD dwParam2,
  2037. [in] DWORD dwParam3);
  2038. // Creates a new application node which is associated with a specific
  2039. // document provider. Before it is visible, the new node must be
  2040. // attached to a parent node.
  2041. HRESULT CreateApplicationNode(
  2042. [out] IDebugApplicationNode **ppdanNew);
  2043. // Fire a generic event to the IApplicationDebugger (if any)
  2044. // The semantics of the GUID and IUnknown are entirely application/debugger defined
  2045. //
  2046. // This method is currently unimplemented but is here to allow for future extensions.
  2047. HRESULT FireDebuggerEvent(
  2048. [in] REFGUID riid,
  2049. [in] IUnknown *punk);
  2050. // Called by the language engine in the context of a thread that has caused a runtime error .
  2051. // This method causes the current thread to block and a notification of the error
  2052. // to be sent to the debugger IDE. When the debugger IDE resumes the application this
  2053. // method returns with the action to be taken.
  2054. //
  2055. // Note: While in the runtime error the language engine may be called in this thread to do
  2056. // various things such as enumerating stack frames or evaluating expressions.
  2057. HRESULT HandleRuntimeError(
  2058. [in] IActiveScriptErrorDebug *pErrorDebug, // the error that occurred
  2059. [in] IActiveScriptSite *pScriptSite, // the script site of the thread
  2060. [out] BREAKRESUMEACTION *pbra, // how to continue execution (stepping etc...)
  2061. [out] ERRORRESUMEACTION *perra, // how to handle the error case
  2062. [out] BOOL *pfCallOnScriptError); // if TRUE then engine should call IActiveScriptSite::OnScriptError()
  2063. // return TRUE if there is a JIT debugger registered
  2064. BOOL FCanJitDebug ();
  2065. // returns TRUE if a JIT debugger is registered and it is registered to auto-JIT debug dumb hosts
  2066. BOOL FIsAutoJitDebugEnabled ();
  2067. // Adds a global expression context provider to this application
  2068. HRESULT AddGlobalExpressionContextProvider(
  2069. [in] IProvideExpressionContexts *pdsfs,
  2070. // Returns a cookie that is used to remove this global expression context provider
  2071. // from the application.
  2072. [out] DWORD *pdwCookie);
  2073. // Removes a global expression context provider from this application.
  2074. HRESULT RemoveGlobalExpressionContextProvider(
  2075. // The cookie returned by AddGlobalExpressionContextProvider.
  2076. [in] DWORD dwCookie);
  2077. }
  2078. [
  2079. object,
  2080. uuid(4dedc754-04c7-4f10-9e60-16a390fe6e62),
  2081. helpstring("IDebugApplication Interface"),
  2082. pointer_default(unique),
  2083. local
  2084. ]
  2085. interface IDebugApplication64 : IRemoteDebugApplication
  2086. {
  2087. // Sets the name of the application. The provided name will be returned in subsequent calls
  2088. // to IRemoteDebugApplication::GetName.
  2089. HRESULT SetName(
  2090. [in] LPCOLESTR pstrName);
  2091. // This method is called by language engines, in single step mode, just before they
  2092. // return to their caller. The process debug manager uses this opportunity to notify all
  2093. // other script engines that they should break at the first opportunity. This is how
  2094. // cross language step modes are implemented.
  2095. HRESULT StepOutComplete(void);
  2096. // Causes the given string to be displayed by the debugger IDE, normally in an output
  2097. // window. This mechanism provides the means for a language engine to implement language
  2098. // specific debugging output support. Example: Debug.writeln("Help") in JavaScript.
  2099. HRESULT DebugOutput(
  2100. [in] LPCOLESTR pstr);
  2101. // Causes a default debugger IDE to be started and a debug session to be attached to
  2102. // this application if one does not already exist. This is used to implement just-in-time
  2103. // debugging.
  2104. HRESULT StartDebugSession(void);
  2105. // Called by the language engine in the context of a thread that has hit a breakpoint.
  2106. // This method causes the current thread to block and a notification of the breakpoint
  2107. // to be sent to the debugger IDE. When the debugger IDE resumes the application this
  2108. // method returns with the action to be taken.
  2109. //
  2110. // Note: While in the breakpoint the language engine may be called in this thread to do
  2111. // various things such as enumerating stack frames or evaluating expressions.
  2112. HRESULT HandleBreakPoint(
  2113. [in] BREAKREASON br,
  2114. [out] BREAKRESUMEACTION *pbra);
  2115. // Causes this application to release all references and enter a zombie state. Called
  2116. // by the owner of the application generally on shut down.
  2117. HRESULT Close(void);
  2118. // Returns the current break flags for the application.
  2119. HRESULT GetBreakFlags(
  2120. [out] APPBREAKFLAGS *pabf,
  2121. [out] IRemoteDebugApplicationThread **pprdatSteppingThread);
  2122. // Returns the application thread object associated with the currently running thread.
  2123. HRESULT GetCurrentThread(
  2124. [out] IDebugApplicationThread **pat);
  2125. // Creates an IDebugAsyncOperation object to wrap a provided IDebugSyncOperation object.
  2126. // This provides a mechanism for language engines to implement asynchronous expression and
  2127. // evaluation, etc. without having to know the details of synchronization with the
  2128. // debugger thread. See the descriptions for IDebugSyncOperation and IDebugAsyncOperation
  2129. // for more details.
  2130. HRESULT CreateAsyncDebugOperation(
  2131. [in] IDebugSyncOperation *psdo,
  2132. [out] IDebugAsyncOperation **ppado);
  2133. // Adds a stack frame sniffer to this application. Generally called by a language engine
  2134. // to expose its stack frames to the debugger. It is possible for other entities to
  2135. // expose stack frames.
  2136. HRESULT AddStackFrameSniffer(
  2137. [in] IDebugStackFrameSniffer *pdsfs,
  2138. // Returns a cookie that is used to remove this stack frame sniffer
  2139. // from the application.
  2140. [out] DWORD *pdwCookie);
  2141. // Removes a stack frame sniffer from this application.
  2142. HRESULT RemoveStackFrameSniffer(
  2143. // The cookie returned by AddStackFrameSniffer.
  2144. [in] DWORD dwCookie);
  2145. // Returns S_OK if the current running thread is the debugger thread.
  2146. // Otherwise, returns S_FALSE.
  2147. HRESULT QueryCurrentThreadIsDebuggerThread(
  2148. void);
  2149. // Provides a mechanism for the caller to run code in the debugger thread. This is generally
  2150. // used so that language engines and hosts can implement free threaded objects on top
  2151. // of their single threaded implementations.
  2152. HRESULT SynchronousCallInDebuggerThread(
  2153. [in] IDebugThreadCall64 *pptc,
  2154. [in] DWORDLONG dwParam1,
  2155. [in] DWORDLONG dwParam2,
  2156. [in] DWORDLONG dwParam3);
  2157. // Creates a new application node which is associated with a specific
  2158. // document provider. Before it is visible, the new node must be
  2159. // attached to a parent node.
  2160. HRESULT CreateApplicationNode(
  2161. [out] IDebugApplicationNode **ppdanNew);
  2162. // Fire a generic event to the IApplicationDebugger (if any)
  2163. // The semantics of the GUID and IUnknown are entirely application/debugger defined
  2164. //
  2165. // This method is currently unimplemented but is here to allow for future extensions.
  2166. HRESULT FireDebuggerEvent(
  2167. [in] REFGUID riid,
  2168. [in] IUnknown *punk);
  2169. // Called by the language engine in the context of a thread that has caused a runtime error .
  2170. // This method causes the current thread to block and a notification of the error
  2171. // to be sent to the debugger IDE. When the debugger IDE resumes the application this
  2172. // method returns with the action to be taken.
  2173. //
  2174. // Note: While in the runtime error the language engine may be called in this thread to do
  2175. // various things such as enumerating stack frames or evaluating expressions.
  2176. HRESULT HandleRuntimeError(
  2177. [in] IActiveScriptErrorDebug *pErrorDebug, // the error that occurred
  2178. [in] IActiveScriptSite *pScriptSite, // the script site of the thread
  2179. [out] BREAKRESUMEACTION *pbra, // how to continue execution (stepping etc...)
  2180. [out] ERRORRESUMEACTION *perra, // how to handle the error case
  2181. [out] BOOL *pfCallOnScriptError); // if TRUE then engine should call IActiveScriptSite::OnScriptError()
  2182. // return TRUE if there is a JIT debugger registered
  2183. BOOL FCanJitDebug ();
  2184. // returns TRUE if a JIT debugger is registered and it is registered to auto-JIT debug dumb hosts
  2185. BOOL FIsAutoJitDebugEnabled ();
  2186. // Adds a global expression context provider to this application
  2187. HRESULT AddGlobalExpressionContextProvider(
  2188. [in] IProvideExpressionContexts *pdsfs,
  2189. // Returns a cookie that is used to remove this global expression context provider
  2190. // from the application.
  2191. [out] DWORDLONG *pdwCookie);
  2192. // Removes a global expression context provider from this application.
  2193. HRESULT RemoveGlobalExpressionContextProvider(
  2194. // The cookie returned by AddGlobalExpressionContextProvider.
  2195. [in] DWORDLONG dwCookie);
  2196. };
  2197. /* IRemoteDebugApplicationEvents:
  2198. This is the event interface supplied by a debug application: It is
  2199. always called from within the debugger thread.
  2200. <Issue>
  2201. The current PDM event model isn't very extensible. We explained our current event model to Sam, Bob, Philip. It was received well.
  2202. *Action Item*
  2203. SamMck to examine the current Vegas scheme to consider adding it to current ASD.
  2204. </Issue>
  2205. */
  2206. [
  2207. object,
  2208. uuid(51973C33-CB0C-11d0-B5C9-00A0244A0E7A),
  2209. helpstring("IRemoteDebugApplicationEvents Interface"),
  2210. pointer_default(unique)
  2211. ]
  2212. interface IRemoteDebugApplicationEvents : IUnknown
  2213. {
  2214. HRESULT OnConnectDebugger(
  2215. [in] IApplicationDebugger *pad);
  2216. HRESULT OnDisconnectDebugger(void);
  2217. HRESULT OnSetName(
  2218. [in] LPCOLESTR pstrName);
  2219. HRESULT OnDebugOutput(
  2220. [in] LPCOLESTR pstr);
  2221. HRESULT OnClose(void);
  2222. HRESULT OnEnterBreakPoint(
  2223. [in] IRemoteDebugApplicationThread *prdat);
  2224. HRESULT OnLeaveBreakPoint(
  2225. [in] IRemoteDebugApplicationThread *prdat);
  2226. HRESULT OnCreateThread(
  2227. [in] IRemoteDebugApplicationThread *prdat);
  2228. HRESULT OnDestroyThread(
  2229. [in] IRemoteDebugApplicationThread *prdat);
  2230. HRESULT OnBreakFlagChange(
  2231. [in] APPBREAKFLAGS abf,
  2232. [in] IRemoteDebugApplicationThread *prdatSteppingThread);
  2233. };
  2234. /* IDebugApplicationNode
  2235. Provides the functionality of IDebugDocumentProvider, plus a context within a project tree.
  2236. */
  2237. [
  2238. object,
  2239. uuid(51973C34-CB0C-11d0-B5C9-00A0244A0E7A),
  2240. pointer_default(unique)
  2241. ]
  2242. interface IDebugApplicationNode : IDebugDocumentProvider {
  2243. HRESULT EnumChildren(
  2244. [out] IEnumDebugApplicationNodes **pperddp);
  2245. HRESULT GetParent(
  2246. [out] IDebugApplicationNode **pprddp);
  2247. HRESULT SetDocumentProvider(
  2248. [in] IDebugDocumentProvider *pddp);
  2249. HRESULT Close(void);
  2250. HRESULT Attach(
  2251. [in] IDebugApplicationNode *pdanParent);
  2252. HRESULT Detach(void);
  2253. }
  2254. /* IDebugApplicationNodeEvents
  2255. Event interface for DebugApplicationNode object.
  2256. */
  2257. [
  2258. object,
  2259. uuid(51973C35-CB0C-11d0-B5C9-00A0244A0E7A),
  2260. pointer_default(unique)
  2261. ]
  2262. interface IDebugApplicationNodeEvents : IUnknown {
  2263. HRESULT onAddChild(
  2264. [in] IDebugApplicationNode *prddpChild);
  2265. HRESULT onRemoveChild(
  2266. [in] IDebugApplicationNode *prddpChild);
  2267. HRESULT onDetach(void);
  2268. HRESULT onAttach(
  2269. [in] IDebugApplicationNode *prddpParent);
  2270. }
  2271. /* IDebugThreadCall
  2272. IDebugThreadCall is implemented by a component making a cross-thread call
  2273. using the IDebugThread marshalling implementation in the PDM. It is called
  2274. by the PDM in the desired thread and should dispatches the call to the desired
  2275. implementation, casting the parameter information passed in the dwParam's to
  2276. the appropriate top. It is, of course, a free-threaded object.
  2277. */
  2278. cpp_quote("#ifndef DISABLE_ACTIVDBG_INTERFACE_WRAPPERS")
  2279. cpp_quote("#ifdef _WIN64")
  2280. cpp_quote("#define IDebugThreadCall IDebugThreadCall64")
  2281. cpp_quote("#define IID_IDebugThreadCall IID_IDebugThreadCall64")
  2282. cpp_quote("#else")
  2283. cpp_quote("#define IDebugThreadCall IDebugThreadCall32")
  2284. cpp_quote("#define IID_IDebugThreadCall IID_IDebugThreadCall32")
  2285. cpp_quote("#endif")
  2286. cpp_quote("#endif")
  2287. [
  2288. object,
  2289. uuid(51973C36-CB0C-11d0-B5C9-00A0244A0E7A),
  2290. pointer_default(unique),
  2291. local
  2292. ]
  2293. interface IDebugThreadCall32 : IUnknown
  2294. {
  2295. HRESULT ThreadCallHandler(
  2296. [in] DWORD dwParam1,
  2297. [in] DWORD dwParam2,
  2298. [in] DWORD dwParam3);
  2299. }
  2300. [
  2301. object,
  2302. uuid(cb3fa335-e979-42fd-9fcf-a7546a0f3905),
  2303. pointer_default(unique),
  2304. local
  2305. ]
  2306. interface IDebugThreadCall64 : IUnknown
  2307. {
  2308. HRESULT ThreadCallHandler(
  2309. [in] DWORDLONG dwParam1,
  2310. [in] DWORDLONG dwParam2,
  2311. [in] DWORDLONG dwParam3);
  2312. }
  2313. /* IRemoteDebugApplicationThread
  2314. An abstraction representing a thread of execution within a particular application.
  2315. */
  2316. [
  2317. object,
  2318. uuid(51973C37-CB0C-11d0-B5C9-00A0244A0E7A),
  2319. pointer_default(unique)
  2320. ]
  2321. interface IRemoteDebugApplicationThread : IUnknown
  2322. {
  2323. // Returns an operating system dependent identifier associated with the thread.
  2324. //
  2325. // Note: The returned value does not need to be unique across machines.
  2326. HRESULT GetSystemThreadId(
  2327. [out] DWORD *dwThreadId);
  2328. // Returns the application object associated with the thread.
  2329. HRESULT GetApplication(
  2330. [out] IRemoteDebugApplication **pprda);
  2331. // Returns an enumerator for the stack frames associated with the thread. Can only
  2332. // be called when in a breakpoint. The stack frame enumerator enumerates stack frames
  2333. // in the most recently called order.
  2334. HRESULT EnumStackFrames(
  2335. [out] IEnumDebugStackFrames **ppedsf);
  2336. HRESULT GetDescription(
  2337. [out] BSTR *pbstrDescription,
  2338. [out] BSTR *pbstrState);
  2339. // Forces execution to continue as close as possible to the
  2340. // given code context, in the context of the given frame.
  2341. // Either of these arguments may be NULL, representing the
  2342. // current frame or context.
  2343. HRESULT SetNextStatement (
  2344. [in] IDebugStackFrame *pStackFrame,
  2345. [in] IDebugCodeContext *pCodeContext);
  2346. // Thread State flags
  2347. typedef DWORD THREAD_STATE;
  2348. const THREAD_STATE THREAD_STATE_RUNNING = 0x00000001;
  2349. const THREAD_STATE THREAD_STATE_SUSPENDED = 0x00000002;
  2350. const THREAD_STATE THREAD_BLOCKED = 0x00000004;
  2351. const THREAD_STATE THREAD_OUT_OF_CONTEXT = 0x00000008;
  2352. // returns the current state of the thread
  2353. HRESULT GetState (
  2354. [out] DWORD *pState);
  2355. // suspends the thread (increments the suspend count)
  2356. HRESULT Suspend (
  2357. [out] DWORD *pdwCount);
  2358. // resumes the thread (decrements the suspend count)
  2359. HRESULT Resume (
  2360. [out] DWORD *pdwCount);
  2361. // returns the current suspend count of the thread
  2362. HRESULT GetSuspendCount (
  2363. [out] DWORD *pdwCount);
  2364. }
  2365. cpp_quote("#ifndef DISABLE_ACTIVDBG_INTERFACE_WRAPPERS")
  2366. cpp_quote("#ifdef _WIN64")
  2367. cpp_quote("#define SynchronousCallIntoThread SynchronousCallIntoThread64")
  2368. cpp_quote("#else")
  2369. cpp_quote("#define SynchronousCallIntoThread SynchronousCallIntoThread32")
  2370. cpp_quote("#endif")
  2371. cpp_quote("#endif")
  2372. /* IDebugApplicationThread
  2373. An extension of IRemoteDebugApplicationThread that provides non-remotable
  2374. access to the thread. This interface is used by language engines and hosts
  2375. to provide thread synchronization and to maintain thread specific debug state information.
  2376. */
  2377. [
  2378. object,
  2379. uuid(51973C38-CB0C-11d0-B5C9-00A0244A0E7A),
  2380. pointer_default(unique),
  2381. local
  2382. ]
  2383. interface IDebugApplicationThread : IRemoteDebugApplicationThread
  2384. {
  2385. // Provides a mechanism for the caller to run code in another thread. This is generally
  2386. // used so that language engines and hosts can implement free threaded objects on top
  2387. // of their single threaded implementations.
  2388. // this function is only implemented in 32 bit pdm
  2389. HRESULT SynchronousCallIntoThread32(
  2390. // The interface to be called back in the target thread.
  2391. [in] IDebugThreadCall32 *pstcb,
  2392. // Three arguments passed to the IDebugThreadCall.
  2393. [in] DWORD dwParam1,
  2394. [in] DWORD dwParam2,
  2395. [in] DWORD dwParam3);
  2396. // Returns S_OK when this is the currently running thread. Otherwise S_FALSE is returned.
  2397. HRESULT QueryIsCurrentThread(
  2398. void);
  2399. // Returns S_OK when this is the debugger thread. Otherwise, returns S_FALSE.
  2400. HRESULT QueryIsDebuggerThread(
  2401. void);
  2402. HRESULT SetDescription(
  2403. [in] LPCOLESTR pstrDescription);
  2404. HRESULT SetStateString(
  2405. [in] LPCOLESTR pstrState);
  2406. }
  2407. [
  2408. object,
  2409. uuid(9dac5886-dbad-456d-9dee-5dec39ab3dda),
  2410. pointer_default(unique),
  2411. local
  2412. ]
  2413. interface IDebugApplicationThread64 : IDebugApplicationThread
  2414. {
  2415. // Provides a mechanism for the caller to run code in another thread. This is generally
  2416. // used so that language engines and hosts can implement free threaded objects on top
  2417. // of their single threaded implementations.
  2418. HRESULT SynchronousCallIntoThread64(
  2419. // The interface to be called back in the target thread.
  2420. [in] IDebugThreadCall64 *pstcb,
  2421. // Three arguments passed to the IDebugThreadCall.
  2422. [in] DWORDLONG dwParam1,
  2423. [in] DWORDLONG dwParam2,
  2424. [in] DWORDLONG dwParam3);
  2425. }
  2426. [
  2427. object, local,
  2428. uuid(51973C39-CB0C-11d0-B5C9-00A0244A0E7A),
  2429. helpstring("IDebugCookie Interface"),
  2430. pointer_default(unique)
  2431. ]
  2432. interface IDebugCookie : IUnknown
  2433. {
  2434. HRESULT SetDebugCookie([in]DWORD dwDebugAppCookie);
  2435. };
  2436. /* IEnumDebugApplicationNodes
  2437. Enumerates Application nodes. Generally used to enumerate child nodes of a node associated with an application. Example: a project window.
  2438. */
  2439. [
  2440. object,
  2441. uuid(51973C3a-CB0C-11d0-B5C9-00A0244A0E7A),
  2442. helpstring("IEnumDebugApplicationNodes Interface"),
  2443. pointer_default(unique)
  2444. ]
  2445. interface IEnumDebugApplicationNodes : IUnknown {
  2446. [local]
  2447. HRESULT __stdcall Next(
  2448. [in] ULONG celt,
  2449. [out] IDebugApplicationNode **pprddp,
  2450. [out] ULONG *pceltFetched);
  2451. [call_as(Next)]
  2452. HRESULT __stdcall RemoteNext(
  2453. [in] ULONG celt,
  2454. [out, size_is(celt), length_is(*pceltFetched )]
  2455. IDebugApplicationNode **pprddp,
  2456. [out] ULONG *pceltFetched);
  2457. HRESULT Skip(
  2458. [in] ULONG celt);
  2459. HRESULT Reset(void);
  2460. HRESULT Clone(
  2461. [out] IEnumDebugApplicationNodes **pperddp);
  2462. };
  2463. /* IEnumRemoteDebugApplications
  2464. Enumerates application objects. Generally used to enumerate the running applications on a machine. Example: the "attach to application" dialog.
  2465. */
  2466. [
  2467. object,
  2468. uuid(51973C3b-CB0C-11d0-B5C9-00A0244A0E7A),
  2469. helpstring("IEnumRemoteDebugApplications Interface"),
  2470. pointer_default(unique)
  2471. ]
  2472. interface IEnumRemoteDebugApplications : IUnknown {
  2473. [local]
  2474. HRESULT __stdcall Next(
  2475. [in] ULONG celt,
  2476. [out] IRemoteDebugApplication **ppda,
  2477. [out] ULONG *pceltFetched);
  2478. [call_as(Next)]
  2479. HRESULT __stdcall RemoteNext(
  2480. [in] ULONG celt,
  2481. [out, size_is(celt), length_is(*pceltFetched )]
  2482. IRemoteDebugApplication **ppda,
  2483. [out] ULONG *pceltFetched);
  2484. HRESULT Skip(
  2485. [in] ULONG celt);
  2486. HRESULT Reset(void);
  2487. HRESULT Clone(
  2488. [out] IEnumRemoteDebugApplications **ppessd);
  2489. }
  2490. /* IEnumRemoteDebugApplicationThreads
  2491. Enumerates thread objects. Generally used to enumerate the running threads in an application.
  2492. */
  2493. [
  2494. object,
  2495. uuid(51973C3c-CB0C-11d0-B5C9-00A0244A0E7A),
  2496. helpstring("IEnumRemoteDebugApplicationThreads Interface"),
  2497. pointer_default(unique)
  2498. ]
  2499. interface IEnumRemoteDebugApplicationThreads : IUnknown {
  2500. [local]
  2501. HRESULT __stdcall Next(
  2502. [in] ULONG celt,
  2503. [out] IRemoteDebugApplicationThread **pprdat,
  2504. [out] ULONG *pceltFetched);
  2505. [call_as(Next)]
  2506. HRESULT __stdcall RemoteNext(
  2507. [in] ULONG celt,
  2508. [out, size_is(celt), length_is(*pceltFetched )]
  2509. IRemoteDebugApplicationThread **ppdat,
  2510. [out] ULONG *pceltFetched);
  2511. HRESULT Skip(
  2512. [in] ULONG celt);
  2513. HRESULT Reset(void);
  2514. HRESULT Clone(
  2515. [out] IEnumRemoteDebugApplicationThreads **pperdat);
  2516. }
  2517. /* IDebugFormatter
  2518. IDebugFormatter allows a language or IDE to customize the conversion
  2519. between variants or VARTYPES and strings. This interface is used by the
  2520. ITypeInfo->IDebugProperty mapping implementation.
  2521. */
  2522. [
  2523. object,
  2524. uuid(51973C05-CB0C-11d0-B5C9-00A0244A0E7A),
  2525. helpstring("IDebugFormatter Interface"),
  2526. pointer_default(unique),
  2527. local
  2528. ]
  2529. interface IDebugFormatter : IUnknown
  2530. {
  2531. HRESULT GetStringForVariant([in] VARIANT *pvar, [in] ULONG nRadix, [out] BSTR *pbstrValue);
  2532. HRESULT GetVariantForString([in] LPCOLESTR pwstrValue, [out] VARIANT *pvar);
  2533. HRESULT GetStringForVarType([in] VARTYPE vt, [in] TYPEDESC *ptdescArrayType, [out] BSTR *pbstr);
  2534. }
  2535. /* ISimpleConnectionPoint
  2536. This interface is the "IDispatchEx" of event interfaces.
  2537. It provides a simple way for describing and enumerating the events fired on a particular connection pointan also for hooking up an IDispatch to those events.
  2538. This interface will be available as extended info via the IDebugProperty
  2539. interface on objects which support events. For simplicity, this interface only
  2540. works with dispinterfaces.
  2541. */
  2542. [
  2543. object,
  2544. uuid(51973C3e-CB0C-11d0-B5C9-00A0244A0E7A),
  2545. helpstring("ISimpleConnectionPoint Interface"),
  2546. pointer_default(unique),
  2547. local
  2548. ]
  2549. interface ISimpleConnectionPoint : IUnknown
  2550. {
  2551. // Return the number of events exposed on this interface
  2552. HRESULT GetEventCount([out] ULONG *pulCount);
  2553. // Return the DISPID and NAME for "cEvents" events, starting at "iEvent".
  2554. // The number of
  2555. // - Returns S_OK if all of the requested elements were returned.
  2556. // - Returns S_FALSE if the enumeration finished and the
  2557. // requested number of elements was not available.
  2558. // (Unavailable elements will be returned as DISPID_NULL and a null bstr.)
  2559. // - Returns E_INVALIDARG (or other error status) if no elements could be fetched
  2560. HRESULT DescribeEvents(
  2561. [in] ULONG iEvent, // starting event index
  2562. [in] ULONG cEvents, // number of events to fetch info for
  2563. [out, size_is(cEvents), length_is(*pcEventsFetched)]
  2564. DISPID *prgid, // DISPIDs of the events
  2565. [out, size_is(cEvents), length_is(*pcEventsFetched)]
  2566. BSTR *prgbstr,
  2567. [out] ULONG *pcEventsFetched
  2568. ); // names of the events
  2569. HRESULT Advise([in] IDispatch *pdisp, [out] DWORD* pdwCookie);
  2570. HRESULT Unadvise([in] DWORD dwCookie);
  2571. };
  2572. /* IDebugHelper
  2573. IDebugHelper serves as a factory for object browsers and simple connection points.
  2574. */
  2575. cpp_quote("EXTERN_C const CLSID CLSID_DebugHelper;")
  2576. [
  2577. object,
  2578. uuid(51973C3f-CB0C-11d0-B5C9-00A0244A0E7A),
  2579. helpstring("IDebugHelper Interface"),
  2580. pointer_default(unique),
  2581. local
  2582. ]
  2583. interface IDebugHelper : IUnknown
  2584. {
  2585. // Returns a property browser that wraps a VARIANT
  2586. HRESULT CreatePropertyBrowser(
  2587. [in] VARIANT *pvar, // root variant to browse
  2588. [in] LPCOLESTR bstrName, // name to give the root
  2589. [in] IDebugApplicationThread *pdat, // thread to request properties on
  2590. // (or NULL for no marshalling)
  2591. [out] IDebugProperty**ppdob);
  2592. // Returns a property browser that wraps a VARIANT, and allows for custom conversion
  2593. // of variants or VARTYPEs to strings
  2594. HRESULT CreatePropertyBrowserEx(
  2595. [in] VARIANT *pvar, // root variant to browse
  2596. [in] LPCOLESTR bstrName, // name to give the root
  2597. [in] IDebugApplicationThread *pdat, // thread to request properties on
  2598. // (or NULL for no marshalling)
  2599. [in] IDebugFormatter*pdf, // provides custom formatting of variants
  2600. [out] IDebugProperty**ppdob);
  2601. // Returns an event interface that wraps the given IDispatch (see ISimpleConnectionPoint)
  2602. HRESULT CreateSimpleConnectionPoint(
  2603. [in] IDispatch *pdisp,
  2604. [out] ISimpleConnectionPoint **ppscp);
  2605. };
  2606. /* IEnumDebugExpressionContexts
  2607. */
  2608. [
  2609. object,
  2610. uuid(51973C40-CB0C-11d0-B5C9-00A0244A0E7A),
  2611. helpstring("IEnumDebugExpressionContexts Interface"),
  2612. pointer_default(unique)
  2613. ]
  2614. interface IEnumDebugExpressionContexts : IUnknown
  2615. {
  2616. [local]
  2617. HRESULT __stdcall Next(
  2618. [in] ULONG celt,
  2619. [out] IDebugExpressionContext **ppdec,
  2620. [out] ULONG *pceltFetched);
  2621. [call_as(Next)]
  2622. HRESULT __stdcall RemoteNext(
  2623. [in] ULONG celt,
  2624. [out, size_is(celt), length_is(*pceltFetched )]
  2625. IDebugExpressionContext **pprgdec,
  2626. [out] ULONG *pceltFetched);
  2627. HRESULT Skip(
  2628. [in] ULONG celt);
  2629. HRESULT Reset(void);
  2630. HRESULT Clone(
  2631. [out] IEnumDebugExpressionContexts **ppedec);
  2632. }
  2633. /* IProvideExpressionContexts
  2634. Provides a means for enumerating expression contexts known by a certain component.
  2635. Generally implemented by each script engine. Used by the process debug manager to
  2636. find all global expression contexts associated with a given thread.
  2637. Note: This interface is called from within the thread of interest. It is up to
  2638. the implementor to identify the current thread and return an appropriate enumerator.
  2639. */
  2640. [
  2641. object,
  2642. uuid(51973C41-CB0C-11d0-B5C9-00A0244A0E7A),
  2643. pointer_default(unique)
  2644. ]
  2645. interface IProvideExpressionContexts : IUnknown
  2646. {
  2647. // Returns an enumerator of expression contexts.
  2648. HRESULT EnumExpressionContexts(
  2649. [out] IEnumDebugExpressionContexts **ppedec);
  2650. }
  2651. [
  2652. uuid(78a51821-51f4-11d0-8f20-00805f2cd064),
  2653. version(1.0),
  2654. helpstring("ProcessDebugManagerLib 1.0 Type Library")
  2655. ]
  2656. library ProcessDebugManagerLib
  2657. {
  2658. importlib("stdole2.tlb");
  2659. interface IActiveScriptDebug32;
  2660. interface IActiveScriptDebug64;
  2661. interface IActiveScriptErrorDebug;
  2662. interface IActiveScriptSiteDebug32;
  2663. interface IActiveScriptSiteDebug64;
  2664. interface IApplicationDebugger;
  2665. interface IApplicationDebuggerUI;
  2666. interface IDebugApplication32;
  2667. interface IDebugApplication64;
  2668. interface IDebugApplicationNode;
  2669. interface IDebugApplicationNodeEvents;
  2670. interface IDebugApplicationThread;
  2671. interface IDebugAsyncOperation;
  2672. interface IDebugAsyncOperationCallBack;
  2673. interface IDebugCodeContext;
  2674. interface IDebugCookie;
  2675. interface IDebugDocument;
  2676. interface IDebugDocumentContext;
  2677. interface IDebugDocumentHelper32;
  2678. interface IDebugDocumentHelper64;
  2679. interface IDebugDocumentHost;
  2680. interface IDebugDocumentInfo;
  2681. interface IDebugDocumentProvider;
  2682. interface IDebugDocumentText;
  2683. interface IDebugDocumentTextAuthor;
  2684. interface IDebugDocumentTextEvents;
  2685. interface IDebugDocumentTextExternalAuthor;
  2686. interface IDebugExpression;
  2687. interface IDebugExpressionCallBack;
  2688. interface IDebugExpressionContext;
  2689. interface IDebugFormatter;
  2690. interface IDebugHelper;
  2691. interface IDebugSessionProvider;
  2692. interface IDebugStackFrame;
  2693. interface IDebugStackFrameSniffer;
  2694. interface IDebugStackFrameSnifferEx32;
  2695. interface IDebugStackFrameSnifferEx64;
  2696. interface IDebugSyncOperation;
  2697. interface IDebugThreadCall32;
  2698. interface IDebugThreadCall64;
  2699. interface IEnumDebugApplicationNodes;
  2700. interface IEnumDebugCodeContexts;
  2701. interface IEnumDebugExpressionContexts;
  2702. interface IEnumDebugStackFrames;
  2703. interface IEnumDebugStackFrames64;
  2704. interface IEnumRemoteDebugApplications;
  2705. interface IEnumRemoteDebugApplicationThreads;
  2706. interface IProcessDebugManager32;
  2707. interface IProcessDebugManager64;
  2708. interface IProvideExpressionContexts;
  2709. interface IMachineDebugManager;
  2710. interface IMachineDebugManagerCookie;
  2711. interface IMachineDebugManagerEvents;
  2712. interface IRemoteDebugApplication;
  2713. interface IRemoteDebugApplicationEvents;
  2714. interface IRemoteDebugApplicationThread;
  2715. interface ISimpleConnectionPoint;
  2716. [
  2717. uuid(78a51822-51f4-11d0-8f20-00805f2cd064),
  2718. helpstring("ProcessDebugManager Class")
  2719. ]
  2720. coclass ProcessDebugManager
  2721. {
  2722. #ifdef _WIN64
  2723. [default] interface IProcessDebugManager64;
  2724. #else
  2725. [default] interface IProcessDebugManager32;
  2726. #endif
  2727. };
  2728. [
  2729. uuid(0BFCC060-8C1D-11d0-ACCD-00AA0060275C),
  2730. helpstring("DebugHelper Class")
  2731. ]
  2732. coclass DebugHelper
  2733. {
  2734. [default] interface IDebugHelper;
  2735. };
  2736. // CDebugDocumentHelper
  2737. //
  2738. // The CDebugDocumentHelper makes it much easier for an ActiveScripting
  2739. // host or scripting engine to implement the IDebugDocument interfaces.
  2740. //
  2741. // Given the source text and (optionally) script blocks for a host's
  2742. // document, CDebugDocumentHelper provides implementations for
  2743. // the debug document interfaces, including:
  2744. //
  2745. // - IDebugDocumentText
  2746. // - IDebugDocumentTextAuthor (for authoring)
  2747. // - IDebugDocumentContext
  2748. //
  2749. // This class supports aggregation, so the host may provide a controlling
  2750. // unknown to CoCreateInstance for extensibility.
  2751. //
  2752. // This class fires events on IDebugDocumentTextEvents, so the host
  2753. // can monitor all changes to the document via that interface.
  2754. cpp_quote("EXTERN_C const CLSID CLSID_CDebugDocumentHelper;")
  2755. [
  2756. uuid(83B8BCA6-687C-11D0-A405-00AA0060275C),
  2757. helpstring("DebugDocumentHelper Class")
  2758. ]
  2759. coclass CDebugDocumentHelper
  2760. {
  2761. #ifdef _WIN64
  2762. [default] interface IDebugDocumentHelper64;
  2763. #else
  2764. [default] interface IDebugDocumentHelper32;
  2765. #endif
  2766. interface IDebugDocumentProvider;
  2767. interface IDebugDocument;
  2768. interface IDebugDocumentText;
  2769. interface IDebugDocumentTextAuthor;
  2770. interface IConnectionPointContainer;
  2771. [default, source] interface IDebugDocumentTextEvents;
  2772. };
  2773. [
  2774. #ifdef DEBUG
  2775. uuid(49769CEC-3A55-4bb0-B697-88FEDE77E8EA),
  2776. #else
  2777. uuid(0C0A3666-30C9-11D0-8F20-00805F2CD064),
  2778. #endif
  2779. helpstring("MachineDebugManager Class")
  2780. ]
  2781. coclass MachineDebugManager
  2782. {
  2783. [default] interface IMachineDebugManager;
  2784. };
  2785. // This class is no longer implemented starting in VS7
  2786. [
  2787. uuid(834128a2-51f4-11d0-8f20-00805f2cd064),
  2788. helpstring("DefaultDebugSessionProvider Class")
  2789. ]
  2790. coclass DefaultDebugSessionProvider
  2791. {
  2792. [default] interface IDebugSessionProvider;
  2793. };
  2794. };
  2795. cpp_quote("")
  2796. cpp_quote("#endif // __ActivDbg_h")
  2797. cpp_quote("")