Skip to main content

%Studio.Debugger

Class %Studio.Debugger Extends %Library.RegisteredObject [ System = 3 ]

This class is used internally by InterSystems IRIS. 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.

Properties

CSPId

Property CSPId As %String;

SessionId if attached to CSP process

Debug

Property Debug As %Debugger.System;

System Debugger object

LastError

Property LastError As %Integer;

Last error

Breakpoints

Property Breakpoints As %String;

Current breakpoint information for target process

Watchpoints

Property Watchpoints As %String;

Current watchpoint information for target process

IO

Property IO As %Boolean;

I/O redirection flag

Project

Property Project As Project;

Project

trace

Property trace As %Boolean [ InitialExpression = 0 ];

Methods

StartTarget

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.

TranslateMvb

Method TranslateMvb(ByRef tag As %String) As %Boolean [ Private ]

Attach

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.

%OnNew

Method %OnNew(initval As %RawString = "") As %Status [ Private ]

Break

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.

IsStopped

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.

WriteTarget

Method WriteTarget(data As %String) As %Boolean

Write to target process

Interrupt

Method Interrupt() As %Boolean

Interrupt the target process. The current command will be interrupted. Execution will proceed with the next command.

DBGCommand

Method DBGCommand(cmd As %String, IsSys As %Integer = 0) As %Boolean

Perform a debug command.

Eval

Method Eval(expr As %String = "") As %String

Evaluate and return the value of expression expr within the target process.

SetValue

Method SetValue(variable As %String = "", value As %String = "") As %Boolean

Sets a variable to a value.

GetValue

Method GetValue(variable As %String = "", ByRef value As %String) As %Boolean

Gets the value of a variable.

GetStack

Method GetStack() As %String

Gets the simple stack information sent from the target.

GetStackId

Method GetStackId() As %String

Requests stack variable info.

GetOffset

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.

GetSource

Method GetSource() As %String

Return the routine source at the current location

%OnClose

Method %OnClose() As %Status [ Private, ProcedureBlock = 1 ]

RoutineMap

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

Go

Method Go() As %Boolean

Continue the current process

GoTo

Method GoTo(tag As %String) As %Boolean

Continue the current process

Line

Method Line() As %Boolean

LineIn

Method LineIn() As %Boolean

LineOut

Method LineOut() As %Boolean

SetBreakpoint

Method SetBreakpoint(routine As %String, offset As %Integer, condition As %String = "", label As %String = "") As %Boolean

DisableBreakpoint

Method DisableBreakpoint(routine As %String, offset As %Integer, condition As %String = "", counter As %Integer, label As %String = "") As %Boolean

RemoveBreakpoint

Method RemoveBreakpoint(routine As %String, offset As %Integer, label As %String = "") As %Boolean

ClearBreakpoints

Method ClearBreakpoints() As %Boolean

SetWatchpoint

Method SetWatchpoint(variable As %String, condition As %String = "") As %Boolean

DisableWatchpoint

Method DisableWatchpoint(variable As %String, counter As %Integer) As %Boolean

RemoveWatchpoint

Method RemoveWatchpoint(variable As %String) As %Boolean

SetBreakpointsFromProject

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

Step

Method Step() As %Boolean

StepIn

Method StepIn() As %Boolean

StepOut

Method StepOut() As %Boolean

Unattach

Method Unattach(kill As %Boolean) As %Status

Unattach from the current process, if any.

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

GetCSPAttachID

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=' 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.

AttachToCSP

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.

ProcessListExecute

ClassMethod ProcessListExecute(ByRef QHandle As %Binary) As %Status

ProcessListClose

ClassMethod ProcessListClose(QHandle As %Binary) As %Status

ProcessListFetch

ClassMethod ProcessListFetch(ByRef QHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status

GetInfo

ClassMethod GetInfo(Job As %Integer, Pid As %Integer) As %String

Gather information about a process

INTLine

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.

SourceLine

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.

addMap

ClassMethod addMap(name, intmvikey, type, line, pos, map, loc, Namespace) [ Private ]

MappedOffset

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

MappedFromPos

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

MappedFromLine

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

Error

Method Error(err As %String) As %Integer [ Private ]

error routine

Pid

Method Pid() As %String

return process id of attached target

WatchListExecute

ClassMethod WatchListExecute(ByRef qHandle As %Binary, deb As %Integer, Watch As %String(MAXLEN=1024)) As %Status

Get the values of the specified $c(1)-separated list of variables.

WatchListClose

ClassMethod WatchListClose(ByRef qHandle As %Binary) As %Status [ PlaceAfter = WatchListExecute ]

WatchListFetch

ClassMethod WatchListFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ PlaceAfter = WatchListExecute ]

WatchListOrefExecute

ClassMethod WatchListOrefExecute(ByRef qHandle As %Binary, deb As %Integer, Watch As %String(MAXLEN=256)) As %Status

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.

WatchListOrefClose

ClassMethod WatchListOrefClose(ByRef qHandle As %Binary) As %Status [ PlaceAfter = WatchListExecute ]

WatchListOrefFetch

ClassMethod WatchListOrefFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ PlaceAfter = WatchListExecute ]

ViewAsBinary

Method ViewAsBinary(variableName As %String) As %String