api_makidebug.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #ifndef __API_MAKIDEBUG_H
  2. #define __API_MAKIDEBUG_H
  3. /*---------------------------------------------------------
  4. api_makiDebugger
  5. void debugger_trace();
  6. int debugger_isActive();
  7. int debugger_getVIP();
  8. int debugger_getVSD();
  9. int debugger_getVCC();
  10. int debugger_getVSP();
  11. int debugger_filterEvent(int vcpuid, int eventid);
  12. void debugger_eventComplete();
  13. MakiJITD *debugger_createJITD(int vcpuid, int bringitup=1);
  14. int debugger_readStack(int n);
  15. int debugger_getCodeBlock(int vcpuid);
  16. ---------------------------------------------------------*/
  17. #include <wasabicfg.h>
  18. #ifndef WASABI_COMPILE_SCRIPT
  19. #error "This module requires the script api"
  20. #endif
  21. #ifndef WASABI_COMPILE_MAKIDEBUG
  22. #error "This module requires the script debugger api"
  23. #endif
  24. #include <bfc/dispatch.h>
  25. #include <api/script/scriptvar.h>
  26. class MakiJITD;
  27. class NOVTABLE api_makiDebugger : public Dispatchable {
  28. public:
  29. void debugger_trace();
  30. int debugger_isActive();
  31. int debugger_getVIP();
  32. int debugger_getVSD();
  33. int debugger_getVCC();
  34. int debugger_getVSP();
  35. int debugger_filterEvent(int vcpuid, int eventid);
  36. void debugger_eventComplete();
  37. MakiJITD *debugger_createJITD(int vcpuid, int bringitup=1);
  38. scriptVar debugger_readStack(int n);
  39. const char *debugger_getCodeBlock(int vcpuid);
  40. enum {
  41. API_MAKIDEBUGGER_DEBUGGER_TRACE = 0,
  42. API_MAKIDEBUGGER_DEBUGGER_ISACTIVE = 10,
  43. API_MAKIDEBUGGER_DEBUGGER_GETVIP = 20,
  44. API_MAKIDEBUGGER_DEBUGGER_GETVSD = 30,
  45. API_MAKIDEBUGGER_DEBUGGER_GETVCC = 40,
  46. API_MAKIDEBUGGER_DEBUGGER_GETVSP = 50,
  47. API_MAKIDEBUGGER_DEBUGGER_FILTEREVENT = 60,
  48. API_MAKIDEBUGGER_DEBUGGER_EVENTCOMPLETE = 70,
  49. API_MAKIDEBUGGER_DEBUGGER_CREATEJITD = 80,
  50. API_MAKIDEBUGGER_DEBUGGER_READSTACK = 90,
  51. API_MAKIDEBUGGER_DEBUGGER_GETCODEBLOCK = 100,
  52. };
  53. };
  54. inline void api_makiDebugger::debugger_trace() {
  55. _voidcall(API_MAKIDEBUGGER_DEBUGGER_TRACE);
  56. }
  57. inline int api_makiDebugger::debugger_isActive() {
  58. return _call(API_MAKIDEBUGGER_DEBUGGER_ISACTIVE, (int)0);
  59. }
  60. inline int api_makiDebugger::debugger_getVIP() {
  61. return _call(API_MAKIDEBUGGER_DEBUGGER_GETVIP, (int)0);
  62. }
  63. inline int api_makiDebugger::debugger_getVSD() {
  64. return _call(API_MAKIDEBUGGER_DEBUGGER_GETVSD, (int)0);
  65. }
  66. inline int api_makiDebugger::debugger_getVCC() {
  67. return _call(API_MAKIDEBUGGER_DEBUGGER_GETVCC, (int)0);
  68. }
  69. inline int api_makiDebugger::debugger_getVSP() {
  70. return _call(API_MAKIDEBUGGER_DEBUGGER_GETVSP, (int)0);
  71. }
  72. inline int api_makiDebugger::debugger_filterEvent(int vcpuid, int eventid) {
  73. return _call(API_MAKIDEBUGGER_DEBUGGER_FILTEREVENT, (int)0, vcpuid, eventid);
  74. }
  75. inline void api_makiDebugger::debugger_eventComplete() {
  76. _voidcall(API_MAKIDEBUGGER_DEBUGGER_EVENTCOMPLETE);
  77. }
  78. inline MakiJITD *api_makiDebugger::debugger_createJITD(int vcpuid, int bringitup) {
  79. return _call(API_MAKIDEBUGGER_DEBUGGER_CREATEJITD, (MakiJITD *)NULL, vcpuid, bringitup);
  80. }
  81. inline const char *api_makiDebugger::debugger_getCodeBlock(int vcpuid) {
  82. return _call(API_MAKIDEBUGGER_DEBUGGER_GETCODEBLOCK, (const char *)NULL, vcpuid);
  83. }
  84. inline scriptVar api_makiDebugger::debugger_readStack(int n) {
  85. scriptVar v={0,0};
  86. return _call(API_MAKIDEBUGGER_DEBUGGER_READSTACK, v, n);
  87. }
  88. class api_makiDebuggerI : public api_makiDebugger {
  89. public:
  90. virtual void debugger_trace()=0;
  91. virtual int debugger_isActive()=0;
  92. virtual int debugger_getVIP()=0;
  93. virtual int debugger_getVSD()=0;
  94. virtual int debugger_getVCC()=0;
  95. virtual int debugger_getVSP()=0;
  96. virtual int debugger_filterEvent(int vcpuid, int eventid)=0;
  97. virtual void debugger_eventComplete()=0;
  98. virtual MakiJITD *debugger_createJITD(int vcpuid, int bringitup=1)=0;
  99. virtual scriptVar debugger_readStack(int n)=0;
  100. virtual const char *debugger_getCodeBlock(int vcpuid)=0;
  101. protected:
  102. RECVS_DISPATCH;
  103. };
  104. // {858E4B64-AF1E-4b64-8D27-EFFAD9F82BB4}
  105. static const GUID makiDebugApiServiceGuid =
  106. { 0x858e4b64, 0xaf1e, 0x4b64, { 0x8d, 0x27, 0xef, 0xfa, 0xd9, 0xf8, 0x2b, 0xb4 } };
  107. extern api_makiDebugger *debugApi;
  108. #endif