Partager via


Active Script Debugging Overview

The Active Script Debugging interfaces allow language-neutral, host-neutral debugging, and support a wide variety of development environments.

Script Host Process
Figure 1

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:

host application
The application that hosts the script engines and provides a scriptable set of objects (or "object model").

language engine
A component that provides parsing, execution, and debugging abstractions for a particular language.

debugger IDE
The application that provides debugging UI by communicating with the host application and language engines.

machine debug manager A component that maintains a registry of debuggable application processes.

process debug manager
A component that maintains the tree of debuggable documents for a particular application, tracks the running threads, and so on.

document context
A document context is an abstraction representing a specific range in the source code of a host document.

code context
A code context represents a particular location in the running code of a language engine (a "virtual instruction pointer".)

expression context
A particular context (for example, a stack frame) in which expressions may be evaluated by a language engine.

object browsing
A structured, language-independent representation of an object's name, type, value, and sub-objects, suitable for implementing a "watch window" UI.

Below is an overview of each of the key Active Debugging components and corresponding, associated interfaces, followed by the details of those interfaces.

Language Engine

The language engine provides:

Hosts

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.

Smart-host Helper Interfaces

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.

IDebugDocumentHelper Interface
Implemented by PDM and provides implementations for many interfaces necessary for smart hosting.

IDebugDocumentHost Interface
Implemented (optionally) by the host to expose host-specific functionality, such as syntax coloring, to the debugger.

For more information, see Implementing Smart Host Helper Interfaces.

Full Smart-host Interfaces

Below is the full set of interfaces that a smart-host must implement or use if it is not using the helper interfaces.

Interfaces implemented by host:

IDebugDocumentInfo Interface
Provides information on a document, which may or may not be instantiated.

IDebugDocumentProvider Interface
Provides the means for instantiating a document on demand.

IDebugDocument Interface
The base interface for all debug documents.

IDebugDocumentText Interface
Provides access to a text-only version of the debug document.

IDebugDocumentTextAuthor Interface
Allows editing of the text-only version of the debug document.

IDebugDocumentContext Interface
Provides an abstract representation of a portion of the document being debugged.

Interfaces implemented by PDM on behalf of the host:

IDebugApplicationNode Interface
Extends the functionality of the IDebugDocumentProvider interface by providing a context within a project tree.

Debugger IDE

The IDE is a language-independent debugging UI. It provides:

Machine Debug Manager

The machine debug manager provides the hookup point between virtual applications and debuggers by maintaining and enumerating a list of active virtual applications.

IDebugSessionProvider Interface
Establishes a debug session for a running application.

IMachineDebugManager Interface
The primary interface to the machine debug manager.

IMachineDebugManagerCookie Interface
Similar to the IMachineDebugManager interface, but this interface supports debug cookies.

IMachineDebugManagerEvents Interface
Signals changes in the running application list maintained by the machine debug manager.

IEnumRemoteDebugApplications Interface
Enumerates the running applications on a machine.

Process Debug Manager

The PDM does the following:

See also

Active Script Debugger Interfaces