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

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

Issue 23072026: fix cpp11 compile errors (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/scanner.cc ('k') | runtime/vm/simulator_mips.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 <math.h> // for isnan. 5 #include <math.h> // for isnan.
6 #include <setjmp.h> 6 #include <setjmp.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #if defined(TARGET_ARCH_ARM) 10 #if defined(TARGET_ARCH_ARM)
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 >= 0) {
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":%"Pd")\n", 297 OS::Print("pc=0x%" Px " fp=0x%" Px " sp=0x%" Px " %s%s (%s:%" Pd
298 ":%" Pd ")\n",
298 pc, fp, sp, 299 pc, fp, sp,
299 is_optimized ? (is_inlined ? "inlined " : "optimized ") : "", 300 is_optimized ? (is_inlined ? "inlined " : "optimized ") : "",
300 func_name.ToCString(), 301 func_name.ToCString(),
301 url.ToCString(), 302 url.ToCString(),
302 line, column); 303 line, column);
303 } 304 }
304 305
305 306
306 void SimulatorDebugger::PrintBacktrace() { 307 void SimulatorDebugger::PrintBacktrace() {
307 StackFrameIterator frames(sim_->get_register(FP), 308 StackFrameIterator frames(sim_->get_register(FP),
(...skipping 29 matching lines...) Expand all
337 true, true); 338 true, true);
338 } 339 }
339 } 340 }
340 // Print the optimized inlining frame below. 341 // Print the optimized inlining frame below.
341 } 342 }
342 PrintDartFrame(frame->pc(), frame->fp(), frame->sp(), 343 PrintDartFrame(frame->pc(), frame->fp(), frame->sp(),
343 function, 344 function,
344 GetApproximateTokenIndex(code, frame->pc()), 345 GetApproximateTokenIndex(code, frame->pc()),
345 code.is_optimized(), false); 346 code.is_optimized(), false);
346 } else { 347 } else {
347 OS::Print("pc=0x%"Px" fp=0x%"Px" sp=0x%"Px" %s frame\n", 348 OS::Print("pc=0x%" Px " fp=0x%" Px " sp=0x%" Px " %s frame\n",
348 frame->pc(), frame->fp(), frame->sp(), 349 frame->pc(), frame->fp(), frame->sp(),
349 frame->IsEntryFrame() ? "entry" : 350 frame->IsEntryFrame() ? "entry" :
350 frame->IsExitFrame() ? "exit" : 351 frame->IsExitFrame() ? "exit" :
351 frame->IsStubFrame() ? "stub" : "invalid"); 352 frame->IsStubFrame() ? "stub" : "invalid");
352 } 353 }
353 frame = frames.NextFrame(); 354 frame = frames.NextFrame();
354 } 355 }
355 } 356 }
356 357
357 358
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 arg2[ARG_SIZE] = 0; 416 arg2[ARG_SIZE] = 0;
416 417
417 // Undo all set breakpoints while running in the debugger shell. This will 418 // Undo all set breakpoints while running in the debugger shell. This will
418 // make them invisible to all commands. 419 // make them invisible to all commands.
419 UndoBreakpoints(); 420 UndoBreakpoints();
420 421
421 while (!done) { 422 while (!done) {
422 if (last_pc != sim_->get_pc()) { 423 if (last_pc != sim_->get_pc()) {
423 last_pc = sim_->get_pc(); 424 last_pc = sim_->get_pc();
424 if (Simulator::IsIllegalAddress(last_pc)) { 425 if (Simulator::IsIllegalAddress(last_pc)) {
425 OS::Print("pc is out of bounds: 0x%"Px"\n", last_pc); 426 OS::Print("pc is out of bounds: 0x%" Px "\n", last_pc);
426 } else { 427 } else {
427 Disassembler::Disassemble(last_pc, last_pc + Instr::kInstrSize); 428 Disassembler::Disassemble(last_pc, last_pc + Instr::kInstrSize);
428 } 429 }
429 } 430 }
430 char* line = ReadLine("sim> "); 431 char* line = ReadLine("sim> ");
431 if (line == NULL) { 432 if (line == NULL) {
432 FATAL("ReadLine failed"); 433 FATAL("ReadLine failed");
433 } else { 434 } else {
434 // Use sscanf to parse the individual parts of the command line. At the 435 // Use sscanf to parse the individual parts of the command line. At the
435 // moment no command expects more than two parameters. 436 // moment no command expects more than two parameters.
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 return dregisters_[reg]; 970 return dregisters_[reg];
970 } 971 }
971 972
972 973
973 void Simulator::HandleIllegalAccess(uword addr, Instr* instr) { 974 void Simulator::HandleIllegalAccess(uword addr, Instr* instr) {
974 uword fault_pc = get_pc(); 975 uword fault_pc = get_pc();
975 // The debugger will not be able to single step past this instruction, but 976 // The debugger will not be able to single step past this instruction, but
976 // it will be possible to disassemble the code and inspect registers. 977 // it will be possible to disassemble the code and inspect registers.
977 char buffer[128]; 978 char buffer[128];
978 snprintf(buffer, sizeof(buffer), 979 snprintf(buffer, sizeof(buffer),
979 "illegal memory access at 0x%"Px", pc=0x%"Px"\n", 980 "illegal memory access at 0x%" Px ", pc=0x%" Px "\n",
980 addr, fault_pc); 981 addr, fault_pc);
981 SimulatorDebugger dbg(this); 982 SimulatorDebugger dbg(this);
982 dbg.Stop(instr, buffer); 983 dbg.Stop(instr, buffer);
983 // The debugger will return control in non-interactive mode. 984 // The debugger will return control in non-interactive mode.
984 FATAL("Cannot continue execution after illegal memory access."); 985 FATAL("Cannot continue execution after illegal memory access.");
985 } 986 }
986 987
987 988
988 // Processor versions prior to ARMv7 could not do unaligned reads and writes. 989 // Processor versions prior to ARMv7 could not do unaligned reads and writes.
989 // On some ARM platforms an interrupt is caused. On others it does a funky 990 // On some ARM platforms an interrupt is caused. On others it does a funky
990 // rotation thing. However, from version v7, unaligned access is supported. 991 // rotation thing. However, from version v7, unaligned access is supported.
991 // Note that simulator runs have the runtime system running directly on the host 992 // Note that simulator runs have the runtime system running directly on the host
992 // system and only generated code is executed in the simulator. Since the host 993 // system and only generated code is executed in the simulator. Since the host
993 // is typically IA32 we will get the correct ARMv7-like behaviour on unaligned 994 // is typically IA32 we will get the correct ARMv7-like behaviour on unaligned
994 // accesses, but we should actually not generate code accessing unaligned data, 995 // accesses, but we should actually not generate code accessing unaligned data,
995 // so we still want to know and abort if we encounter such code. 996 // so we still want to know and abort if we encounter such code.
996 void Simulator::UnalignedAccess(const char* msg, uword addr, Instr* instr) { 997 void Simulator::UnalignedAccess(const char* msg, uword addr, Instr* instr) {
997 // The debugger will not be able to single step past this instruction, but 998 // The debugger will not be able to single step past this instruction, but
998 // it will be possible to disassemble the code and inspect registers. 999 // it will be possible to disassemble the code and inspect registers.
999 char buffer[64]; 1000 char buffer[64];
1000 snprintf(buffer, sizeof(buffer), 1001 snprintf(buffer, sizeof(buffer),
1001 "unaligned %s at 0x%"Px", pc=%p\n", msg, addr, instr); 1002 "unaligned %s at 0x%" Px ", pc=%p\n", msg, addr, instr);
1002 SimulatorDebugger dbg(this); 1003 SimulatorDebugger dbg(this);
1003 dbg.Stop(instr, buffer); 1004 dbg.Stop(instr, buffer);
1004 // The debugger will return control in non-interactive mode. 1005 // The debugger will return control in non-interactive mode.
1005 FATAL("Cannot continue execution after unaligned access."); 1006 FATAL("Cannot continue execution after unaligned access.");
1006 } 1007 }
1007 1008
1008 1009
1009 void Simulator::UnimplementedInstruction(Instr* instr) { 1010 void Simulator::UnimplementedInstruction(Instr* instr) {
1010 char buffer[64]; 1011 char buffer[64];
1011 snprintf(buffer, sizeof(buffer), "Unimplemented instruction: pc=%p\n", instr); 1012 snprintf(buffer, sizeof(buffer), "Unimplemented instruction: pc=%p\n", instr);
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 int svc = instr->SvcField(); 1500 int svc = instr->SvcField();
1500 switch (svc) { 1501 switch (svc) {
1501 case kRedirectionSvcCode: { 1502 case kRedirectionSvcCode: {
1502 SimulatorSetjmpBuffer buffer(this); 1503 SimulatorSetjmpBuffer buffer(this);
1503 1504
1504 if (!setjmp(buffer.buffer_)) { 1505 if (!setjmp(buffer.buffer_)) {
1505 int32_t saved_lr = get_register(LR); 1506 int32_t saved_lr = get_register(LR);
1506 Redirection* redirection = Redirection::FromSvcInstruction(instr); 1507 Redirection* redirection = Redirection::FromSvcInstruction(instr);
1507 uword external = redirection->external_function(); 1508 uword external = redirection->external_function();
1508 if (FLAG_trace_sim) { 1509 if (FLAG_trace_sim) {
1509 OS::Print("Call to host function at 0x%"Pd"\n", external); 1510 OS::Print("Call to host function at 0x%" Pd "\n", external);
1510 } 1511 }
1511 1512
1512 if ((redirection->call_kind() == kRuntimeCall) || 1513 if ((redirection->call_kind() == kRuntimeCall) ||
1513 (redirection->call_kind() == kBootstrapNativeCall) || 1514 (redirection->call_kind() == kBootstrapNativeCall) ||
1514 (redirection->call_kind() == kNativeCall)) { 1515 (redirection->call_kind() == kNativeCall)) {
1515 // Set the top_exit_frame_info of this simulator to the native stack. 1516 // Set the top_exit_frame_info of this simulator to the native stack.
1516 set_top_exit_frame_info(reinterpret_cast<uword>(&buffer)); 1517 set_top_exit_frame_info(reinterpret_cast<uword>(&buffer));
1517 } 1518 }
1518 if (redirection->call_kind() == kRuntimeCall) { 1519 if (redirection->call_kind() == kRuntimeCall) {
1519 NativeArguments arguments; 1520 NativeArguments arguments;
(...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after
3667 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); 3668 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception));
3668 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); 3669 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace));
3669 buf->Longjmp(); 3670 buf->Longjmp();
3670 } 3671 }
3671 3672
3672 } // namespace dart 3673 } // namespace dart
3673 3674
3674 #endif // !defined(HOST_ARCH_ARM) 3675 #endif // !defined(HOST_ARCH_ARM)
3675 3676
3676 #endif // defined TARGET_ARCH_ARM 3677 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/scanner.cc ('k') | runtime/vm/simulator_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698