説明を見る。00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef V8_DEBUG_H_
00029 #define V8_DEBUG_H_
00030
00031 #include "v8.h"
00032
00033 #ifdef _WIN32
00034 typedef int int32_t;
00035 typedef unsigned int uint32_t;
00036 typedef unsigned short uint16_t;
00037 typedef long long int64_t;
00038
00039
00040
00041 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
00042 #error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\
00043 build configuration to ensure that at most one of these is set
00044 #endif
00045
00046 #ifdef BUILDING_V8_SHARED
00047 #define EXPORT __declspec(dllexport)
00048 #elif USING_V8_SHARED
00049 #define EXPORT __declspec(dllimport)
00050 #else
00051 #define EXPORT
00052 #endif
00053
00054 #else // _WIN32
00055
00056
00057
00058 #if defined(__GNUC__) && (__GNUC__ >= 4)
00059 #define EXPORT __attribute__ ((visibility("default")))
00060 #else // defined(__GNUC__) && (__GNUC__ >= 4)
00061 #define EXPORT
00062 #endif // defined(__GNUC__) && (__GNUC__ >= 4)
00063
00064 #endif // _WIN32
00065
00066
00070 namespace v8 {
00071
00072
00073 enum DebugEvent {
00074 Break = 1,
00075 Exception = 2,
00076 NewFunction = 3,
00077 BeforeCompile = 4,
00078 AfterCompile = 5
00079 };
00080
00081
00091 typedef void (*DebugEventCallback)(DebugEvent event,
00092 Handle<Object> exec_state,
00093 Handle<Object> event_data,
00094 Handle<Value> data);
00095
00096
00105 typedef void (*DebugMessageHandler)(const uint16_t* message, int length,
00106 void* data);
00107
00108
00109 class EXPORT Debug {
00110 public:
00111
00112 static bool AddDebugEventListener(DebugEventCallback that,
00113 Handle<Value> data = Handle<Value>());
00114
00115
00116 static bool AddDebugEventListener(v8::Handle<v8::Function> that,
00117 Handle<Value> data = Handle<Value>());
00118
00119
00120 static void RemoveDebugEventListener(DebugEventCallback that);
00121
00122
00123 static void RemoveDebugEventListener(v8::Handle<v8::Function> that);
00124
00125
00126 static void StackDump();
00127
00128
00129 static void DebugBreak();
00130
00131
00132 static void SetMessageHandler(DebugMessageHandler handler, void* data = NULL);
00133 static void SendCommand(const uint16_t* command, int length);
00134 };
00135
00136
00137 }
00138
00139
00140 #undef EXPORT
00141
00142
00143 #endif // V8_DEBUG_H_