OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_DEBUG_INTERFACE_TYPES_H_ | 5 #ifndef V8_DEBUG_INTERFACE_TYPES_H_ |
6 #define V8_DEBUG_INTERFACE_TYPES_H_ | 6 #define V8_DEBUG_INTERFACE_TYPES_H_ |
7 | 7 |
8 #include <cstdint> | 8 #include <cstdint> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
| 12 #include "include/v8-debug.h" |
| 13 |
12 namespace v8 { | 14 namespace v8 { |
13 namespace debug { | 15 namespace debug { |
14 | 16 |
15 /** | 17 /** |
16 * Defines location inside script. | 18 * Defines location inside script. |
17 * Lines and columns are 0-based. | 19 * Lines and columns are 0-based. |
18 */ | 20 */ |
19 class Location { | 21 class Location { |
20 public: | 22 public: |
21 Location(int line_number, int column_number); | 23 Location(int line_number, int column_number); |
(...skipping 30 matching lines...) Expand all Loading... |
52 using OffsetTable = std::vector<WasmDisassemblyOffsetTableEntry>; | 54 using OffsetTable = std::vector<WasmDisassemblyOffsetTableEntry>; |
53 WasmDisassembly() {} | 55 WasmDisassembly() {} |
54 WasmDisassembly(std::string disassembly, OffsetTable offset_table) | 56 WasmDisassembly(std::string disassembly, OffsetTable offset_table) |
55 : disassembly(std::move(disassembly)), | 57 : disassembly(std::move(disassembly)), |
56 offset_table(std::move(offset_table)) {} | 58 offset_table(std::move(offset_table)) {} |
57 | 59 |
58 std::string disassembly; | 60 std::string disassembly; |
59 OffsetTable offset_table; | 61 OffsetTable offset_table; |
60 }; | 62 }; |
61 | 63 |
| 64 enum ExceptionBreakState { |
| 65 NoBreakOnException = 0, |
| 66 BreakOnUncaughtException = 1, |
| 67 BreakOnAnyException = 2 |
| 68 }; |
| 69 |
| 70 /** |
| 71 * An event details object passed to the debug event listener. |
| 72 */ |
| 73 class EventDetails : public v8::Debug::EventDetails { |
| 74 public: |
| 75 /** |
| 76 * Event type. |
| 77 */ |
| 78 virtual v8::DebugEvent GetEvent() const = 0; |
| 79 |
| 80 /** |
| 81 * Access to execution state and event data of the debug event. Don't store |
| 82 * these cross callbacks as their content becomes invalid. |
| 83 */ |
| 84 virtual Local<Object> GetExecutionState() const = 0; |
| 85 virtual Local<Object> GetEventData() const = 0; |
| 86 |
| 87 /** |
| 88 * Get the context active when the debug event happened. Note this is not |
| 89 * the current active context as the JavaScript part of the debugger is |
| 90 * running in its own context which is entered at this point. |
| 91 */ |
| 92 virtual Local<Context> GetEventContext() const = 0; |
| 93 |
| 94 /** |
| 95 * Client data passed with the corresponding callback when it was |
| 96 * registered. |
| 97 */ |
| 98 virtual Local<Value> GetCallbackData() const = 0; |
| 99 |
| 100 virtual ~EventDetails() {} |
| 101 }; |
| 102 |
| 103 /** |
| 104 * Native wrapper around v8::internal::Script object. |
| 105 */ |
| 106 class Script { |
| 107 public: |
| 108 v8::Isolate* GetIsolate() const; |
| 109 |
| 110 ScriptOriginOptions OriginOptions() const; |
| 111 bool WasCompiled() const; |
| 112 int Id() const; |
| 113 int LineOffset() const; |
| 114 int ColumnOffset() const; |
| 115 std::vector<int> LineEnds() const; |
| 116 MaybeLocal<String> Name() const; |
| 117 MaybeLocal<String> SourceURL() const; |
| 118 MaybeLocal<String> SourceMappingURL() const; |
| 119 MaybeLocal<String> ContextData() const; |
| 120 MaybeLocal<String> Source() const; |
| 121 bool IsWasm() const; |
| 122 bool GetPossibleBreakpoints(const debug::Location& start, |
| 123 const debug::Location& end, |
| 124 std::vector<debug::Location>* locations) const; |
| 125 |
| 126 /** |
| 127 * script parameter is a wrapper v8::internal::JSObject for |
| 128 * v8::internal::Script. |
| 129 * This function gets v8::internal::Script from v8::internal::JSObject and |
| 130 * wraps it with DebugInterface::Script. |
| 131 * Returns empty local if not called with a valid wrapper of |
| 132 * v8::internal::Script. |
| 133 */ |
| 134 static MaybeLocal<Script> Wrap(Isolate* isolate, |
| 135 v8::Local<v8::Object> script); |
| 136 |
| 137 private: |
| 138 int GetSourcePosition(const debug::Location& location) const; |
| 139 }; |
| 140 |
| 141 enum StepAction { |
| 142 StepOut = 0, // Step out of the current function. |
| 143 StepNext = 1, // Step to the next statement in the current function. |
| 144 StepIn = 2, // Step into new functions invoked or the next statement |
| 145 // in the current function. |
| 146 StepFrame = 3 // Step into a new frame or return to previous frame. |
| 147 }; |
| 148 |
62 } // namespace debug | 149 } // namespace debug |
63 } // namespace v8 | 150 } // namespace v8 |
64 | 151 |
65 #endif // V8_DEBUG_INTERFACE_TYPES_H_ | 152 #endif // V8_DEBUG_INTERFACE_TYPES_H_ |
OLD | NEW |