Index: dart/runtime/vm/debugger.h |
=================================================================== |
--- dart/runtime/vm/debugger.h (revision 31530) |
+++ dart/runtime/vm/debugger.h (working copy) |
@@ -27,42 +27,43 @@ |
// SourceBreakpoint. |
class SourceBreakpoint { |
public: |
- SourceBreakpoint(intptr_t id, const Function& func, intptr_t token_pos); |
+ SourceBreakpoint(intptr_t id, const Script& script, intptr_t token_pos); |
RawFunction* function() const { return function_; } |
intptr_t token_pos() const { return token_pos_; } |
- void set_token_pos(intptr_t value) { token_pos_ = value; } |
intptr_t id() const { return id_; } |
- RawScript* SourceCode(); |
+ RawScript* script() { return script_; } |
RawString* SourceUrl(); |
intptr_t LineNumber(); |
- void GetCodeLocation(Library* lib, |
- Script* script, |
- intptr_t* token_pos) const; |
+ void GetCodeLocation(Library* lib, Script* script, intptr_t* token_pos); |
void Enable(); |
void Disable(); |
bool IsEnabled() const { return is_enabled_; } |
+ bool IsResolved() { return is_resolved_; } |
- void PrintToJSONStream(JSONStream* stream) const; |
+ void PrintToJSONStream(JSONStream* stream); |
private: |
void VisitObjectPointers(ObjectPointerVisitor* visitor); |
- void set_function(const Function& func); |
+ void SetResolved(const Function& func, intptr_t token_pos); |
void set_next(SourceBreakpoint* value) { next_ = value; } |
SourceBreakpoint* next() const { return this->next_; } |
const intptr_t id_; |
- RawFunction* function_; |
+ RawScript* script_; |
intptr_t token_pos_; |
- intptr_t line_number_; |
+ bool is_resolved_; |
bool is_enabled_; |
- |
SourceBreakpoint* next_; |
+ // Valid for resolved breakpoints: |
+ RawFunction* function_; |
+ intptr_t line_number_; |
+ |
friend class Debugger; |
DISALLOW_COPY_AND_ASSIGN(SourceBreakpoint); |
}; |
@@ -101,8 +102,6 @@ |
void PatchCode(); |
void RestoreCode(); |
- void PatchFunctionReturn(); |
- void RestoreFunctionReturn(); |
RawFunction* function_; |
intptr_t pc_desc_index_; |
@@ -304,6 +303,14 @@ |
void SetStepOut(); |
bool IsStepping() const { return resume_action_ != kContinue; } |
+ bool IsPaused() const { return pause_event_ != NULL; } |
+ |
+ // Indicates why the debugger is currently paused. If the debugger |
+ // is not paused, this returns NULL. Note that the debugger can be |
+ // paused for breakpoints, isolate interruption, and (sometimes) |
+ // exceptions. |
+ const DebuggerEvent* PauseEvent() const { return pause_event_; } |
+ |
void SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info); |
Dart_ExceptionPauseInfo GetExceptionPauseInfo(); |
@@ -370,11 +377,18 @@ |
kSingleStep |
}; |
+ void FindEquivalentFunctions(const Script& script, |
+ intptr_t start_pos, |
+ intptr_t end_pos, |
+ GrowableObjectArray* function_list); |
+ RawFunction* FindBestFit(const Script& script, intptr_t token_pos); |
+ RawFunction* FindInnermostClosure(const Function& function, |
+ intptr_t token_pos); |
intptr_t ResolveBreakpointPos(const Function& func, |
- intptr_t first_token_pos, |
- intptr_t last_token_pos); |
+ intptr_t requested_token_pos); |
void DeoptimizeWorld(); |
void InstrumentForStepping(const Function& target_function); |
+ SourceBreakpoint* SetBreakpoint(const Script& script, intptr_t token_pos); |
SourceBreakpoint* SetBreakpoint(const Function& target_function, |
intptr_t first_token_pos, |
intptr_t last_token_pos); |
@@ -382,10 +396,9 @@ |
void UnlinkCodeBreakpoints(SourceBreakpoint* src_bpt); |
void RegisterSourceBreakpoint(SourceBreakpoint* bpt); |
void RegisterCodeBreakpoint(CodeBreakpoint* bpt); |
- SourceBreakpoint* GetSourceBreakpoint(const Function& func, |
+ SourceBreakpoint* GetSourceBreakpoint(const Script& script, |
intptr_t token_pos); |
void MakeCodeBreakpointsAt(const Function& func, |
- intptr_t token_pos, |
SourceBreakpoint* bpt); |
// Returns NULL if no breakpoint exists for the given address. |
CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); |
@@ -419,6 +432,10 @@ |
const String& prefix, |
bool include_private_fields); |
+ // Handles any events which pause vm execution. Breakpoints, |
+ // interrupts, etc. |
+ void Pause(DebuggerEvent* event); |
+ |
Isolate* isolate_; |
Dart_Port isolate_id_; // A unique ID for the isolate in the debugger. |
bool initialized_; |
@@ -426,11 +443,7 @@ |
// ID number generator. |
intptr_t next_id_; |
- // Current stack trace. Valid while executing breakpoint callback code. |
- DebuggerStackTrace* stack_trace_; |
- RemoteObjectCache* obj_cache_; |
- |
SourceBreakpoint* src_breakpoints_; |
CodeBreakpoint* code_breakpoints_; |
@@ -442,10 +455,18 @@ |
// be run as a side effect of getting values of fields. |
bool ignore_breakpoints_; |
- // True while debugger calls event_handler_. Used to prevent recursive |
- // debugger events. |
- bool in_event_notification_; |
+ // Indicates why the debugger is currently paused. If the debugger |
+ // is not paused, this is NULL. Note that the debugger can be |
+ // paused for breakpoints, isolate interruption, and (sometimes) |
+ // exceptions. |
+ DebuggerEvent* pause_event_; |
+ // An id -> object map. Valid only while IsPaused(). |
+ RemoteObjectCache* obj_cache_; |
+ |
+ // Current stack trace. Valid only while IsPaused(). |
+ DebuggerStackTrace* stack_trace_; |
+ |
Dart_ExceptionPauseInfo exc_pause_info_; |
static EventHandler* event_handler_; |