mqt.debugger.dap.messages

A module for DAP message types.

class AmplitudeChangeDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘setVariable’ DAP request for quantum amplitude edits.

handle(server: DAPServer) dict[str, Any][source]

Apply the amplitude change and return the new complex value.

Parameters:

server (DAPServer) – The DAP server handling the request.

Returns:

The DAP response with the updated value.

Return type:

dict[str, Any]

message_type_name: str = 'setVariable'
new_value: str | None
validate() None[source]

Validate that the request targets amplitudes and provides a new value.

variable_name: Any
variables_reference: int | None
class BitChangeDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘setVariable’ (aka ‘bitChange’) DAP request for classical bits.

handle(server: DAPServer) dict[str, Any][source]

Perform the action requested by the ‘bitChange’ DAP request.

Parameters:

server (DAPServer) – The DAP server handling the request.

Returns:

The DAP response describing the resulting boolean value.

Return type:

dict[str, Any]

message_type_name: str = 'setVariable'
new_value: Any
validate() None[source]

Validate that the request targets classical bits and uses boolean data.

variable_name: Any
variables_reference: Any
class CapabilitiesDAPEvent(changes: dict[str, Any])[source]

Bases: DAPEvent

Represents the ‘capabilities’ DAP event.

changes: dict[str, Any]
encode() dict[str, int][source]

Encode the ‘capabilities’ DAP event message as a dictionary.

Returns:

The encoded ‘capabilities’ DAP event message.

Return type:

dict[str, int]

event_name: str = 'capabilities'
validate() None[source]

Validate the ‘capabilities’ DAP event message after creation.

class ConfigurationDoneDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘configurationDone’ DAP request.

handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘ConfigurationDone’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'configurationDone'
validate() None[source]

Validates the ‘ConfigurationDoneDAPMessage’ instance.

class ContinueDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘continue’ DAP request.

handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘continue’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'continue'
validate() None[source]

Validates the ‘ContinueDAPMessage’ instance.

class DAPEvent[source]

Bases: ABC

Represents a generic DAP event message.

encode() dict[str, Any][source]

Encode the DAP event message as a dictionary.

Returns:

The encoded DAP event message.

Return type:

dict[str, Any]

event_name: str = 'None'
abstractmethod validate() None[source]

Validate the DAP event message after creation.

Raises an exception if the message is invalid.

class DAPMessage(message: dict[str, Any])[source]

Bases: ABC

Represents a generic DAP request message.

handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the DAP request message and returns the response.

Parameters:

server – The DAP server that received the request.

Returns:

The response to the request.

message_type_name: str = 'None'
sequence_number: int
abstractmethod validate() None[source]

Validate the DAP request message after creation.

Raises an exception if the message is invalid.

class DisconnectDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘disconnect’ DAP request.

handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘disconnect’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'disconnect'
validate() None[source]

Validates the ‘DisconnectDAPMessage’ instance.

class ExceptionInfoDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘exceptionInfo’ DAP request.

handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘exceptionInfo’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'exceptionInfo'
validate() None[source]

Validates the ‘ExceptionInfoDAPMessage’ instance.

class ExitedDAPEvent(exit_code: int)[source]

Bases: DAPEvent

Represents the ‘exited’ DAP event.

encode() dict[str, int][source]

Encodes the ‘ExitedDAPEvent’ instance as a dictionary.

Returns:

The encoded ‘ExitedDAPEvent’ instance.

Return type:

dict[str, int]

event_name: str = 'exited'
exit_code: int
validate() None[source]

Validates the ‘ExitedDAPEvent’ instance.

class GrayOutDAPEvent(ranges: list[tuple[int, int]], source: dict[str, Any])[source]

Bases: DAPEvent

Represents the ‘grayOut’ DAP event.

encode() dict[str, str][source]

Encode the ‘grayOut’ DAP event message as a dictionary.

Returns:

The encoded ‘grayOut’ DAP event message.

Return type:

dict[str, str]

event_name: str = 'grayOut'
ranges: list[tuple[int, int]]
source: dict[str, Any]
validate() None[source]

Validate the ‘grayOut’ DAP event message after creation.

class HighlightError(highlights: Sequence[Mapping[str, Any]], source: Mapping[str, Any])[source]

Bases: DAPEvent

Represents the ‘highlightError’ custom DAP event.

event_name

DAP event identifier emitted by this message.

Type:

str

highlights

Normalized highlight entries with ranges and metadata.

Type:

list[dict[str, Any]]

source

Normalized DAP source information for the highlighted file.

Type:

dict[str, Any]

encode() dict[str, Any][source]

Encode the ‘highlightError’ DAP event message as a dictionary.

Returns:

The encoded DAP event payload.

Return type:

dict[str, Any]

event_name: str = 'highlightError'
highlights: list[dict[str, Any]]
source: dict[str, Any]
validate() None[source]

Validate the ‘highlightError’ DAP event message after creation.

Raises:

ValueError – If required highlight fields are missing or empty.

class HighlightReason(*values)[source]

Bases: Enum

Represents the reason for highlighting a range.

ASSERTION_FAILED = 'assertionFailed'
CONTROL_ALWAYS_ZERO = 'controlAlwaysZero'
MISSING_INTERACTION = 'missingInteraction'
PARSE_ERROR = 'parseError'
UNKNOWN = 'unknown'
class InitializeDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘initialize’ DAP request.

adapter_id: str
client_id: str
client_name: str
columns_start_at1: bool
handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘initialize’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

lines_start_at1: bool
message_type_name: str = 'initialize'
path_format: str
validate() None[source]

Validates the ‘InitializeDAPMessage’ instance.

Raises:

ValueError – If the adapter ID is not mqtqasm.

