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

Side by Side Diff: runtime/vm/simulator_arm.cc

Issue 1644793002: Replace intptr_t with TokenDescriptor (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « runtime/vm/service.cc ('k') | runtime/vm/simulator_arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 #include <setjmp.h> // NOLINT 5 #include <setjmp.h> // NOLINT
6 #include <stdlib.h> 6 #include <stdlib.h>
7 7
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #if defined(TARGET_ARCH_ARM) 9 #if defined(TARGET_ARCH_ARM)
10 10
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 void Debug(); 88 void Debug();
89 char* ReadLine(const char* prompt); 89 char* ReadLine(const char* prompt);
90 90
91 private: 91 private:
92 Simulator* sim_; 92 Simulator* sim_;
93 93
94 bool GetValue(char* desc, uint32_t* value); 94 bool GetValue(char* desc, uint32_t* value);
95 bool GetFValue(char* desc, float* value); 95 bool GetFValue(char* desc, float* value);
96 bool GetDValue(char* desc, double* value); 96 bool GetDValue(char* desc, double* value);
97 97
98 static intptr_t GetApproximateTokenIndex(const Code& code, uword pc); 98 static TokenPosition GetApproximateTokenIndex(const Code& code, uword pc);
99 99
100 static void PrintDartFrame(uword pc, uword fp, uword sp, 100 static void PrintDartFrame(uword pc, uword fp, uword sp,
101 const Function& function, 101 const Function& function,
102 intptr_t token_pos, 102 TokenPosition token_pos,
103 bool is_optimized, 103 bool is_optimized,
104 bool is_inlined); 104 bool is_inlined);
105 void PrintBacktrace(); 105 void PrintBacktrace();
106 106
107 // Set or delete a breakpoint. Returns true if successful. 107 // Set or delete a breakpoint. Returns true if successful.
108 bool SetBreakpoint(Instr* breakpc); 108 bool SetBreakpoint(Instr* breakpc);
109 bool DeleteBreakpoint(Instr* breakpc); 109 bool DeleteBreakpoint(Instr* breakpc);
110 110
111 // Undo and redo all breakpoints. This is needed to bracket disassembly and 111 // Undo and redo all breakpoints. This is needed to bracket disassembly and
112 // execution to skip past breakpoints when run from the debugger. 112 // execution to skip past breakpoints when run from the debugger.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 return false; 238 return false;
239 } 239 }
240 *value = *(reinterpret_cast<double*>(addr)); 240 *value = *(reinterpret_cast<double*>(addr));
241 return true; 241 return true;
242 } 242 }
243 } 243 }
244 return false; 244 return false;
245 } 245 }
246 246
247 247
248 intptr_t SimulatorDebugger::GetApproximateTokenIndex(const Code& code, 248 TokenPosition SimulatorDebugger::GetApproximateTokenIndex(const Code& code,
249 uword pc) { 249 uword pc) {
250 intptr_t token_pos = -1; 250 TokenPosition token_pos = TokenPosition::kNoSource;
251 uword pc_offset = pc - code.EntryPoint(); 251 uword pc_offset = pc - code.EntryPoint();
252 const PcDescriptors& descriptors = 252 const PcDescriptors& descriptors =
253 PcDescriptors::Handle(code.pc_descriptors()); 253 PcDescriptors::Handle(code.pc_descriptors());
254 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind); 254 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind);
255 while (iter.MoveNext()) { 255 while (iter.MoveNext()) {
256 if (iter.PcOffset() == pc_offset) { 256 if (iter.PcOffset() == pc_offset) {
257 return iter.TokenPos(); 257 return iter.TokenPos();
258 } else if ((token_pos <= 0) && (iter.PcOffset() > pc_offset)) { 258 } else if (!token_pos.IsReal() && (iter.PcOffset() > pc_offset)) {
259 token_pos = iter.TokenPos(); 259 token_pos = iter.TokenPos();
260 } 260 }
261 } 261 }
262 return token_pos; 262 return token_pos;
263 } 263 }
264 264
265 265
266 void SimulatorDebugger::PrintDartFrame(uword pc, uword fp, uword sp, 266 void SimulatorDebugger::PrintDartFrame(uword pc, uword fp, uword sp,
267 const Function& function, 267 const Function& function,
268 intptr_t token_pos, 268 TokenPosition token_pos,
269 bool is_optimized, 269 bool is_optimized,
270 bool is_inlined) { 270 bool is_inlined) {
271 const Script& script = Script::Handle(function.script()); 271 const Script& script = Script::Handle(function.script());
272 const String& func_name = String::Handle(function.QualifiedUserVisibleName()); 272 const String& func_name = String::Handle(function.QualifiedUserVisibleName());
273 const String& url = String::Handle(script.url()); 273 const String& url = String::Handle(script.url());
274 intptr_t line = -1; 274 intptr_t line = -1;
275 intptr_t column = -1; 275 intptr_t column = -1;
276 if (token_pos >= 0) { 276 if (token_pos.IsReal()) {
277 script.GetTokenLocation(token_pos, &line, &column); 277 script.GetTokenLocation(token_pos, &line, &column);
278 } 278 }
279 OS::Print("pc=0x%" Px " fp=0x%" Px " sp=0x%" Px " %s%s (%s:%" Pd 279 OS::Print("pc=0x%" Px " fp=0x%" Px " sp=0x%" Px " %s%s (%s:%" Pd
280 ":%" Pd ")\n", 280 ":%" Pd ")\n",
281 pc, fp, sp, 281 pc, fp, sp,
282 is_optimized ? (is_inlined ? "inlined " : "optimized ") : "", 282 is_optimized ? (is_inlined ? "inlined " : "optimized ") : "",
283 func_name.ToCString(), 283 func_name.ToCString(),
284 url.ToCString(), 284 url.ToCString(),
285 line, column); 285 line, column);
286 } 286 }
(...skipping 3609 matching lines...) Expand 10 before | Expand all | Expand 10 after
3896 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); 3896 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception));
3897 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); 3897 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace));
3898 buf->Longjmp(); 3898 buf->Longjmp();
3899 } 3899 }
3900 3900
3901 } // namespace dart 3901 } // namespace dart
3902 3902
3903 #endif // defined(USING_SIMULATOR) 3903 #endif // defined(USING_SIMULATOR)
3904 3904
3905 #endif // defined TARGET_ARCH_ARM 3905 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/service.cc ('k') | runtime/vm/simulator_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698