| Index: runtime/vm/debugger.h
|
| diff --git a/runtime/vm/debugger.h b/runtime/vm/debugger.h
|
| index 5fb456538d24cc96cd4138277a1a1d9d097ab3fe..c95deb426db4c2f621f839bd1e02c25c05f28928 100644
|
| --- a/runtime/vm/debugger.h
|
| +++ b/runtime/vm/debugger.h
|
| @@ -18,74 +18,12 @@ class JSONArray;
|
| class JSONStream;
|
| class ObjectPointerVisitor;
|
| class RemoteObjectCache;
|
| -class BreakpointLocation;
|
| +class SourceBreakpoint;
|
| class StackFrame;
|
|
|
| -// A user-defined breakpoint, which either fires once, for a particular closure,
|
| -// or always. The API's notion of a breakpoint corresponds to this object.
|
| -class Breakpoint {
|
| - public:
|
| - Breakpoint(intptr_t id, BreakpointLocation* bpt_location)
|
| - : id_(id),
|
| - kind_(Breakpoint::kNone),
|
| - next_(NULL),
|
| - closure_(Instance::null()),
|
| - bpt_location_(bpt_location) {}
|
| -
|
| - intptr_t id() const { return id_; }
|
| - Breakpoint* next() const { return next_; }
|
| - void set_next(Breakpoint* n) { next_ = n; }
|
| -
|
| - BreakpointLocation* bpt_location() const { return bpt_location_; }
|
| - void set_bpt_location(BreakpointLocation* new_bpt_location);
|
| -
|
| - bool IsRepeated() const { return kind_ == kRepeated; }
|
| - bool IsSingleShot() const { return kind_ == kSingleShot; }
|
| - bool IsPerClosure() const { return kind_ == kPerClosure; }
|
| - RawInstance* closure() const { return closure_; }
|
| -
|
| - void SetIsRepeated() {
|
| - ASSERT(kind_ == kNone);
|
| - kind_ = kRepeated;
|
| - }
|
| -
|
| - void SetIsSingleShot() {
|
| - ASSERT(kind_ == kNone);
|
| - kind_ = kSingleShot;
|
| - }
|
| -
|
| - void SetIsPerClosure(const Instance& closure) {
|
| - ASSERT(kind_ == kNone);
|
| - kind_ = kPerClosure;
|
| - closure_ = closure.raw();
|
| - }
|
| -
|
| - void PrintJSON(JSONStream* stream);
|
| -
|
| - private:
|
| - void VisitObjectPointers(ObjectPointerVisitor* visitor);
|
| -
|
| - enum ConditionKind {
|
| - kNone,
|
| - kRepeated,
|
| - kSingleShot,
|
| - kPerClosure,
|
| - };
|
| -
|
| - intptr_t id_;
|
| - ConditionKind kind_;
|
| - Breakpoint* next_;
|
| - RawInstance* closure_;
|
| - BreakpointLocation* bpt_location_;
|
| -
|
| - friend class BreakpointLocation;
|
| - DISALLOW_COPY_AND_ASSIGN(Breakpoint);
|
| -};
|
| -
|
| -
|
| -// BreakpointLocation represents a collection of breakpoint conditions at the
|
| -// same token position in Dart source. There may be more than one CodeBreakpoint
|
| -// object per BreakpointLocation.
|
| +// SourceBreakpoint represents a user-specified breakpoint location in
|
| +// Dart source. There may be more than one CodeBreakpoint object per
|
| +// SourceBreakpoint.
|
| // An unresolved breakpoint is one where the underlying code has not
|
| // been compiled yet. Since the code has not been compiled, we don't know
|
| // the definitive source location yet. The requested source location may
|
| @@ -94,21 +32,22 @@ class Breakpoint {
|
| // that is not loaded in the VM when the breakpoint is requested.
|
| // When a script with matching url is loaded, a latent breakpoint
|
| // becomes an unresolved breakpoint.
|
| -class BreakpointLocation {
|
| +class SourceBreakpoint {
|
| public:
|
| // Create a new unresolved breakpoint.
|
| - BreakpointLocation(const Script& script,
|
| - intptr_t token_pos,
|
| - intptr_t end_token_pos);
|
| + SourceBreakpoint(intptr_t id,
|
| + const Script& script,
|
| + intptr_t token_pos,
|
| + intptr_t end_token_pos);
|
| // Create a new latent breakpoint.
|
| - BreakpointLocation(const String& url,
|
| - intptr_t line_number);
|
| -
|
| - ~BreakpointLocation();
|
| + SourceBreakpoint(intptr_t id,
|
| + const String& url,
|
| + intptr_t line_number);
|
|
|
| RawFunction* function() const { return function_; }
|
| intptr_t token_pos() const { return token_pos_; }
|
| intptr_t end_token_pos() const { return end_token_pos_; }
|
| + intptr_t id() const { return id_; }
|
|
|
| RawScript* script() const { return script_; }
|
| RawString* url() const { return url_; }
|
| @@ -116,46 +55,45 @@ class BreakpointLocation {
|
|
|
| void GetCodeLocation(Library* lib, Script* script, intptr_t* token_pos);
|
|
|
| - Breakpoint* AddRepeated(Debugger* dbg);
|
| - Breakpoint* AddSingleShot(Debugger* dbg);
|
| - Breakpoint* AddPerClosure(Debugger* dbg, const Instance& closure);
|
| -
|
| - bool AnyEnabled() const;
|
| + void Enable();
|
| + void Disable();
|
| + bool IsEnabled() const { return is_enabled_; }
|
| bool IsResolved() const { return is_resolved_; }
|
| bool IsLatent() const { return token_pos_ < 0; }
|
|
|
| + bool IsOneShot() const { return is_one_shot_; }
|
| + void SetIsOneShot() { is_one_shot_ = true; }
|
| +
|
| + void PrintJSON(JSONStream* stream);
|
| +
|
| private:
|
| void VisitObjectPointers(ObjectPointerVisitor* visitor);
|
|
|
| void SetResolved(const Function& func, intptr_t token_pos);
|
| + void set_next(SourceBreakpoint* value) { next_ = value; }
|
| + SourceBreakpoint* next() const { return this->next_; }
|
|
|
| - BreakpointLocation* next() const { return this->next_; }
|
| - void set_next(BreakpointLocation* value) { next_ = value; }
|
| -
|
| - void AddBreakpoint(Breakpoint* bpt, Debugger* dbg);
|
| -
|
| - Breakpoint* breakpoints() const { return this->conditions_; }
|
| - void set_breakpoints(Breakpoint* head) { this->conditions_ = head; }
|
| -
|
| + const intptr_t id_;
|
| RawScript* script_;
|
| RawString* url_;
|
| intptr_t token_pos_;
|
| intptr_t end_token_pos_;
|
| bool is_resolved_;
|
| - BreakpointLocation* next_;
|
| - Breakpoint* conditions_;
|
| + bool is_enabled_;
|
| + bool is_one_shot_;
|
| + SourceBreakpoint* next_;
|
|
|
| // Valid for resolved breakpoints:
|
| RawFunction* function_;
|
| intptr_t line_number_;
|
|
|
| friend class Debugger;
|
| - DISALLOW_COPY_AND_ASSIGN(BreakpointLocation);
|
| + DISALLOW_COPY_AND_ASSIGN(SourceBreakpoint);
|
| };
|
|
|
|
|
| // CodeBreakpoint represents a location in compiled code. There may be
|
| -// more than one CodeBreakpoint for one BreakpointLocation, e.g. when a
|
| +// more than one CodeBreakpoint for one SourceBreakpoint, e.g. when a
|
| // function gets compiled as a regular function and as a closure.
|
| class CodeBreakpoint {
|
| public:
|
| @@ -168,7 +106,7 @@ class CodeBreakpoint {
|
| RawFunction* function() const;
|
| uword pc() const { return pc_; }
|
| intptr_t token_pos() const { return token_pos_; }
|
| - bool IsInternal() const { return bpt_location_ == NULL; }
|
| + bool IsInternal() const { return src_bpt_ == NULL; }
|
|
|
| RawScript* SourceCode();
|
| RawString* SourceUrl();
|
| @@ -183,8 +121,8 @@ class CodeBreakpoint {
|
| private:
|
| void VisitObjectPointers(ObjectPointerVisitor* visitor);
|
|
|
| - BreakpointLocation* bpt_location() const { return bpt_location_; }
|
| - void set_bpt_location(BreakpointLocation* value) { bpt_location_ = value; }
|
| + SourceBreakpoint* src_bpt() const { return src_bpt_; }
|
| + void set_src_bpt(SourceBreakpoint* value) { src_bpt_ = value; }
|
|
|
| void set_next(CodeBreakpoint* value) { next_ = value; }
|
| CodeBreakpoint* next() const { return this->next_; }
|
| @@ -198,7 +136,7 @@ class CodeBreakpoint {
|
| intptr_t line_number_;
|
| bool is_enabled_;
|
|
|
| - BreakpointLocation* bpt_location_;
|
| + SourceBreakpoint* src_bpt_;
|
| CodeBreakpoint* next_;
|
|
|
| RawPcDescriptors::Kind breakpoint_kind_;
|
| @@ -256,8 +194,6 @@ class ActivationFrame : public ZoneAllocated {
|
| Object* value);
|
|
|
| RawArray* GetLocalVariables();
|
| - RawObject* GetParameter(intptr_t index);
|
| - RawObject* GetClosure();
|
| RawObject* GetReceiver();
|
|
|
| const Context& GetSavedCurrentContext();
|
| @@ -337,6 +273,11 @@ class DebuggerStackTrace : public ZoneAllocated {
|
| };
|
|
|
|
|
| +typedef void BreakpointHandler(Dart_Port isolate_id,
|
| + SourceBreakpoint* bpt,
|
| + DebuggerStackTrace* stack);
|
| +
|
| +
|
| class DebuggerEvent {
|
| public:
|
| enum EventType {
|
| @@ -374,11 +315,11 @@ class DebuggerEvent {
|
| top_frame_ = frame;
|
| }
|
|
|
| - Breakpoint* breakpoint() const {
|
| + SourceBreakpoint* breakpoint() const {
|
| ASSERT(type_ == kBreakpointReached || type_ == kBreakpointResolved);
|
| return breakpoint_;
|
| }
|
| - void set_breakpoint(Breakpoint* bpt) {
|
| + void set_breakpoint(SourceBreakpoint* bpt) {
|
| ASSERT(type_ == kBreakpointReached || type_ == kBreakpointResolved);
|
| breakpoint_ = bpt;
|
| }
|
| @@ -400,7 +341,7 @@ class DebuggerEvent {
|
| Isolate* isolate_;
|
| EventType type_;
|
| ActivationFrame* top_frame_;
|
| - Breakpoint* breakpoint_;
|
| + SourceBreakpoint* breakpoint_;
|
| const Object* exception_;
|
| };
|
|
|
| @@ -424,21 +365,15 @@ class Debugger {
|
| const String& function_name);
|
|
|
| // Set breakpoint at closest location to function entry.
|
| - Breakpoint* SetBreakpointAtEntry(const Function& target_function,
|
| - bool single_shot);
|
| - Breakpoint* SetBreakpointAtActivation(const Instance& closure);
|
| + SourceBreakpoint* SetBreakpointAtEntry(const Function& target_function);
|
|
|
| // TODO(turnidge): script_url may no longer be specific enough.
|
| - Breakpoint* SetBreakpointAtLine(const String& script_url,
|
| - intptr_t line_number);
|
| + SourceBreakpoint* SetBreakpointAtLine(const String& script_url,
|
| + intptr_t line_number);
|
| RawError* OneTimeBreakAtEntry(const Function& target_function);
|
|
|
| - BreakpointLocation* BreakpointLocationAtLine(const String& script_url,
|
| - intptr_t line_number);
|
| -
|
| -
|
| void RemoveBreakpoint(intptr_t bp_id);
|
| - Breakpoint* GetBreakpointById(intptr_t id);
|
| + SourceBreakpoint* GetBreakpointById(intptr_t id);
|
|
|
| void SetStepOver();
|
| void SetSingleStep();
|
| @@ -541,22 +476,22 @@ class Debugger {
|
| intptr_t requested_token_pos,
|
| intptr_t last_token_pos);
|
| void DeoptimizeWorld();
|
| - BreakpointLocation* SetBreakpoint(const Script& script,
|
| - intptr_t token_pos,
|
| - intptr_t last_token_pos);
|
| + SourceBreakpoint* SetBreakpoint(const Script& script,
|
| + intptr_t token_pos,
|
| + intptr_t last_token_pos);
|
| void RemoveInternalBreakpoints();
|
| - void UnlinkCodeBreakpoints(BreakpointLocation* bpt_location);
|
| - BreakpointLocation* GetLatentBreakpoint(const String& url, intptr_t line);
|
| - void RegisterBreakpointLocation(BreakpointLocation* bpt);
|
| + void UnlinkCodeBreakpoints(SourceBreakpoint* src_bpt);
|
| + SourceBreakpoint* GetLatentBreakpoint(const String& url, intptr_t line);
|
| + void RegisterSourceBreakpoint(SourceBreakpoint* bpt);
|
| void RegisterCodeBreakpoint(CodeBreakpoint* bpt);
|
| - BreakpointLocation* GetBreakpointLocation(const Script& script,
|
| - intptr_t token_pos);
|
| + SourceBreakpoint* GetSourceBreakpoint(const Script& script,
|
| + intptr_t token_pos);
|
| void MakeCodeBreakpointAt(const Function& func,
|
| - BreakpointLocation* bpt);
|
| + SourceBreakpoint* bpt);
|
| // Returns NULL if no breakpoint exists for the given address.
|
| CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address);
|
|
|
| - void SyncBreakpointLocation(BreakpointLocation* loc);
|
| + void SyncBreakpoint(SourceBreakpoint* bpt);
|
|
|
| ActivationFrame* TopDartFrame() const;
|
| static ActivationFrame* CollectDartFrame(Isolate* isolate,
|
| @@ -569,9 +504,9 @@ class Debugger {
|
| StackFrame* frame,
|
| const Code& code);
|
| static DebuggerStackTrace* CollectStackTrace();
|
| - void SignalBpResolved(Breakpoint *bpt);
|
| + void SignalBpResolved(SourceBreakpoint *bpt);
|
| void SignalPausedEvent(ActivationFrame* top_frame,
|
| - Breakpoint* bpt);
|
| + SourceBreakpoint* bpt);
|
|
|
| intptr_t nextId() { return next_id_++; }
|
|
|
| @@ -596,8 +531,8 @@ class Debugger {
|
| // ID number generator.
|
| intptr_t next_id_;
|
|
|
| - BreakpointLocation* latent_locations_;
|
| - BreakpointLocation* breakpoint_locations_;
|
| + SourceBreakpoint* latent_breakpoints_;
|
| + SourceBreakpoint* src_breakpoints_;
|
| CodeBreakpoint* code_breakpoints_;
|
|
|
| // Tells debugger what to do when resuming execution after a breakpoint.
|
| @@ -630,7 +565,7 @@ class Debugger {
|
| static EventHandler* event_handler_;
|
|
|
| friend class Isolate;
|
| - friend class BreakpointLocation;
|
| + friend class SourceBreakpoint;
|
| DISALLOW_COPY_AND_ASSIGN(Debugger);
|
| };
|
|
|
|
|