Class Reference
IRIS for UNIX 2024.1.2
InterSystems: The power behind what matters   
Documentation  Search
  [USER] >  [%Atelier] >  [v5] >  [XDebugAgent]
Private  Storage   

class %Atelier.v5.XDebugAgent extends %CSP.WebSocket

This class serves as a debug agent for debugging processes. It receives client debugging commands, sends then to the debug target, gets responses, and sends them back to the client. The implementation is based on the XDEBUG DBGP protocol used by the eclipse DLTK.
http://xdebug.org/docs-dbgp.php

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
11 20 55


Summary

Properties
AtEnd Attached BinaryData BreakPoints
CSPId Command ContinuationCmdIssued Debug
DebugTarget DeviceList Features FirstRunCommandSeen
GWClientAddress LastContinuationCmd NextState NoDataFraming
SessionEndOnClose SessionId SharedConnection StackLevelMappings
StartedAttach TargetOrPID Trace TraceNode
TransactionId WebSocketDevice WebSocketID

Methods
%AddToSaveSet %ClassIsLatestVersion %ClassName %ConstructClone
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Extends
%GetParameter %IsA %IsModified %New
%NormalizeObject %ObjectModified %OriginalNamespace %PackageName
%RemoveFromSaveSet %SerializeObject %SetModified %ValidateObject
Attach AttachCSP ConvertParameter CreateErrorResponse
CreateEvalPropertyResponse CreatePropertyResponse Decrypt Encrypt
EndServer EscapeHTML EscapeURL FlushOutput
GetClassProperties GetClientPosFromDebugPos GetInitMsg GetOffset
GetStackProperties HyperEventCall HyperEventHead Include
InitTrace Initialize InitializeServer InsertHiddenField
InsertHiddenFields Interpolate IsPrivate Launch
Link MapCommandToHandler MappedOffset OnClientMessage
OnHTTPHeader OnPage OnPageError OnPostHTTP
OnPostHyperEvent OnPostServer OnPreHTTP OnPreHyperEvent
OnPreServer OpenServer ParseCommand QuoteJS
Read ReportEvent RewriteURL SendAsyncMessage
Server ShowError StartTimer StopTimer
ThrowError TidyUp Trace UnescapeHTML
UnescapeURL Write break breakpoint_get
breakpoint_list breakpoint_remove breakpoint_set breakpoint_update
context_get context_names detach eval
feature_get feature_set property_get property_set
property_value requote run stack_get
stderr stdin stdout step_into
step_out step_over stop watchpoint_set


Parameters

• parameter CLASS = 2;
This is the CLASS context for variable display in the IDE
• parameter DOMAIN = "%XDEBUG";
Parameter for Localization
• parameter DefaultMaxDepth = 2;
The default value to use for the "max_depth" feature if it wasn't set by the IDE
• parameter EXITSTATE = 1;
• parameter IDLE = "OnIdle";
• parameter NULLSTATE = 0;
• parameter PRIVATE = 0;
This is the PRIVATE context for variable display in the IDE
• parameter PUBLIC = 1;
This is the PUBLIC context for variable display in the IDE
• parameter SECURITYRESOURCE = "%Development";
Require development resource
• parameter STOP = 2;
• parameter TIMEOUT = "0.1";

Properties

