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

Side by Side Diff: runtime/vm/debugger.h

Issue 26255004: Allow the debugger to inspect local variables from optimized and (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_DEBUGGER_H_ 5 #ifndef VM_DEBUGGER_H_
6 #define VM_DEBUGGER_H_ 6 #define VM_DEBUGGER_H_
7 7
8 #include "include/dart_debugger_api.h" 8 #include "include/dart_debugger_api.h"
9 9
10 #include "vm/object.h" 10 #include "vm/object.h"
11 #include "vm/port.h" 11 #include "vm/port.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 class SourceBreakpoint; 15 class ActiveVariables;
16 class CodeBreakpoint; 16 class CodeBreakpoint;
17 class Isolate; 17 class Isolate;
18 class ObjectPointerVisitor; 18 class ObjectPointerVisitor;
19 class ActiveVariables;
20 class RemoteObjectCache; 19 class RemoteObjectCache;
20 class SourceBreakpoint;
21 class StackFrame;
21 22
22 // SourceBreakpoint represents a user-specified breakpoint location in 23 // SourceBreakpoint represents a user-specified breakpoint location in
23 // Dart source. There may be more than one CodeBreakpoint object per 24 // Dart source. There may be more than one CodeBreakpoint object per
24 // SourceBreakpoint. 25 // SourceBreakpoint.
25 class SourceBreakpoint { 26 class SourceBreakpoint {
26 public: 27 public:
27 SourceBreakpoint(intptr_t id, const Function& func, intptr_t token_pos); 28 SourceBreakpoint(intptr_t id, const Function& func, intptr_t token_pos);
28 29
29 RawFunction* function() const { return function_; } 30 RawFunction* function() const { return function_; }
30 intptr_t token_pos() const { return token_pos_; } 31 intptr_t token_pos() const { return token_pos_; }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 return code_; 137 return code_;
137 } 138 }
138 139
139 RawString* QualifiedFunctionName(); 140 RawString* QualifiedFunctionName();
140 RawString* SourceUrl(); 141 RawString* SourceUrl();
141 RawScript* SourceScript(); 142 RawScript* SourceScript();
142 RawLibrary* Library(); 143 RawLibrary* Library();
143 intptr_t TokenPos(); 144 intptr_t TokenPos();
144 intptr_t LineNumber(); 145 intptr_t LineNumber();
145 void SetContext(const Context& ctx) { ctx_ = ctx.raw(); } 146 void SetContext(const Context& ctx) { ctx_ = ctx.raw(); }
147 void SetDeoptFrame(const Array& deopt_frame, intptr_t deopt_frame_offset) {
148 deopt_frame_ = deopt_frame.raw();
149 deopt_frame_offset_ = deopt_frame_offset;
150 }
146 151
147 // Returns true if this frame is for a function that is visible 152 // Returns true if this frame is for a function that is visible
148 // to the user and can be debugged. 153 // to the user and can be debugged.
149 bool IsDebuggable() const; 154 bool IsDebuggable() const;
150 155
151 // The context level of a frame is the context level at the 156 // The context level of a frame is the context level at the
152 // PC/token index of the frame. It determines the depth of the context 157 // PC/token index of the frame. It determines the depth of the context
153 // chain that belongs to the function of this activation frame. 158 // chain that belongs to the function of this activation frame.
154 intptr_t ContextLevel(); 159 intptr_t ContextLevel();
155 160
156 const char* ToCString(); 161 const char* ToCString();
157 162
158 intptr_t NumLocalVariables(); 163 intptr_t NumLocalVariables();
159 164
160 void VariableAt(intptr_t i, 165 void VariableAt(intptr_t i,
161 String* name, 166 String* name,
162 intptr_t* token_pos, 167 intptr_t* token_pos,
163 intptr_t* end_pos, 168 intptr_t* end_pos,
164 Instance* value); 169 Instance* value);
165 170
166 RawArray* GetLocalVariables(); 171 RawArray* GetLocalVariables();
167 RawContext* GetSavedEntryContext(const Context& ctx); 172 RawContext* GetSavedEntryContext(const Context& ctx);
173 RawContext* GetSavedEntryContextNew();
168 RawContext* GetSavedCurrentContext(); 174 RawContext* GetSavedCurrentContext();
169 175
170 private: 176 private:
171 intptr_t PcDescIndex(); 177 intptr_t PcDescIndex();
172 intptr_t TryIndex(); 178 intptr_t TryIndex();
173 void GetPcDescriptors(); 179 void GetPcDescriptors();
174 void GetVarDescriptors(); 180 void GetVarDescriptors();
175 void GetDescIndices(); 181 void GetDescIndices();
176 RawInstance* GetLocalVarValue(intptr_t slot_index); 182 RawInstance* GetLocalVarValue(intptr_t slot_index);
177 RawInstance* GetInstanceCallReceiver(intptr_t num_actual_args); 183 RawInstance* GetInstanceCallReceiver(intptr_t num_actual_args);
178 RawObject* GetClosureObject(intptr_t num_acatual_args); 184 RawObject* GetClosureObject(intptr_t num_acatual_args);
179 185
180 uword pc_; 186 uword pc_;
181 uword fp_; 187 uword fp_;
182 uword sp_; 188 uword sp_;
183 189
184 // The anchor of the context chain for this function. 190 // The anchor of the context chain for this function.
185 Context& ctx_; 191 Context& ctx_;
186 const Code& code_; 192 const Code& code_;
187 const Function& function_; 193 const Function& function_;
188 intptr_t token_pos_; 194 intptr_t token_pos_;
189 intptr_t pc_desc_index_; 195 intptr_t pc_desc_index_;
190 intptr_t line_number_; 196 intptr_t line_number_;
191 intptr_t context_level_; 197 intptr_t context_level_;
192 198
199 // Some frames are deoptimized into a side array in order to inspect them.
200 Array& deopt_frame_;
201 intptr_t deopt_frame_offset_;
202
193 bool vars_initialized_; 203 bool vars_initialized_;
194 LocalVarDescriptors& var_descriptors_; 204 LocalVarDescriptors& var_descriptors_;
195 ZoneGrowableArray<intptr_t> desc_indices_; 205 ZoneGrowableArray<intptr_t> desc_indices_;
196 PcDescriptors& pc_desc_; 206 PcDescriptors& pc_desc_;
197 207
198 friend class Debugger; 208 friend class Debugger;
199 friend class DebuggerStackTrace; 209 friend class DebuggerStackTrace;
200 DISALLOW_COPY_AND_ASSIGN(ActivationFrame); 210 DISALLOW_COPY_AND_ASSIGN(ActivationFrame);
201 }; 211 };
202 212
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 void MakeCodeBreakpointsAt(const Function& func, 365 void MakeCodeBreakpointsAt(const Function& func,
356 intptr_t token_pos, 366 intptr_t token_pos,
357 SourceBreakpoint* bpt); 367 SourceBreakpoint* bpt);
358 // Returns NULL if no breakpoint exists for the given address. 368 // Returns NULL if no breakpoint exists for the given address.
359 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); 369 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address);
360 370
361 void SyncBreakpoint(SourceBreakpoint* bpt); 371 void SyncBreakpoint(SourceBreakpoint* bpt);
362 372
363 ActivationFrame* TopDartFrame() const; 373 ActivationFrame* TopDartFrame() const;
364 static DebuggerStackTrace* CollectStackTrace(); 374 static DebuggerStackTrace* CollectStackTrace();
375 static ActivationFrame* CollectDartFrame(Isolate* isolate,
376 uword pc,
377 StackFrame* frame,
378 const Code& code,
379 bool optimized,
380 ActivationFrame* callee_activation,
381 const Context& entry_ctx);
382 static RawArray* DeoptimizeToArray(Isolate* isolate,
383 StackFrame* frame,
384 const Code& code);
385 static DebuggerStackTrace* CollectStackTraceNew();
365 void SignalBpResolved(SourceBreakpoint *bpt); 386 void SignalBpResolved(SourceBreakpoint *bpt);
366 void SignalPausedEvent(ActivationFrame* top_frame); 387 void SignalPausedEvent(ActivationFrame* top_frame);
367 388
368 intptr_t nextId() { return next_id_++; } 389 intptr_t nextId() { return next_id_++; }
369 390
370 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace, 391 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace,
371 const Instance& exc); 392 const Instance& exc);
372 393
373 void CollectLibraryFields(const GrowableObjectArray& field_list, 394 void CollectLibraryFields(const GrowableObjectArray& field_list,
374 const Library& lib, 395 const Library& lib,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 429
409 friend class Isolate; 430 friend class Isolate;
410 friend class SourceBreakpoint; 431 friend class SourceBreakpoint;
411 DISALLOW_COPY_AND_ASSIGN(Debugger); 432 DISALLOW_COPY_AND_ASSIGN(Debugger);
412 }; 433 };
413 434
414 435
415 } // namespace dart 436 } // namespace dart
416 437
417 #endif // VM_DEBUGGER_H_ 438 #endif // VM_DEBUGGER_H_
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/debugger.cc » ('j') | runtime/vm/debugger.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698