Active Script Debugging Overview
The Active Script Debugging interfaces allow language-neutral, host-neutral debugging, and support a wide variety of development environments.
A language-neutral debugging environment can support any programming language or mix of programming languages, without having specific knowledge of any of those languages. The debugging environment also supports cross-language stepping and breakpoints. (This overview focuses primarily on support scripting languages, such as VBScript and JavaScript.)
A host-neutral debugger can be automatically used with any Active Scripting host, such as Internet Explorer or a custom host. The host controls what the debugger presents to the user, from the structure of the document tree to the contents and syntax coloring of the debug documents. This allows the debugged source code to be shown in the context of the host document. For example, Internet Explorer can show a script in an HTML page.
In the subsections below, each key component in Active Debugging and its associated interfaces are discussed. However, before proceeding further, several key Active Debugging concepts must be defined:
Below is an overview of each of the key Active Debugging components and corresponding, associated interfaces, followed by the details of those interfaces.
The language engine provides:
-
Language parsing and execution.
-
Debugging support (breakpoints and so on).
-
Expression evaluation.
-
Syntax coloring.
-
Object browsing.
-
Stack enumeration and parsing.
Below are the interfaces that a script engine needs to support to provide debugging, expression evaluation, and object browsing. These interfaces are used by the host application to map between its document context and the engine's code contexts, and also by the debugger UI to do expression evaluation, stack enumeration, and object browsing.
The host:
-
Hosts the language engines.
-
Provides an object model (set of objects that can be scripted).
-
Defines a tree of documents that can be debugged and their contents.
-
Organizes scripts into virtual applications.
There are two kinds of hosts:
-
A dumb host supports just the basic Active Scripting interfaces. It has no control over document structure or organizations; this is determined entirely by the scripts provided to the language engines.
-
A smart host supports a larger set of interfaces that allows it to define the document tree, document contents, and syntax coloring. There is a set of helper interfaces, described in the next subsection, which make it much easier for a host to be a smart host.
The IDebugDocumentHelper methods provide a greatly simplified set of interfaces that a host can use to gain the benefits of smart-hosting without handling the full complexity (and power) of the full host interfaces.
A host is not required to use these interfaces, of course. However using these interfaces can avoid implementing or using a number of more complicated interfaces.
For more information, see Implementing Smart Host Helper Interfaces.
The IDE is a language-independent debugging UI. It provides:
-
Document viewers/editors.
-
Breakpoint management.
-
Expression evaluation and watch windows.
-
Stack frame browsing.
-
Object/Class browsing.
-
Browsing the virtual application structure.
Interfaces implemented by the debugger:
The PDM does the following:
-
Synchronizes the debugging of multiple language engines.
-
Maintains a tree of debuggable documents.
-
Merges stack frames.
-
Coordinates breakpoints and stepping across language engines.
-
Tracks threads.
-
Maintains a debugger thread for asynchronous processing.
-
Communicates with the machine debug manager and the debugger IDE.
Following are the interfaces provided by the process debug manager.