Debugger.hx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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(?inIgnoreThread:Thread)
  16. {
  17. untyped __global__.__hxcpp_dbg_set_thread(inIgnoreThread==null?Thread.current().handle:inIgnoreThread.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 getFiles() : Array<String>
  53. {
  54. return untyped __global__.__hxcpp_dbg_get_files();
  55. }
  56. public static function getClasses() : Array<Class<Dynamic> >
  57. {
  58. return untyped __global__.__hxcpp_dbg_get_classes();
  59. }
  60. }