Debugger.hx 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package cpp.vm;
  2. // TODO: implement this
  3. typedef Breakpoint = Dynamic;
  4. typedef StackFrame = Dynamic;
  5. class Debugger
  6. {
  7. public static inline var BRK_TERMINATE = -1;
  8. public static inline var BRK_NONE = 0;
  9. public static inline var BRK_ASAP = 1;
  10. public static inline var BRK_STEP = 2;
  11. public static inline var BRK_ENTER = 3;
  12. public static inline var BRK_LEAVE = 4;
  13. public static function setHandler(inHandler:Void->Void)
  14. {
  15. untyped __global__.__hxcpp_dbg_set_handler(inHandler);
  16. }
  17. // Generate a handler callback ASAP
  18. public static function setBreak(inMode:Int,?inIgnoreThread:Thread)
  19. {
  20. untyped __global__.__hxcpp_dbg_set_break(inMode,inIgnoreThread==null?null:inIgnoreThread.handle);
  21. }
  22. public static function exit()
  23. {
  24. untyped __global__.__hxcpp_dbg_set_break(BRK_TERMINATE,null);
  25. }
  26. // Breakpoint
  27. public static function addBreakpoint(inBreakpoint:Breakpoint)
  28. {
  29. untyped __global__.__hxcpp_breakpoints_add(inBreakpoint);
  30. }
  31. public static function getBreakpoints() : Array<Breakpoint>
  32. {
  33. return untyped __global__.__hxcpp_dbg_breakpoints_get();
  34. }
  35. public static function deleteBreakpoint(inI:Int)
  36. {
  37. untyped __global__.__hxcpp_dbg_breakpoints_delete(inI);
  38. }
  39. // Thread - todo
  40. // public static function suspendAll()
  41. // Callstack
  42. public static function getStackFrames() : Array<StackFrame>
  43. {
  44. return untyped __global__.__hxcpp_dbg_stack_frames_get();
  45. }
  46. public static function getStackVars(inFrame:Int) : Array<String>
  47. {
  48. return untyped __global__.__hxcpp_dbg_get_stack_vars(inFrame);
  49. }
  50. public static function getFiles() : Array<String>
  51. {
  52. return untyped __global__.__hxcpp_dbg_get_files();
  53. }
  54. public static function getClasses() : Array<Class<Dynamic> >
  55. {
  56. return untyped __global__.__hxcpp_dbg_get_classes();
  57. }
  58. }