This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Home > Class Reference > %SYS namespace > %Studio.Debugger

%Studio.Debugger

class %Studio.Debugger extends %Library.RegisteredObject

This class is used internally by Caché. You should not make direct use of it within your applications. There is no guarantee made about either the behavior or future operation of this class.

Studio debugging interface.

Property Inventory

Method Inventory

Properties

property Breakpoints as %String;
Current breakpoint information for target process
Property methods: BreakpointsDisplayToLogical(), BreakpointsGet(), BreakpointsIsValid(), BreakpointsLogicalToDisplay(), BreakpointsLogicalToOdbc(), BreakpointsNormalize(), BreakpointsSet()
property CSPId as %String;
SessionId if attached to CSP process
Property methods: CSPIdDisplayToLogical(), CSPIdGet(), CSPIdIsValid(), CSPIdLogicalToDisplay(), CSPIdLogicalToOdbc(), CSPIdNormalize(), CSPIdSet()
property Debug as %Debugger.System;
System Debugger object
Property methods: DebugGet(), DebugGetSwizzled(), DebugIsValid(), DebugNewObject(), DebugSet()
property IO as %Boolean;
I/O redirection flag
Property methods: IODisplayToLogical(), IOGet(), IOIsValid(), IOLogicalToDisplay(), IONormalize(), IOSet()
property LastError as %Integer;
Last error
Property methods: LastErrorDisplayToLogical(), LastErrorGet(), LastErrorIsValid(), LastErrorLogicalToDisplay(), LastErrorNormalize(), LastErrorSet()
property Project as Project;
Project
Property methods: ProjectGet(), ProjectGetObject(), ProjectGetObjectId(), ProjectGetSwizzled(), ProjectIsValid(), ProjectNewObject(), ProjectSet(), ProjectSetObject(), ProjectSetObjectId(), ProjectUnSwizzle()
property Watchpoints as %String;
Current watchpoint information for target process
Property methods: WatchpointsDisplayToLogical(), WatchpointsGet(), WatchpointsIsValid(), WatchpointsLogicalToDisplay(), WatchpointsLogicalToOdbc(), WatchpointsNormalize(), WatchpointsSet()
property trace as %Boolean [ InitialExpression = 0 ];
Property methods: traceDisplayToLogical(), traceGet(), traceIsValid(), traceLogicalToDisplay(), traceNormalize(), traceSet()

Methods

method Attach(pid As %String = "", project As Project = "") as %Status
Attach to another process having process id of pid.

Fails if already attached (use Unattach() first),or if pid is invalid.

On successful completion, process is attached and a break issued. The process will be in break mode upon completion of its current operation.

method AttachToCSP(id As %Integer, project As Project = "") as %Status
Attach to a CSP process, first you must call the GetCSPAttachID() to obtain the ID to pass to this method.
method Break() as %Boolean
Send a BREAK to the target process.

A successful return indicates the target will be in break mode on completion of the current command.

Issue IsStopped to determine if target is in break mode.

method ClearBreakpoints() as %Boolean
method DBGCommand(cmd As %String, IsSys As %Integer = 0) as %Boolean
Perform a debug command.
method DisableBreakpoint(routine As %String, offset As %Integer, condition As %String = "", counter As %Integer, label As %String = "") as %Boolean
method DisableWatchpoint(variable As %String, counter As %Integer) as %Boolean
method Eval(expr As %String = "") as %String
Evaluate and return the value of expression expr within the target process.
method GetCSPAttachID() as %Integer
To attach to a CSP process, first call this method which will return you a unique ID number. Then display the CSP page but add an extra parameter of 'CSPDEBUG=<ID>' for example 'http://localhost/csp/samples/loop.csp?CSPDEBUG=123456'. Then call the AttachToCSP() method which will attach to the process that is running this CSP page.
classmethod GetInfo(Job As %Integer, Pid As %Integer) as %String
Gather information about a process
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
Return the current location of the debugger. This includes both the command and the argument positions.
method GetSource() as %String
Return the routine source at the current location
method GetStack() as %String
Gets the simple stack information sent from the target.
method GetStackId() as %String
Requests stack variable info.
method GetValue(variable As %String = "", ByRef value As %String) as %Boolean
Gets the value of a variable.
method Go() as %Boolean
Continue the current process
method GoTo(tag As %String) as %Boolean
Continue the current process
classmethod INTLine(name As %String, label As %String, line As %Integer, ByRef intname As %String, ByRef intline As %String, ByRef returntype As %Integer, pNameSpace As %String = $namespace) as %Status
Given a document name, label and line offset it returns the name and line corresponding to this in the INT code returntype values are
  • 0 - Ok
  • 1 - Line given is not mapped so returning the next mapped line as breakpoint instead
  • 2 - No mapping found at all, nothing returned
