Debugger.hx 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package cpp.vm;
  2. import haxe.Stack;
  3. class Debugger
  4. {
  5. public static inline var BRK_TERMINATE = -1;
  6. public static inline var BRK_NONE = 0;
  7. public static inline var BRK_ASAP = 1;
  8. public static inline var BRK_STEP = 2;
  9. public static inline var BRK_ENTER = 3;
  10. public static inline var BRK_LEAVE = 4;
  11. public static function setHandler(inHandler:Void->Void)
  12. {
  13. untyped __global__.__hxcpp_dbg_set_handler(inHandler);
  14. }
  15. public static function setThread(?inDebugThread:Thread)
  16. {
  17. untyped __global__.__hxcpp_dbg_set_thread(inDebugThread==null?Thread.current().handle:inDebugThread.handle);
  18. }
  19. // Generate a handler callback ASAP
  20. public static function setBreak(inMode:Int)
  21. {
  22. untyped __global__.__hxcpp_dbg_set_break(inMode);
  23. }
  24. public static function exit()
  25. {
  26. untyped __global__.__hxcpp_dbg_set_break(BRK_TERMINATE);
  27. }
  28. // Breakpoint
  29. public static function addBreakpoint(inFileId:Int, inLine:Int)
  30. {
  31. untyped __global__.__hxcpp_breakpoints_add(inFileId, inLine);
  32. }
  33. public static function getBreakpoints() : Array<String>
  34. {
  35. return untyped __global__.__hxcpp_dbg_breakpoints_get();
  36. }
  37. public static function deleteBreakpoint(inI:Int)
  38. {
  39. untyped __global__.__hxcpp_dbg_breakpoints_delete(inI);
  40. }
  41. // Thread - todo
  42. // public static function suspendAll()
  43. // Callstack
  44. public static function getStackFrames() : Array<haxe.StackItem>
  45. {
  46. return untyped __global__.__hxcpp_dbg_stack_frames_get();
  47. }
  48. public static function getStackVars(inFrame:Int) : Array<String>
  49. {
  50. return untyped __global__.__hxcpp_dbg_get_stack_vars(inFrame);
  51. }
  52. public static function getStackVar(inFrame:Int,inVar:String) : Dynamic
  53. {
  54. return untyped __global__.__hxcpp_dbg_get_stack_var(inFrame,inVar);
  55. }
  56. public static function setStackVar(inFrame:Int,inVar:String, inValue:Dynamic)
  57. {
  58. untyped __global__.__hxcpp_dbg_set_stack_var(inFrame,inVar,inValue);
  59. }
  60. public static function getFiles() : Array<String>
  61. {
  62. return untyped __global__.__hxcpp_dbg_get_files();
  63. }
  64. }