Interface DebuggerScripting

The scripting interface of the Debugger. Encapsulates all debugger operations that do not operate on a target.

To debug a given target, the debugger must be configured using DebuggerRootObject.configure and then scripting sessions to one or more of the cores on the configured target can be opened with DebuggerScripting.openSession.

interface DebuggerScripting {
    simultaneous: Simultaneous;
    configure(ccxmlFile: string): CoreList;
    deconfigure(): void;
    getScriptingTimeout(): number;
    launchCCS(): void;
    listCores(): CoreList;
    openSession(corePattern?: string | RegExp): DebugSession;
    setScriptingTimeout(ms: number): void;
    shutdown(): void;
}

Hierarchy

  • DebuggerScripting
    • DebuggerScripting

Properties

simultaneous: Simultaneous

Methods

  • Initializes the debugger with the provided ccxml file. This will not connect to any cores, but will prepare the debugger internally for debugging the configuration specified in the file.

    Parameters

    • ccxmlFile: string

      The ccxml file to be used

    Returns CoreList

    The same value as DebuggerRootObject.listCores

    let { cores, nonDebugCores } = ds.configure("my_configuration.ccxml");
    

    Returns once the debugger is done being configured. This can take some time, especially the first time it is configured for a particular device.

    Throws if the debugger is already initialized with a particular configuration. DebuggerRootObject.deconfigure must be called before configuring for a different configuration.

  • Invalidates the current debugger configuration, so that a different configuration can be used. This will disconnect from all cores and invalidate any active debug sessions.

    Returns void

    ds.deconfigure();
    

    Returns once the debugger is done being deconfigured.

    Throws if the debugger is not currently configured.

  • Get the current scripting timeout duration.

    Returns number

    the timeout duration in milliseconds, or 0 if the timeout is disabled

    ds.setScriptingTimeout(10000);
    const tenSeconds = ds.getScriptingTimeout(); // returns 10000

    ds.setScriptingTimeout(0); // non-positive value, timeout will be disabled
    const zero = ds.getScriptingTimeout(); // returns 0
  • Launch an instance of CCS side-by-side with this instance of the debugger. This allows CCS to display the current state of the target while it is controlled by a script, and/or provide a way of interacting with a scripting session.

    Returns void

    This will not work with the Eclipse-based version of CCS.

    ds.launchCCS();
    
  • Get the names of the currently configured debuggable, and non-debuggable cores.

    Returns CoreList

    The device's cores, split into two lists, one for debuggable cores, and the other for non-debuggable cores.

    // Open a debug session to the first debuggable core
    let { cores, nonDebugCores } = ds.listCores();
    let session = ds.openSession(cores[0]);
  • Open a debug session to the specified core on the device for which the debugger is configured.

    Parameters

    • OptionalcorePattern: string | RegExp

      Can be a string or a regular expression. A debug session will be opened to the first core that matches. Defaults to the first core.

    Returns DebugSession

    The names of the cores of the current configuration can be obtained from DebuggerRootObject.listCores.

    Throws if the debugger is not currently configured, or if no matching core is found.

    // Specifying an exact name
    let session = ds.openSession("Texas Instruments XDS110 USB Debug Probe_0/Cortex_M4_0")

    // The first core with CortexM or CortexR anywhere in the name
    let session = ds.openSession("Cortex(M|R)")
    // equivalently
    let session = ds.openSession(/Cortex(M|R)/)

    // The first core
    let session = ds.openSession()
  • Configure a timeout duration for all future calls to scripting commands.

    If a command takes longer to resolve than the timeout duration, a ScriptingTimeoutError will be thrown.

    By default, the scripting timeout is disabled.

    Parameters

    • ms: number

      New timeout duration in milliseconds. Positive values will enable the timeout, others will disable it.

    Returns void

    // Set a 1 second timeout duration
    ds.setScriptingTimeout(1000);

    // Disable scripting timeout
    ds.setScriptingTimeout(0);
  • Shutdown the scripting session.

    Returns void

    This will close the connection to the debugger. If running standalone, the debugger will be shut down. No further commands will be allowed. This should be called at the end of a script to terminate the connection and allow the javascript process to end.

    ds.shutdown();