Index: runtime/vm/debugger.h |
=================================================================== |
--- runtime/vm/debugger.h (revision 4191) |
+++ runtime/vm/debugger.h (working copy) |
@@ -24,11 +24,16 @@ |
RawFunction* function() const { return function_; } |
uword pc() const { return pc_; } |
intptr_t token_index() const { return token_index_; } |
+ bool is_temporary() const { return is_temporary_; } |
+ void set_temporary(bool value) { is_temporary_ = value; } |
RawScript* SourceCode(); |
RawString* SourceUrl(); |
intptr_t LineNumber(); |
+ void SetActive(bool value); |
+ bool IsActive(); |
+ |
private: |
void VisitObjectPointers(ObjectPointerVisitor* visitor); |
@@ -36,12 +41,25 @@ |
Breakpoint* next() const { return this->next_; } |
intptr_t pc_desc_index() const { return pc_desc_index_; } |
+ void PatchCode(); |
+ void RestoreCode(); |
+ void PatchFunctionReturn(); |
+ void RestoreFunctionReturn(); |
+ |
RawFunction* function_; |
intptr_t pc_desc_index_; |
intptr_t token_index_; |
uword pc_; |
- uword saved_bytes_; |
intptr_t line_number_; |
+ bool is_temporary_; |
+ |
+ bool is_patched_; |
+ PcDescriptors::Kind breakpoint_kind_; |
+ union { |
+ uword target_address_; |
+ uint8_t raw[2 * sizeof(uword)]; |
+ } saved_bytes_; |
+ |
Breakpoint* next_; |
friend class Debugger; |
@@ -53,10 +71,11 @@ |
// on the call stack. |
class ActivationFrame : public ZoneAllocated { |
public: |
- explicit ActivationFrame(uword pc, uword fp); |
+ explicit ActivationFrame(uword pc, uword fp, uword sp); |
uword pc() const { return pc_; } |
uword fp() const { return fp_; } |
+ uword sp() const { return sp_; } |
const Function& DartFunction(); |
RawString* QualifiedFunctionName(); |
@@ -79,9 +98,11 @@ |
private: |
void GetDescIndices(); |
RawInstance* GetLocalVarValue(intptr_t slot_index); |
+ RawInstance* GetInstanceCallReceiver(intptr_t num_actual_args); |
uword pc_; |
uword fp_; |
+ uword sp_; |
Function& function_; |
intptr_t token_index_; |
intptr_t line_number_; |
@@ -89,6 +110,7 @@ |
LocalVarDescriptors* var_descriptors_; |
ZoneGrowableArray<intptr_t> desc_indices_; |
+ friend class Debugger; |
DISALLOW_COPY_AND_ASSIGN(ActivationFrame); |
}; |
@@ -140,6 +162,10 @@ |
void RemoveBreakpoint(Breakpoint* bpt); |
+ void SetStepOver() { resume_action_ = kStepOver; } |
+ void SetStepInto() { resume_action_ = kStepInto; } |
+ void SetStepOut() { resume_action_ = kStepOut; } |
+ |
void VisitObjectPointers(ObjectPointerVisitor* visitor); |
// Returns NULL if no breakpoint exists for the given address. |
@@ -161,10 +187,19 @@ |
const String& field_name); |
private: |
+ enum ResumeAction { |
+ kContinue, |
+ kStepOver, |
+ kStepInto, |
+ kStepOut |
+ }; |
+ |
+ void InstrumentForStepping(const Function &target_function); |
Breakpoint* SetBreakpoint(const Function& target_function, |
intptr_t token_index, |
Error* error); |
void UnsetBreakpoint(Breakpoint* bpt); |
+ void RemoveTemporaryBreakpoints(); |
Breakpoint* NewBreakpoint(const Function& func, intptr_t pc_desc_index); |
void RegisterBreakpoint(Breakpoint* bpt); |
Breakpoint* GetBreakpointByFunction(const Function& func, |
@@ -174,6 +209,10 @@ |
bool initialized_; |
BreakpointHandler* bp_handler_; |
Breakpoint* breakpoints_; |
+ |
+ // Tells debugger what to do when resuming execution after a breakpoint. |
+ ResumeAction resume_action_; |
+ |
DISALLOW_COPY_AND_ASSIGN(Debugger); |
}; |