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 3 // found in the LICENSE file. 4 5 #ifndef V8_DEBUG_INTERFACE_TYPES_H_ 6 #define V8_DEBUG_INTERFACE_TYPES_H_ 7 8 #include <cstdint> 9 #include <string> 10 #include <vector> 11 12 #include "src/globals.h" 13 14 namespace v8 { 15 namespace debug { 16 17 /** 18 * Defines location inside script. 19 * Lines and columns are 0-based. 20 */ 21 class V8_EXPORT_PRIVATE Location { 22 public: 23 Location(int line_number, int column_number); 24 /** 25 * Create empty location. 26 */ 27 Location(); 28 29 int GetLineNumber() const; 30 int GetColumnNumber() const; 31 bool IsEmpty() const; 32 33 private: 34 int line_number_; 35 int column_number_; 36 }; 37 38 /** 39 * The result of disassembling a wasm function. 40 * Consists of the disassembly string and an offset table mapping wasm byte 41 * offsets to line and column in the disassembly. 42 * The offset table entries are ordered by the byte_offset. 43 * All numbers are 0-based. 44 */ 45 struct WasmDisassemblyOffsetTableEntry { WasmDisassemblyOffsetTableEntryWasmDisassemblyOffsetTableEntry46 WasmDisassemblyOffsetTableEntry(uint32_t byte_offset, int line, int column) 47 : byte_offset(byte_offset), line(line), column(column) {} 48 49 uint32_t byte_offset; 50 int line; 51 int column; 52 }; 53 struct WasmDisassembly { 54 using OffsetTable = std::vector<WasmDisassemblyOffsetTableEntry>; WasmDisassemblyWasmDisassembly55 WasmDisassembly() {} WasmDisassemblyWasmDisassembly56 WasmDisassembly(std::string disassembly, OffsetTable offset_table) 57 : disassembly(std::move(disassembly)), 58 offset_table(std::move(offset_table)) {} 59 60 std::string disassembly; 61 OffsetTable offset_table; 62 }; 63 64 enum PromiseDebugActionType { 65 kDebugPromiseCreated, 66 kDebugEnqueueAsyncFunction, 67 kDebugEnqueuePromiseResolve, 68 kDebugEnqueuePromiseReject, 69 kDebugPromiseCollected, 70 kDebugWillHandle, 71 kDebugDidHandle, 72 }; 73 74 } // namespace debug 75 } // namespace v8 76 77 #endif // V8_DEBUG_INTERFACE_TYPES_H_ 78