Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(972)

Side by Side Diff: src/debug/debug.h

Issue 2096863003: [wasm] prototype for breakpoint support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@extend-script-functionality
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/debug/debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_DEBUG_H_ 5 #ifndef V8_DEBUG_DEBUG_H_
6 #define V8_DEBUG_DEBUG_H_ 6 #define V8_DEBUG_DEBUG_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/assembler.h" 10 #include "src/assembler.h"
11 #include "src/base/atomicops.h" 11 #include "src/base/atomicops.h"
12 #include "src/base/hashmap.h" 12 #include "src/base/hashmap.h"
13 #include "src/base/platform/platform.h" 13 #include "src/base/platform/platform.h"
14 #include "src/debug/liveedit.h" 14 #include "src/debug/liveedit.h"
15 #include "src/execution.h" 15 #include "src/execution.h"
16 #include "src/factory.h" 16 #include "src/factory.h"
17 #include "src/flags.h" 17 #include "src/flags.h"
18 #include "src/frames.h" 18 #include "src/frames.h"
19 #include "src/interpreter/source-position-table.h" 19 #include "src/interpreter/source-position-table.h"
20 #include "src/runtime/runtime.h" 20 #include "src/runtime/runtime.h"
21 #include "src/string-stream.h" 21 #include "src/string-stream.h"
22 #include "src/v8threads.h" 22 #include "src/v8threads.h"
23 #include "src/wasm/wasm-debug.h"
23 24
24 #include "include/v8-debug.h" 25 #include "include/v8-debug.h"
25 26
26 namespace v8 { 27 namespace v8 {
27 namespace internal { 28 namespace internal {
28 29
29 30
30 // Forward declarations. 31 // Forward declarations.
31 class DebugScope; 32 class DebugScope;
32 33
(...skipping 28 matching lines...) Expand all
61 BREAK_POSITION_ALIGNED = 1 62 BREAK_POSITION_ALIGNED = 1
62 }; 63 };
63 64
64 65
65 class BreakLocation { 66 class BreakLocation {
66 public: 67 public:
67 // Find the break point at the supplied address, or the closest one before 68 // Find the break point at the supplied address, or the closest one before
68 // the address. 69 // the address.
69 static BreakLocation FromCodeOffset(Handle<DebugInfo> debug_info, int offset); 70 static BreakLocation FromCodeOffset(Handle<DebugInfo> debug_info, int offset);
70 71
71 static BreakLocation FromFrame(Handle<DebugInfo> debug_info, 72 static BreakLocation FromFrame(StandardFrame* frame);
72 JavaScriptFrame* frame);
73 73
74 static void AllForStatementPosition(Handle<DebugInfo> debug_info, 74 static void AllForStatementPosition(Handle<DebugInfo> debug_info,
75 int statement_position, 75 int statement_position,
76 List<BreakLocation>* result_out); 76 List<BreakLocation>* result_out);
77 77
78 static BreakLocation FromPosition(Handle<DebugInfo> debug_info, int position, 78 static BreakLocation FromPosition(Handle<DebugInfo> debug_info, int position,
79 BreakPositionAlignment alignment); 79 BreakPositionAlignment alignment);
80 80
81 bool IsDebugBreak() const; 81 bool IsDebugBreak() const;
82 82
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 private: 197 private:
198 DebugBreakType GetDebugBreakType(); 198 DebugBreakType GetDebugBreakType();
199 199
200 interpreter::SourcePositionTableIterator source_position_iterator_; 200 interpreter::SourcePositionTableIterator source_position_iterator_;
201 BreakLocatorType break_locator_type_; 201 BreakLocatorType break_locator_type_;
202 int start_position_; 202 int start_position_;
203 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayIterator); 203 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayIterator);
204 }; 204 };
205 205
206 class WasmBytecodeIterator : public Iterator {
207 public:
208 WasmBytecodeIterator(Handle<DebugInfo> debug_info, BreakLocatorType type);
209 ~WasmBytecodeIterator() override {}
210
211 BreakLocation GetBreakLocation() override;
212 bool Done() const override { return wasm_insn_iterator.Done(); }
213 void Next() override;
214 int code_offset() override { return position_; }
215
216 private:
217 wasm::WasmInstructionIterator wasm_insn_iterator;
218 BreakLocatorType break_locator_type_;
219 Handle<wasm::WasmDebugInfo> wasm_debug_info;
220 int func_index;
221 DISALLOW_COPY_AND_ASSIGN(WasmBytecodeIterator);
222 };
223
206 static Iterator* GetIterator(Handle<DebugInfo> debug_info, 224 static Iterator* GetIterator(Handle<DebugInfo> debug_info,
207 BreakLocatorType type = ALL_BREAK_LOCATIONS); 225 BreakLocatorType type = ALL_BREAK_LOCATIONS);
208 226
209 private: 227 private:
210 friend class Debug; 228 friend class Debug;
211 229
212 static int BreakIndexFromCodeOffset(Handle<DebugInfo> debug_info, int offset); 230 static int BreakIndexFromCodeOffset(Handle<DebugInfo> debug_info, int offset);
213 231
214 void SetDebugBreak(); 232 void SetDebugBreak();
215 void ClearDebugBreak(); 233 void ClearDebugBreak();
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 void EnqueueCommandMessage(Vector<const uint16_t> command, 446 void EnqueueCommandMessage(Vector<const uint16_t> command,
429 v8::Debug::ClientData* client_data = NULL); 447 v8::Debug::ClientData* client_data = NULL);
430 MUST_USE_RESULT MaybeHandle<Object> Call(Handle<Object> fun, 448 MUST_USE_RESULT MaybeHandle<Object> Call(Handle<Object> fun,
431 Handle<Object> data); 449 Handle<Object> data);
432 Handle<Context> GetDebugContext(); 450 Handle<Context> GetDebugContext();
433 void HandleDebugBreak(); 451 void HandleDebugBreak();
434 void ProcessDebugMessages(bool debug_command_only); 452 void ProcessDebugMessages(bool debug_command_only);
435 453
436 // Internal logic 454 // Internal logic
437 bool Load(); 455 bool Load();
438 void Break(JavaScriptFrame* frame); 456 void Break(StandardFrame* frame);
439 void SetAfterBreakTarget(JavaScriptFrame* frame); 457 void SetAfterBreakTarget(StandardFrame* frame);
440 458
441 // Scripts handling. 459 // Scripts handling.
442 Handle<FixedArray> GetLoadedScripts(); 460 Handle<FixedArray> GetLoadedScripts();
443 461
444 // Break point handling. 462 // Break point handling.
445 bool SetBreakPoint(Handle<JSFunction> function, 463 bool SetBreakPoint(Handle<JSFunction> function,
446 Handle<Object> break_point_object, 464 Handle<Object> break_point_object,
447 int* source_position); 465 int* source_position);
448 bool SetBreakPointForScript(Handle<Script> script, 466 bool SetBreakPointForScript(Handle<Script> script,
449 Handle<Object> break_point_object, 467 Handle<Object> break_point_object,
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 Handle<Code> code); 830 Handle<Code> code);
813 static bool DebugBreakSlotIsPatched(Address pc); 831 static bool DebugBreakSlotIsPatched(Address pc);
814 static void ClearDebugBreakSlot(Isolate* isolate, Address pc); 832 static void ClearDebugBreakSlot(Isolate* isolate, Address pc);
815 }; 833 };
816 834
817 835
818 } // namespace internal 836 } // namespace internal
819 } // namespace v8 837 } // namespace v8
820 838
821 #endif // V8_DEBUG_DEBUG_H_ 839 #endif // V8_DEBUG_DEBUG_H_
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/debug/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698