[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/script-host](https://jsprismarine.dev/api/@jsprismarine/script-host/index.md) / debugger/EngineDebugger

# debugger/EngineDebugger

## Classes

- [EngineDebugger](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/EngineDebugger/classes/EngineDebugger.md)

## Interfaces

### DebugFrame

Defined in: [script-host/src/debugger/EngineDebugger.ts:52](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L52)

One frame of a stopped script's stack.

#### Properties

##### column

> `readonly` **column**: `number`

Defined in: [script-host/src/debugger/EngineDebugger.ts:60](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L60)

The 1-based column, 0 in a native frame.

##### file

> `readonly` **file**: `string`

Defined in: [script-host/src/debugger/EngineDebugger.ts:56](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L56)

The file name, as the script's stack traces show it; empty for a native frame.

##### line

> `readonly` **line**: `number`

Defined in: [script-host/src/debugger/EngineDebugger.ts:58](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L58)

The 1-based line, 0 in a native frame.

##### name

> `readonly` **name**: `string`

Defined in: [script-host/src/debugger/EngineDebugger.ts:54](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L54)

The function's name, empty for an anonymous one.

***

### DebugProperty

Defined in: [script-host/src/debugger/EngineDebugger.ts:76](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L76)

One own property of an object, read without running its getter.

#### Properties

##### accessor

> `readonly` **accessor**: `boolean`

Defined in: [script-host/src/debugger/EngineDebugger.ts:79](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L79)

True for a getter or setter, whose value the debugger never reads.

##### name

> `readonly` **name**: `string`

Defined in: [script-host/src/debugger/EngineDebugger.ts:77](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L77)

##### value

> `readonly` **value**: [`ScriptValue`](https://jsprismarine.dev/api/@jsprismarine/script-host/values/index.md#scriptvalue)

Defined in: [script-host/src/debugger/EngineDebugger.ts:81](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L81)

The value, which the caller frees when it is a handle. Undefined for an accessor.

***

### DebuggerHost

Defined in: [script-host/src/debugger/EngineDebugger.ts:92](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L92)

What a debugger needs of its engine; [ScriptEngine](https://jsprismarine.dev/api/@jsprismarine/script-host/ScriptEngine/index.md) provides it.

#### Properties

##### buffer

> `readonly` **buffer**: [`TransferBuffer`](https://jsprismarine.dev/api/@jsprismarine/script-host/values/classes/TransferBuffer.md)

Defined in: [script-host/src/debugger/EngineDebugger.ts:94](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L94)

##### native

> `readonly` **native**: [`NativeSymbols`](https://jsprismarine.dev/api/@jsprismarine/native-library/ffi/index.md#nativesymbols)

Defined in: [script-host/src/debugger/EngineDebugger.ts:93](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L93)

#### Methods

##### check()

> **check**(`result`): `number`

Defined in: [script-host/src/debugger/EngineDebugger.ts:98](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L98)

Turns a negative status into the error the engine described.

###### Parameters

###### result

`number`

###### Returns

`number`

##### detached()

> **detached**(): `void`

Defined in: [script-host/src/debugger/EngineDebugger.ts:102](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L102)

Tells the engine the debugger has detached.

###### Returns

`void`

##### pointer()

> **pointer**(): `bigint`

Defined in: [script-host/src/debugger/EngineDebugger.ts:96](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L96)

The engine's pointer, or a throw once it has been destroyed.

###### Returns

`bigint`

##### take()

> **take**(`handle`): [`ScriptValue`](https://jsprismarine.dev/api/@jsprismarine/script-host/values/index.md#scriptvalue)

Defined in: [script-host/src/debugger/EngineDebugger.ts:100](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L100)

Reads a result handle's value, freeing the handle unless the value is an object.

###### Parameters

###### handle

`number`

###### Returns

[`ScriptValue`](https://jsprismarine.dev/api/@jsprismarine/script-host/values/index.md#scriptvalue)

***

### DebuggerListener

Defined in: [script-host/src/debugger/EngineDebugger.ts:37](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L37)

Receives the engine's debugger events. Both run synchronously on the engine's thread, inside the
engine call that runs the script, so the script and everything waiting on it stay blocked.

#### Methods

##### paused()

> **paused**(`reason`): [`PauseOutcome`](#pauseoutcome)

Defined in: [script-host/src/debugger/EngineDebugger.ts:43](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L43)

The script stopped. The listener reads it through the [EngineDebugger](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/EngineDebugger/classes/EngineDebugger.md), calls
[EngineDebugger.resume](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/EngineDebugger/classes/EngineDebugger.md#resume) to say how it goes on, and returns. Returning `'terminate'`
stops the script as if it had run out of steps.

###### Parameters

###### reason

`"breakpoint"` \| `"step"` \| `"exception"` \| `"pause"`

###### Returns

[`PauseOutcome`](#pauseoutcome)

##### poll()

> **poll**(): `void`

Defined in: [script-host/src/debugger/EngineDebugger.ts:48](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L48)

A running script has passed the number of lines the debugger polls at. The listener reads
what the debugger has sent without waiting, and must not run script.

###### Returns

`void`

***

### PropertyPage

Defined in: [script-host/src/debugger/EngineDebugger.ts:85](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L85)

A page of an object's own properties.

#### Properties

##### properties

> `readonly` **properties**: readonly [`DebugProperty`](#debugproperty)[]

Defined in: [script-host/src/debugger/EngineDebugger.ts:88](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L88)

##### total

> `readonly` **total**: `number`

Defined in: [script-host/src/debugger/EngineDebugger.ts:87](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L87)

How many own properties the object has in all.

***

### ValueDescription

Defined in: [script-host/src/debugger/EngineDebugger.ts:67](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L67)

A value the engine described without running script.

#### Properties

##### detail

> `readonly` **detail**: `string` \| `number` \| `undefined`

Defined in: [script-host/src/debugger/EngineDebugger.ts:72](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L72)

An array's length or an error's message.

##### kind

> `readonly` **kind**: [`DescribedKind`](#describedkind)

Defined in: [script-host/src/debugger/EngineDebugger.ts:68](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L68)

##### name

> `readonly` **name**: `string` \| `undefined`

Defined in: [script-host/src/debugger/EngineDebugger.ts:70](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L70)

A constructor's or function's name, a symbol's description or a bigint's digits.

## Type Aliases

### DescribedKind

> **DescribedKind** = `"object"` \| `"array"` \| `"function"` \| `"error"` \| `"proxy"` \| `"symbol"` \| `"bigint"`

Defined in: [script-host/src/debugger/EngineDebugger.ts:64](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L64)

The kinds of value [EngineDebugger.describe](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/EngineDebugger/classes/EngineDebugger.md#describe) tells apart.

***

### PauseOutcome

> **PauseOutcome** = `"resume"` \| `"terminate"`

Defined in: [script-host/src/debugger/EngineDebugger.ts:31](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L31)

What the host does with a script once it has handled a stop.

***

### PauseReason

> **PauseReason** = *typeof* [`PauseReason`](#pausereason-1)\[`number`\]

Defined in: [script-host/src/debugger/EngineDebugger.ts:13](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L13)

Why a script stopped: at a breakpoint, after a step, on a thrown value, or on request.

***

### ResumeMode

> **ResumeMode** = keyof *typeof* [`ResumeMode`](#resumemode-1)

Defined in: [script-host/src/debugger/EngineDebugger.ts:19](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L19)

How a stopped script goes on.

***

### ScopeKind

> **ScopeKind** = keyof *typeof* [`ScopeKind`](#scopekind-1)

Defined in: [script-host/src/debugger/EngineDebugger.ts:25](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L25)

Which variables of a frame a scope holds: its own, those it closes over, or the global object.

## Variables

### PauseReason

> `const` **PauseReason**: readonly \[`"breakpoint"`, `"step"`, `"exception"`, `"pause"`\]

Defined in: [script-host/src/debugger/EngineDebugger.ts:13](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L13)

Why a script stopped, by the `jsh_debug_reason` code the engine sends.

***

### ResumeMode

> `const` **ResumeMode**: `object`

Defined in: [script-host/src/debugger/EngineDebugger.ts:19](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L19)

How a stopped script goes on, by its `jsh_debug_resume` code.

#### Type Declaration

##### continue

> `readonly` **continue**: `0` = `0`

##### stepIn

> `readonly` **stepIn**: `2` = `2`

##### stepOut

> `readonly` **stepOut**: `3` = `3`

##### stepOver

> `readonly` **stepOver**: `1` = `1`

***

### ScopeKind

> `const` **ScopeKind**: `object`

Defined in: [script-host/src/debugger/EngineDebugger.ts:25](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/EngineDebugger.ts#L25)

The variables of a frame, by their `jsh_debug_scope` code.

#### Type Declaration

##### closure

> `readonly` **closure**: `1` = `1`

##### global

> `readonly` **global**: `2` = `2`

##### local

> `readonly` **local**: `0` = `0`