• property Attached as %Boolean [ InitialExpression = 0 ];
This holds the attached flag
• property BreakPoints as %String [ MultiDimensional ];
Breakpoints
• property CSPId as %String;
SessionId if attached to a CSP process
• property Command as %String [ MultiDimensional ];
This holds the current command
• property ContinuationCmdIssued as %Boolean [ InitialExpression = 0 ];
This holds the Continuation command issued flag
• property Debug as %Debugger.System;
This holds the debugger instance
• property DebugTarget as %String;
This holds the debug_target (passsed to us by set_feature)
• property DeviceList as %List;
This holds the device list for $System.Socket.Select
• property Features as %String [ MultiDimensional ];
This holds the values of the features set by the IDE
• property FirstRunCommandSeen as %Boolean [ InitialExpression = 0 ];
This holds the first run command flag
• property LastContinuationCmd as %String;
This holds the last 'continuation' command issued Continuation commands are 'run','step_into','step_over','step_out' 'stop' and 'detach'. We need to record this so that the appropriate status message can be reported to the client when a breakpoint is hit or the program ends.
• property NextState as %String [ InitialExpression = ..#NULLSTATE ];
This holds the next state to switch to
• property StackLevelMappings as %Integer [ MultiDimensional ];
This holds the mappings from server stack level to IDE stack level
• property StartedAttach as %Boolean [ InitialExpression = 0 ];
This says we started via Attach instead of Launch
• property TargetOrPID as %String;
This holds the target OR PID
• property Trace as %Boolean [ InitialExpression = $Get(^IRIS.Temp.Atelier("debug"))>0 ];
This holds the TRACE flag
• property TraceNode as %Integer;
This holds the TRACE global node for this session
• property TransactionId as %String [ MultiDimensional ];
This holds the current transaction identifier
• property WebSocketDevice as %String;
This holds the websocket device

Methods

• method Attach() as %Status
Utility method to attach to the target process
• method AttachCSP() as %Status
Utility method to attach to a CSP process
• method CreateErrorResponse(pCmd As %String, pErrorCode As %Integer, pTransactionId As %Integer, pMsg As %String) as %String
Create an error response including error code and message to be displayed by IDE
• method CreateEvalPropertyResponse(pVarName As %String, pVarValue As %String, Output pXML As %String, pCurrentDepth As %Integer = 0) as %Status
Given a variable name and a value, create a property for reporting the response to an eval command to the IDE
• method CreatePropertyResponse(pVarName As %String, pVarValue As %String, Output pXML As %String, pGetChildren As %Boolean = 0, pCurrentDepth As %Integer = 0) as %Status
Given a variable name and a value, create a property for reporting to the IDE If pGetChildren is set, also send the children of this variable. Used by property_get
• method FlushOutput()
Flush output before breaking the connection
• method GetClassProperties(Output pPropList As %String) as %Status
Get the properties for the CLASS context
• classmethod GetClientPosFromDebugPos(pServerIntPos, Output pMapped, ByRef pNameSpace, Output pDocName, Output pLabel, Output pOffset)
This method is given the debugger position (in the INT code) and returns a logical docname,label and offset The client will have to perform addtional logic to find exactly where in the source document the location is If pMapped is 0, then there is no source
• method GetInitMsg(Output pInitMsg) as %Status
Get InitMsg
• method GetOffset(ByRef RoutineName As %String, ByRef BeginCmdLine As %Integer, ByRef BeginCmdOffset As %Integer, ByRef EndCmdLine As %Integer, ByRef EndCmdOffset As %Integer, ByRef BeginArgLine As %Integer, ByRef BeginArgOffset As %Integer, ByRef EndArgLine As %Integer, ByRef EndArgOffset As %Integer, ByRef NameSpace As %String) as %Integer
Copied from %Studio.Debugger

Return the current location of the debugger. This includes both the command and the argument positions. Returns 0 if an error occurs.

• method GetStackProperties(pContext As %Integer, pServerLevel As %Integer, Output pPropList As %String) as %Status
Given a context (Private,Public) and stack level, get the variables defined at that level
• method InitTrace()
Intialize the trace (if required)
• classmethod Interpolate(pString, pTerm, pValue) as %String
Utility method to interpolate values in a string
• method Launch() as %Status
Utility method to launch the target given the properties set by set_feature
• method MapCommandToHandler(pCmdString As %String) as %Status
Map the command to the associated handler (assumes valid command) Some commands are handled inline
• method MappedOffset(ByRef mapping As %String, ByRef namespace As %String, ByRef flag As %String) as %Status
Copied from %Studio.Debugger

Return the list of source files that the current break point maps to starting with the INT/BAS routine. Each source file is separated by a space character. The format of each source file data is:

routineName,label,beginCmdLine,beginCmdOffset,endCmdLine,endCmdOffset,beginArgLine,beginArgOffset,endArgLine,endArgOffset,Namespace

• method OnPreServer() as %Status
Event handler for the PreServer event: this is invoked before starting the WebSockets Server. Changes to the SharedConnection flag must be made here.
• method ParseCommand(pCmdString As %String, Output pParsed) as %Status
Parse XDebug command Definition:- cmd : cmdname [ arglist ]; cmdname : lowercase STRING arglist : arg | [ arg arglist ]; arg : argid argval argid : '-' CHAR argval : STRING Example:- feature_get -i 6 -n language_supports_threads The command string is parsed into this structure:- var="feature_get" var("-i")=6 var("-n")="language_supports_threads"
• method ReportEvent(pEvent As %String, pXmlData="") as %Status
Report an event by writing to the WebSocket
• method Server() as %Status
The WebSocket Server
• method TidyUp(pStatus) as %Status
Here we do state specific tidy up (will be called if an error has occurred)
• method Trace(pMsg As %String)
Log a trace if tracing enabled
• method break() as %Status
IDE Command handler for 'break' command
• method breakpoint_get() as %Status
breakpoint_get -d User.Debug.cls:DebugMe:3 -i 51"
• method breakpoint_list() as %Status
breakpoint_list
• method breakpoint_remove() as %Status
breakpoint_remove
• method breakpoint_set() as %Status
IDE Command handler for 'breakpoint_set' command breakpoint_set -m DebugMe -n 3 -r 0 -s enabled -t line -f dbgp://|USER|User.Debug.cls -i 10"
• method breakpoint_update() as %Status
breakpoint_update
• method context_get() as %Status
IDE Command handler for 'context_get' command
• method context_names() as %Status
IDE Command handler for 'context_names' command
• method detach()
IDE Command handler for 'detach' command
• method eval() as %Status
IDE Command handler for 'eval' command
• method feature_get() as %Status
IDE Command handler for 'feature_get' command
• method feature_set() as %Status
IDE Command handler for 'feature_set' command
• method property_get() as %Status
IDE Command handler for 'property_get' command
• method property_set() as %Status
IDE Command handler for 'property_set' command
• method property_value() as %Status
IDE Command handler for 'property_value' command
• classmethod requote(value As %String) as %String
Given a string that is the output of Quote(), check for control characters that were left inside a quoted literal. If found, Quote that literal and insert it back into the original string. This is done carefully so we don't end up with double-double quotes.
• method run() as %Status
IDE Command handler for 'run' command
• method stack_get() as %Status
IDE Command handler for 'stack_get' command
• method stderr() as %Status
• method stdin() as %Status
IDE Command handler for 'stdin' command
• method stdout() as %Status
• method step_into() as %Status
IDE Command handler for 'step_into' command
• method step_out() as %Status
IDE Command handler for 'step_over' command
• method step_over() as %Status
IDE Command handler for 'step_over' command
• method stop()
IDE Command handler for 'stop' command
• method watchpoint_set() as %Status
IDE (pseudo) Command handler for 'watchpoint_set' command breakpoint_set -m DebugMe -n 2 -r 0 -s enabled -t watch -f dbgp://|USER|User.Debug.cls -i 22 -- WA==


Copyright (c) 2025 by InterSystems Corporation. Cambridge, Massachusetts, U.S.A. All rights reserved. Confidential property of InterSystems Corporation.