OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64) | 9 #if defined(TARGET_ARCH_ARM64) |
10 | 10 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 char* ReadLine(const char* prompt); | 88 char* ReadLine(const char* prompt); |
89 | 89 |
90 private: | 90 private: |
91 Simulator* sim_; | 91 Simulator* sim_; |
92 | 92 |
93 bool GetValue(char* desc, uint64_t* value); | 93 bool GetValue(char* desc, uint64_t* value); |
94 bool GetSValue(char* desc, uint32_t* value); | 94 bool GetSValue(char* desc, uint32_t* value); |
95 bool GetDValue(char* desc, uint64_t* value); | 95 bool GetDValue(char* desc, uint64_t* value); |
96 bool GetQValue(char* desc, simd_value_t* value); | 96 bool GetQValue(char* desc, simd_value_t* 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 return false; | 256 return false; |
257 } | 257 } |
258 *value = *(reinterpret_cast<simd_value_t*>(addr)); | 258 *value = *(reinterpret_cast<simd_value_t*>(addr)); |
259 return true; | 259 return true; |
260 } | 260 } |
261 } | 261 } |
262 return false; | 262 return false; |
263 } | 263 } |
264 | 264 |
265 | 265 |
266 intptr_t SimulatorDebugger::GetApproximateTokenIndex(const Code& code, | 266 TokenPosition SimulatorDebugger::GetApproximateTokenIndex(const Code& code, |
267 uword pc) { | 267 uword pc) { |
268 intptr_t token_pos = -1; | 268 TokenPosition token_pos = TokenPosition::kNoSource; |
269 uword pc_offset = pc - code.EntryPoint(); | 269 uword pc_offset = pc - code.EntryPoint(); |
270 const PcDescriptors& descriptors = | 270 const PcDescriptors& descriptors = |
271 PcDescriptors::Handle(code.pc_descriptors()); | 271 PcDescriptors::Handle(code.pc_descriptors()); |
272 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind); | 272 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind); |
273 while (iter.MoveNext()) { | 273 while (iter.MoveNext()) { |
274 if (iter.PcOffset() == pc_offset) { | 274 if (iter.PcOffset() == pc_offset) { |
275 return iter.TokenPos(); | 275 return iter.TokenPos(); |
276 } else if ((token_pos <= 0) && (iter.PcOffset() > pc_offset)) { | 276 } else if (!token_pos.IsReal() && (iter.PcOffset() > pc_offset)) { |
277 token_pos = iter.TokenPos(); | 277 token_pos = iter.TokenPos(); |
278 } | 278 } |
279 } | 279 } |
280 return token_pos; | 280 return token_pos; |
281 } | 281 } |
282 | 282 |
283 | 283 |
284 void SimulatorDebugger::PrintDartFrame(uword pc, uword fp, uword sp, | 284 void SimulatorDebugger::PrintDartFrame(uword pc, uword fp, uword sp, |
285 const Function& function, | 285 const Function& function, |
286 intptr_t token_pos, | 286 TokenPosition token_pos, |
287 bool is_optimized, | 287 bool is_optimized, |
288 bool is_inlined) { | 288 bool is_inlined) { |
289 const Script& script = Script::Handle(function.script()); | 289 const Script& script = Script::Handle(function.script()); |
290 const String& func_name = String::Handle(function.QualifiedUserVisibleName()); | 290 const String& func_name = String::Handle(function.QualifiedUserVisibleName()); |
291 const String& url = String::Handle(script.url()); | 291 const String& url = String::Handle(script.url()); |
292 intptr_t line = -1; | 292 intptr_t line = -1; |
293 intptr_t column = -1; | 293 intptr_t column = -1; |
294 if (token_pos >= 0) { | 294 if (token_pos.IsReal()) { |
295 script.GetTokenLocation(token_pos, &line, &column); | 295 script.GetTokenLocation(token_pos, &line, &column); |
296 } | 296 } |
297 OS::Print("pc=0x%" Px " fp=0x%" Px " sp=0x%" Px " %s%s (%s:%" Pd | 297 OS::Print("pc=0x%" Px " fp=0x%" Px " sp=0x%" Px " %s%s (%s:%" Pd |
298 ":%" Pd ")\n", | 298 ":%" Pd ")\n", |
299 pc, fp, sp, | 299 pc, fp, sp, |
300 is_optimized ? (is_inlined ? "inlined " : "optimized ") : "", | 300 is_optimized ? (is_inlined ? "inlined " : "optimized ") : "", |
301 func_name.ToCString(), | 301 func_name.ToCString(), |
302 url.ToCString(), | 302 url.ToCString(), |
303 line, column); | 303 line, column); |
304 } | 304 } |
(...skipping 3251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3556 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); | 3556 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); |
3557 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); | 3557 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); |
3558 buf->Longjmp(); | 3558 buf->Longjmp(); |
3559 } | 3559 } |
3560 | 3560 |
3561 } // namespace dart | 3561 } // namespace dart |
3562 | 3562 |
3563 #endif // !defined(USING_SIMULATOR) | 3563 #endif // !defined(USING_SIMULATOR) |
3564 | 3564 |
3565 #endif // defined TARGET_ARCH_ARM64 | 3565 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |