class cpp.vm.Debugger

Available on cpp

This class wraps the hxcpp C++ implementation to provide a Haxe interface to the low level debugging features

Class Fields

static var STEP_INTO:Int

static var STEP_OUT:Int

static var STEP_OVER:Int

static var THREAD_CREATED:Int

static var THREAD_STARTED:Int

static var THREAD_STOPPED:Int

static function addClassFunctionBreakpoint(className:String, functionName:String):Int

Adds a new class:function breakpoint. The breakpoint number of the newly added breakpoint is returned.

static function addFileLineBreakpoint(file:String, line:Int):Int

Adds a new file:line breakpoint. The breakpoint number of the newly added breakpoint is returned.

static function breakNow(?wait:Bool):Void

Breaks all threads except the debugger thread (which should be the same as the calling thread!).

If [wait] is true, waits up to 2 seconds for all threads to be broken. Threads which are in blocking system calls and cannot break after 2 seconds remain running when this function returns.

static function continueThreads(specialThreadNumber:Int, continueCount:Int):Void

Continue execution of all stopped threads. If specialThreadNumber is a valid thread number, then it will be continued past [continueCount] breakpoints instead of just 1 like all of the other threads.

static function deleteBreakpoint(number:Null<Int>):Void

Deletes a breakpoint, or all breakpoints.

static function enableCurrentThreadDebugging(enabled:Bool):Void

This can be called to turn off (and then back on) all stopping of debugged threads temporarily. It should only be used by classes that actually implement the debugger to hide themselves from the debugger as necessary.

static function getClasses():Array<String>

Returns the set of class names of all classes known to the debugger. This is a copy of the original array and could be quite large. The caller should cache this value to avoid multiple copies needing to be made.

returns

the set of class names of all classes known to the debugger.

static function getCurrentThreadNumber():Int

Returns the thread number of the calling thread.

returns

the thread number of the calling thread.

static function getFiles():Array<String>

Returns the set of source files known to the debugger. This is a copy of the original array and could be quite large. The caller should cache this value to avoid multiple copies needing to be made.

returns

the set of source files known to the debugger.

static function getStackVariableValue(threadNumber:Int, stackFrameNumber:Int, name:String, unsafe:Bool):Dynamic

Returns the value of a stack variable, or NONEXISTENTVALUE if the requested value does not exist. If the thread is actively running and unsafe is not true, returns THREADNOT_STOPPED.

static function getStackVariables(threadNumber:Int, stackFrameNumber:Int, unsafe:Bool):Array<String>

Returns the list of local variables (including "this", function arguments, and local variables) visible to the given thread at the given stack frame.

Returns a list with a single entry, THREADNOTSTOPPED, if the thread is not stopped and thus variables cannot be fetched and unsafe is not true.

returns

the list of local variables (including "this", function arguments, and local variables) visible to the given thread at the given stack frame.

static function getThreadInfo(threadNumber:Int, unsafe:Bool):ThreadInfo

Returns a ThreadInfo object describing a single thread, or null if there is no such thread or the thread queried about was the debugger thread and unsafe was not true.

static function getThreadInfos():Array<ThreadInfo>

Returns a ThreadInfo object describing every thread that existed at the moment that the call was made, except for the debugger thread.

static function setEventNotificationHandler(handler:Int ->Int ->String ->String ->String ->Int ->Void):Void

Sets the handler callback to be made when asynchronous events occur, specifically, when threads are created, terminated, started, or stopped. The calling thread becomes the "debugger" thread, which means that it will be discluded from any breakpoints and will not be reported on by any thread reporting requests.

Be aware that this callback is made asynchronously and possibly by multiple threads simultaneously.

Setting this to null prevents further callbacks.

Throws a string exception if the program does not support debugging because it was not compiled with the HXCPP_DEBUGGER flag set.

handler

is a function that will be called back by asynchronous thread events. Note that this function is called directly from the thread experiencing the event and the handler should return quickly to avoid blocking the calling thread unnecessarily. The paramaters to handler are: - threadNumber, the thread number of the event - event, one of THREADCREATED, THREADTERMINATED, THREADSTARTED, or THREADSTOPPED - className, the class name at which the thread is stopped, undefined if event is not THREADSTOPPED - functionName, the function name at which the thread is stopped, undefined if event is not THREADSTOPPED - fileName, the file name at which the thread is stopped, undefined if event is not THREADSTOPPED - lineNumber, the line number at which the thread is stopped, undefined if event is not THREADSTOPPED

static function setStackVariableValue(threadNumber:Int, stackFrameNumber:Int, name:String, value:Dynamic, unsafe:Bool):Dynamic

Sets the value of a stack variable and returns that value. If the variable does not exist, on the stack, this function returns NONEXISTENTVALUE. If the thread is actively running and unsafe is not true, returns THREADNOT_STOPPED, and the value is not set.

static function stepThread(threadNumber:Int, stepType:Int, ?stepCount:Int):Void

Single steps the given thread.