class InitializedDAPEvent[source]

Bases: DAPEvent

Represents the ‘initialized’ DAP event.

event_name: str = 'initialized'
validate() None[source]

Validate the ‘initialized’ DAP event message after creation.

class LaunchDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘launch’ DAP request.

handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘launch’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'launch'
no_debug: bool
program: str
stop_on_entry: bool
validate() None[source]

Validates the ‘LaunchDAPMessage’ instance.

Raises:

ValueError – If the ‘program’ field is missing or the file does not exist.

class NextDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘next’ DAP request.

handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘next’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'next'
validate() None[source]

Validates the ‘NextDAPMessage’ instance.

class OutputDAPEvent(category: str, output: str | None, group: str | None, line: int, column: int, source: dict[str, Any])[source]

Bases: DAPEvent

Represents the ‘output’ DAP event.

category: str
column: int
encode() dict[str, str][source]

Encode the ‘output’ DAP event message as a dictionary.

Returns:

The encoded ‘output’ DAP event message.

Return type:

dict[str, str]

event_name: str = 'output'
group: str | None
line: int
output: str | None
source: dict[str, Any]
validate() None[source]

Validate the ‘output’ DAP event message after creation.

class PauseDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘pause’ DAP request.

handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘pause’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'pause'
validate() None[source]

Validates the ‘PauseDAPMessage’ instance.

Request

alias of DAPMessage

class RestartDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘restart’ DAP request.

handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘restart’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'restart'
no_debug: bool
program: str
stop_on_entry: bool
validate() None[source]

Validates the ‘LaunchDAPMessage’ instance.

Raises:

ValueError – If the ‘program’ field is missing or the file does not exist.

class RestartFrameDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘restartFrame’ DAP request.

frame: int
handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘restartFrame’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'restartFrame'
validate() None[source]

Validates the ‘RestartFrameDAPMessage’ instance.

class ReverseContinueDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘reverseContinue’ DAP request.

handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘reverseContinue’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'reverseContinue'
validate() None[source]

Validates the ‘ReverseContinueDAPMessage’ instance.

class ScopesDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘scopes’ DAP request.

frame_id: int
handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘scopes’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'scopes'
validate() None[source]

Validates the ‘ScopesDAPMessage’ instance.

class SetBreakpointsDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘setBreakpoints’ DAP request.

breakpoints: list[tuple[int, int]]
handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘setBreakpoints’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

handle_wrong_file(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘setBreakpoints’ DAP request when the file is wrong.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'setBreakpoints'
source: dict[str, Any]
validate() None[source]

Validates the ‘SetBreakpointsDAPMessage’ instance.

class SetExceptionBreakpointsDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘setBreakpoints’ DAP request.

filters: list[str]
handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘setExceptionBreakpoints’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'setExceptionBreakpoints'
validate() None[source]

Validates the ‘SetExceptionBreakpointsDAPMessage’ instance.

class StackTraceDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘stackTrace’ DAP request.

handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘stackTrace’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'stackTrace'
validate() None[source]

Validates the ‘StackTraceDAPMessage’ instance.

class StepBackDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘stepBack’ DAP request.

handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘stepBack’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'stepBack'
validate() None[source]

Validates the ‘StepBackDAPMessage’ instance.

class StepInDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘stepIn’ DAP request.

handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘stepIn’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'stepIn'
validate() None[source]

Validates the ‘StepInDAPMessage’ instance.

class StepOutDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘stepOut’ DAP request.

handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘stepOut’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

_description_

Return type:

dict[str, Any]

message_type_name: str = 'stepOut'
validate() None[source]

Validates the ‘StepOutDAPMessage’ instance.

class StopReason(*values)[source]

Bases: Enum

Represents the reason for stopping.

BREAKPOINT = 'breakpoint'
BREAKPOINT_DATA = 'data breakpoint'
BREAKPOINT_FUNCTION = 'function breakpoint'
BREAKPOINT_INSTRUCTION = 'instruction breakpoint'
ENTRY = 'entry'
EXCEPTION = 'exception'
GOTO = 'goto'
PAUSE = 'pause'
STEP = 'step'
class StoppedDAPEvent(reason: StopReason, description: str)[source]

Bases: DAPEvent

Represents the ‘stopped’ DAP event.

description: str
encode() dict[str, str][source]

Encode the ‘stopped’ DAP event message as a dictionary.

Returns:

The encoded ‘stopped’ DAP event message.

Return type:

dict[str, str]

event_name: str = 'stopped'
reason: StopReason
validate() None[source]

Validate the ‘stopped’ DAP event message after creation.

class TerminateDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘terminate’ DAP request.

handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘terminate’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'terminate'
validate() None[source]

Validates the ‘TerminateDAPMessage’ instance.

class TerminatedDAPEvent[source]

Bases: DAPEvent

Represents the ‘terminated’ DAP event.

event_name: str = 'terminated'
validate() None[source]

Validates the ‘TerminatedDAPEvent’ instance.

class ThreadsDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘threads’ DAP request.

handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘threads’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'threads'
validate() None[source]

Validates the ‘ThreadsDAPMessage’ instance.

class VariablesDAPMessage(message: dict[str, Any])[source]

Bases: DAPMessage

Represents the ‘variables’ DAP request.

count: int
filter_value: str
handle(server: DAPServer) dict[str, Any][source]

Performs the action requested by the ‘variables’ DAP request.

Parameters:

server (DAPServer) – The DAP server that received the request.

Returns:

The response to the request.

Return type:

dict[str, Any]

message_type_name: str = 'variables'
reference: int
start: int
validate() None[source]

Validates the ‘VariablesDAPMessage’ instance.