For example if you wish to find out which line is generated from class 'User.Test' in method 'MyMethod' at offset '+3' you call:
Set sc=##class(%Studio.Debugger).INTLine("User.Test.CLS","MyMethod",3,.intname,.intline,.returntype)
type is one of 'CLS' or 'MAC' currently.
method Interrupt() as %Boolean
Interrupt the target process. The current command will be interrupted. Execution will proceed with the next command.
method IsStopped() as %Integer
Returns 1 if the target is stopped in break mode. 0 indicates target is still running. 2 indicates target has exited debugger or fatal error.
method Line() as %Boolean
method LineIn() as %Boolean
method LineOut() as %Boolean
classmethod MappedFromLine(rtn As %String, line As %Integer, namespace As %String, ByRef mapping As %String) as %Status
Return the list of source files that the routine and line map to. The format of each source file data is:

routineName.routineType,label,line,namespace

classmethod MappedFromPos(routineName As %String, beginCmdLine As %Integer, beginCmdOffset As %Integer, endCmdLine As %Integer, endCmdOffset As %Integer, beginArgLine As %Integer, beginArgOffset As %Integer, endArgLine As %Integer, endArgOffset As %Integer, namespace As %String, ByRef mapping As %String, ByRef flag As %String) as %Status
Return the list of source files that the position passed in maps to. 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 MappedOffset(ByRef mapping As %String, ByRef namespace As %String, ByRef flag As %String) as %Status
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 Pid() as %String
return process id of attached target
classmethod ProcessListClose(QHandle As %Binary) as %Status
classmethod ProcessListExecute(ByRef QHandle As %Binary) as %Status
classmethod ProcessListFetch(ByRef QHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) as %Status
method RemoveBreakpoint(routine As %String, offset As %Integer, label As %String = "") as %Boolean
method RemoveWatchpoint(variable As %String) as %Boolean
method RoutineMap(current As %String, routine As %String, rouns As %String) as %Boolean
Check if routine is mapped to current namespace

Returns 1 if successful, 0 if not mapped to current

method SetBreakpoint(routine As %String, offset As %Integer, condition As %String = "", label As %String = "") as %Boolean
method SetBreakpointsFromProject(project As Project) as %Boolean
Set all break points defined in project.

Return 0 if project=NULL, else return status code from SetBreakpoint

method SetValue(variable As %String = "", value As %String = "") as %Boolean
Sets a variable to a value.
method SetWatchpoint(variable As %String, condition As %String = "") as %Boolean
classmethod SourceLine(intName As %String, startLine As %Integer, startPos As %Integer, endLine As %Integer, endPos As %Integer, Namespace As %String, ByRef map As %String) as %Status
Given INT routine name and line number and offset in this line return an array of source lines that map to this INT line. The format of this return array is:

map(type,StartEnd)=$listbuild(sourceName,sourceLabel,sourceLine,Offset,Namespace)

Where StartEnd is 1 for the start of the map and 2 for the end, sourceName is the name of the source file, sourceLabel is the method/label name, sourceLine is the number of lines from this label to the location, Offset is the offset on the line, Namespace is the location of the source file.

method StartTarget(tag As %String, StartOption As %Boolean = 0, project As Project = "") as %Status
Job off a routine that executes tag. If breakpoints are specified, the target will halt at the first breakpoint.
method Step() as %Boolean
method StepIn() as %Boolean
method StepOut() as %Boolean
method Unattach(kill As %Boolean) as %Status
Unattach from the current process, if any.

Returns $$$OK if successful, $$$ERROR if nothing to detach from

method ViewAsBinary(variableName As %String) as %String
classmethod WatchListClose(ByRef qHandle As %Binary) as %Status
classmethod WatchListExecute(ByRef qHandle As %Binary, deb As %Integer, Watch As %String(MAXLEN=1024)) as %Status
classmethod WatchListFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) as %Status
classmethod WatchListOrefClose(ByRef qHandle As %Binary) as %Status
classmethod WatchListOrefExecute(ByRef qHandle As %Binary, deb As %Integer, Watch As %String(MAXLEN=256)) as %Status
classmethod WatchListOrefFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) as %Status
method WriteTarget(data As %String) as %Boolean
Write to target process

Queries

query ProcessList()
Selects PID As %String, Namespace As %String, Routine As %String, State As %String, Device As %String
query WatchList(deb As %Integer, Watch As %String(MAXLEN=1024))
Selects Expression As %String, Value As %String
Get the values of the specified $c(1)-separated list of variables.
query WatchListOref(deb As %Integer, WatchOref As %String(MAXLEN=256))
Selects Expression As %String, Value As %String
Get the properties of the specified variable whose value is an oref. %Studio.General::DumpObjectExecute implements logic to dump object and collect properties in qHandle array. WatchList query from %Studio.Debugger to deliver array to client.

Inherited Members

Inherited Methods

FeedbackOpens in a new window