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:

  • 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.

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.

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:

Interfaces implemented by PDM on behalf of the host:

Debugger IDE

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:

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.

Process Debug Manager

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.

See Also

Active Script Debugger Interfaces