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

Side by Side Diff: src/debug.h

Issue 1222093007: Debugger: use debug break slot to break on call. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix mips Created 5 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
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_H_ 5 #ifndef V8_DEBUG_H_
6 #define V8_DEBUG_H_ 6 #define V8_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"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 45
46 // Type of exception break. NOTE: These values are in macros.py as well. 46 // Type of exception break. NOTE: These values are in macros.py as well.
47 enum ExceptionBreakType { 47 enum ExceptionBreakType {
48 BreakException = 0, 48 BreakException = 0,
49 BreakUncaughtException = 1 49 BreakUncaughtException = 1
50 }; 50 };
51 51
52 52
53 // Type of exception break. 53 // Type of exception break.
54 enum BreakLocatorType { 54 enum BreakLocatorType { ALL_BREAK_LOCATIONS, CALLS_AND_RETURNS };
55 ALL_BREAK_LOCATIONS = 0,
56 SOURCE_BREAK_LOCATIONS = 1,
57 CALLS_AND_RETURNS = 2
58 };
59 55
60 56
61 // The different types of breakpoint position alignments. 57 // The different types of breakpoint position alignments.
62 // Must match Debug.BreakPositionAlignment in debug-debugger.js 58 // Must match Debug.BreakPositionAlignment in debug-debugger.js
63 enum BreakPositionAlignment { 59 enum BreakPositionAlignment {
64 STATEMENT_ALIGNED = 0, 60 STATEMENT_ALIGNED = 0,
65 BREAK_POSITION_ALIGNED = 1 61 BREAK_POSITION_ALIGNED = 1
66 }; 62 };
67 63
68 64
69 class BreakLocation { 65 class BreakLocation {
70 public: 66 public:
71 // Find the break point at the supplied address, or the closest one before 67 // Find the break point at the supplied address, or the closest one before
72 // the address. 68 // the address.
73 static BreakLocation FromAddress(Handle<DebugInfo> debug_info, 69 static BreakLocation FromAddress(Handle<DebugInfo> debug_info,
74 BreakLocatorType type, Address pc); 70 BreakLocatorType type, Address pc);
75 71
76 static void FromAddressSameStatement(Handle<DebugInfo> debug_info, 72 static void FromAddressSameStatement(Handle<DebugInfo> debug_info,
77 BreakLocatorType type, Address pc, 73 BreakLocatorType type, Address pc,
78 List<BreakLocation>* result_out); 74 List<BreakLocation>* result_out);
79 75
80 static BreakLocation FromPosition(Handle<DebugInfo> debug_info, 76 static BreakLocation FromPosition(Handle<DebugInfo> debug_info,
81 BreakLocatorType type, int position, 77 BreakLocatorType type, int position,
82 BreakPositionAlignment alignment); 78 BreakPositionAlignment alignment);
83 79
84 bool IsDebugBreak() const; 80 bool IsDebugBreak() const;
85 inline bool IsExit() const { return RelocInfo::IsJSReturn(rmode_); } 81 inline bool IsExit() const { return RelocInfo::IsJSReturn(rmode_); }
82 inline bool IsCall() const {
83 return IsDebugBreakSlot() && RelocInfo::DebugBreakIsCall(data_);
84 }
86 inline bool IsConstructCall() const { 85 inline bool IsConstructCall() const {
87 return RelocInfo::IsConstructCall(rmode_); 86 return IsDebugBreakSlot() && RelocInfo::DebugBreakIsConstructCall(data_);
88 } 87 }
89 inline bool IsCodeTarget() const { return RelocInfo::IsCodeTarget(rmode_); } 88 inline int CallArgc() const {
ulan 2015/07/08 11:53:33 Please use CallArgCount() or CallArgumentsCount()
Yang 2015/07/09 09:38:48 Done.
90 89 DCHECK(IsCall());
91 Handle<Code> CodeTarget() const; 90 return RelocInfo::DebugBreakCallArgumentsCount(data_);
92 Handle<Code> OriginalCodeTarget() const; 91 }
93 92
94 bool IsStepInLocation() const; 93 bool IsStepInLocation() const;
95 inline bool HasBreakPoint() const { 94 inline bool HasBreakPoint() const {
96 return debug_info_->HasBreakPoint(pc_offset_); 95 return debug_info_->HasBreakPoint(pc_offset_);
97 } 96 }
98 97
99 Handle<Object> BreakPointObjects() const; 98 Handle<Object> BreakPointObjects() const;
100 99
101 void SetBreakPoint(Handle<Object> break_point_object); 100 void SetBreakPoint(Handle<Object> break_point_object);
102 void ClearBreakPoint(Handle<Object> break_point_object); 101 void ClearBreakPoint(Handle<Object> break_point_object);
103 102
104 void SetOneShot(); 103 void SetOneShot();
105 void ClearOneShot(); 104 void ClearOneShot();
106 105
106
107 inline RelocInfo rinfo() const { 107 inline RelocInfo rinfo() const {
108 return RelocInfo(pc(), rmode(), data_, code()); 108 return RelocInfo(pc(), rmode(), data_, code());
109 } 109 }
110 110
111 inline RelocInfo original_rinfo() const {
112 return RelocInfo(original_pc(), original_rmode(), original_data_,
113 original_code());
114 }
115
116 inline int position() const { return position_; } 111 inline int position() const { return position_; }
117 inline int statement_position() const { return statement_position_; } 112 inline int statement_position() const { return statement_position_; }
118 113
119 inline Address pc() const { return code()->entry() + pc_offset_; } 114 inline Address pc() const { return code()->entry() + pc_offset_; }
120 inline Address original_pc() const { 115 inline Address original_pc() const {
121 return original_code()->entry() + original_pc_offset_; 116 return debug_info_->original_code()->entry() + original_pc_offset_;
122 } 117 }
123 118
124 inline RelocInfo::Mode rmode() const { return rmode_; } 119 inline RelocInfo::Mode rmode() const { return rmode_; }
125 inline RelocInfo::Mode original_rmode() const { return original_rmode_; }
126 120
127 inline Code* code() const { return debug_info_->code(); } 121 inline Code* code() const { return debug_info_->code(); }
128 inline Code* original_code() const { return debug_info_->original_code(); }
129 122
130 private: 123 private:
131 BreakLocation(Handle<DebugInfo> debug_info, RelocInfo* rinfo, 124 BreakLocation(Handle<DebugInfo> debug_info, RelocInfo* rinfo,
132 RelocInfo* original_rinfo, int position, 125 RelocInfo* original_rinfo, int position,
133 int statement_position); 126 int statement_position);
134 127
128 static const int kNonCallArgc = -2;
ulan 2015/07/08 11:53:33 Please use the same constants here and in assemble
Yang 2015/07/09 09:38:48 Removed. They are not actually necessary anymore.
129 static const int kConstructCallArgc = -1;
130
135 class Iterator { 131 class Iterator {
136 public: 132 public:
137 Iterator(Handle<DebugInfo> debug_info, BreakLocatorType type); 133 Iterator(Handle<DebugInfo> debug_info, BreakLocatorType type);
138 134
139 BreakLocation GetBreakLocation() { 135 BreakLocation GetBreakLocation() {
140 return BreakLocation(debug_info_, rinfo(), original_rinfo(), position(), 136 return BreakLocation(debug_info_, rinfo(), original_rinfo(), position(),
141 statement_position()); 137 statement_position());
142 } 138 }
143 139
144 inline bool Done() const { return RinfoDone(); } 140 inline bool Done() const { return RinfoDone(); }
145 void Next(); 141 void Next();
146 142
147 void SkipTo(int count) { 143 void SkipTo(int count) {
148 while (count-- > 0) Next(); 144 while (count-- > 0) Next();
149 } 145 }
150 146
151 inline RelocInfo::Mode rmode() { return reloc_iterator_.rinfo()->rmode(); } 147 inline RelocInfo::Mode rmode() { return reloc_iterator_.rinfo()->rmode(); }
152 inline RelocInfo::Mode original_rmode() {
153 return reloc_iterator_.rinfo()->rmode();
154 }
155
156 inline RelocInfo* rinfo() { return reloc_iterator_.rinfo(); } 148 inline RelocInfo* rinfo() { return reloc_iterator_.rinfo(); }
157 inline RelocInfo* original_rinfo() { 149 inline RelocInfo* original_rinfo() {
158 return reloc_iterator_original_.rinfo(); 150 return reloc_iterator_original_.rinfo();
159 } 151 }
160 152
161 inline Address pc() { return rinfo()->pc(); } 153 inline Address pc() { return rinfo()->pc(); }
162 inline Address original_pc() { return original_rinfo()->pc(); }
163
164 int break_index() const { return break_index_; } 154 int break_index() const { return break_index_; }
165
166 inline int position() const { return position_; } 155 inline int position() const { return position_; }
167 inline int statement_position() const { return statement_position_; } 156 inline int statement_position() const { return statement_position_; }
168 157
169 private: 158 private:
170 bool RinfoDone() const; 159 bool RinfoDone() const;
171 void RinfoNext(); 160 void RinfoNext();
172 161
173 Handle<DebugInfo> debug_info_; 162 Handle<DebugInfo> debug_info_;
174 BreakLocatorType type_; 163 BreakLocatorType type_;
175 RelocIterator reloc_iterator_; 164 RelocIterator reloc_iterator_;
(...skipping 11 matching lines...) Expand all
187 176
188 static int BreakIndexFromAddress(Handle<DebugInfo> debug_info, 177 static int BreakIndexFromAddress(Handle<DebugInfo> debug_info,
189 BreakLocatorType type, Address pc); 178 BreakLocatorType type, Address pc);
190 179
191 void ClearDebugBreak(); 180 void ClearDebugBreak();
192 void RestoreFromOriginal(int length_in_bytes); 181 void RestoreFromOriginal(int length_in_bytes);
193 182
194 void SetDebugBreak(); 183 void SetDebugBreak();
195 void SetDebugBreakAtReturn(); 184 void SetDebugBreakAtReturn();
196 void SetDebugBreakAtSlot(); 185 void SetDebugBreakAtSlot();
197 void SetDebugBreakAtIC();
198 186
199 inline bool IsDebuggerStatement() const { 187 inline bool IsDebuggerStatement() const {
200 return RelocInfo::IsDebuggerStatement(rmode_); 188 return RelocInfo::IsDebuggerStatement(rmode_);
201 } 189 }
202 inline bool IsDebugBreakSlot() const { 190 inline bool IsDebugBreakSlot() const {
203 return RelocInfo::IsDebugBreakSlot(rmode_); 191 return RelocInfo::IsDebugBreakSlot(rmode_);
204 } 192 }
205 193
206 Handle<DebugInfo> debug_info_; 194 Handle<DebugInfo> debug_info_;
207 int pc_offset_; 195 int pc_offset_;
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 Debug* debug_; 789 Debug* debug_;
802 bool old_state_; 790 bool old_state_;
803 DISALLOW_COPY_AND_ASSIGN(SuppressDebug); 791 DISALLOW_COPY_AND_ASSIGN(SuppressDebug);
804 }; 792 };
805 793
806 794
807 // Code generator routines. 795 // Code generator routines.
808 class DebugCodegen : public AllStatic { 796 class DebugCodegen : public AllStatic {
809 public: 797 public:
810 static void GenerateSlot(MacroAssembler* masm); 798 static void GenerateSlot(MacroAssembler* masm);
811 static void GenerateCallICStubDebugBreak(MacroAssembler* masm);
812 static void GenerateLoadICDebugBreak(MacroAssembler* masm);
813 static void GenerateStoreICDebugBreak(MacroAssembler* masm);
814 static void GenerateKeyedLoadICDebugBreak(MacroAssembler* masm);
815 static void GenerateKeyedStoreICDebugBreak(MacroAssembler* masm);
816 static void GenerateCompareNilICDebugBreak(MacroAssembler* masm);
817 static void GenerateReturnDebugBreak(MacroAssembler* masm); 799 static void GenerateReturnDebugBreak(MacroAssembler* masm);
818 static void GenerateCallFunctionStubDebugBreak(MacroAssembler* masm);
819 static void GenerateCallConstructStubDebugBreak(MacroAssembler* masm);
820 static void GenerateCallConstructStubRecordDebugBreak(MacroAssembler* masm);
821 static void GenerateSlotDebugBreak(MacroAssembler* masm); 800 static void GenerateSlotDebugBreak(MacroAssembler* masm);
822 static void GeneratePlainReturnLiveEdit(MacroAssembler* masm); 801 static void GeneratePlainReturnLiveEdit(MacroAssembler* masm);
823 802
824 // FrameDropper is a code replacement for a JavaScript frame with possibly 803 // FrameDropper is a code replacement for a JavaScript frame with possibly
825 // several frames above. 804 // several frames above.
826 // There is no calling conventions here, because it never actually gets 805 // There is no calling conventions here, because it never actually gets
827 // called, it only gets returned to. 806 // called, it only gets returned to.
828 static void GenerateFrameDropperLiveEdit(MacroAssembler* masm); 807 static void GenerateFrameDropperLiveEdit(MacroAssembler* masm);
829 }; 808 };
830 809
831 810
832 } } // namespace v8::internal 811 } } // namespace v8::internal
833 812
834 #endif // V8_DEBUG_H_ 813 #endif // V8_DEBUG_H_
OLDNEW
« src/assembler.cc ('K') | « src/code-stubs.h ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698