| OLD | NEW |
| 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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 // Undo all set breakpoints while running in the debugger shell. This will | 400 // Undo all set breakpoints while running in the debugger shell. This will |
| 401 // make them invisible to all commands. | 401 // make them invisible to all commands. |
| 402 UndoBreakpoints(); | 402 UndoBreakpoints(); |
| 403 | 403 |
| 404 while (!done) { | 404 while (!done) { |
| 405 if (last_pc != sim_->get_pc()) { | 405 if (last_pc != sim_->get_pc()) { |
| 406 last_pc = sim_->get_pc(); | 406 last_pc = sim_->get_pc(); |
| 407 if (Simulator::IsIllegalAddress(last_pc)) { | 407 if (Simulator::IsIllegalAddress(last_pc)) { |
| 408 OS::Print("pc is out of bounds: 0x%" Px "\n", last_pc); | 408 OS::Print("pc is out of bounds: 0x%" Px "\n", last_pc); |
| 409 } else { | 409 } else { |
| 410 Disassembler::Disassemble(last_pc, last_pc + Instr::kInstrSize); | 410 if (FLAG_support_disassembler) { |
| 411 Disassembler::Disassemble(last_pc, last_pc + Instr::kInstrSize); |
| 412 } else { |
| 413 OS::Print("Disassembler not supported in this mode.\n"); |
| 414 } |
| 411 } | 415 } |
| 412 } | 416 } |
| 413 char* line = ReadLine("sim> "); | 417 char* line = ReadLine("sim> "); |
| 414 if (line == NULL) { | 418 if (line == NULL) { |
| 415 FATAL("ReadLine failed"); | 419 FATAL("ReadLine failed"); |
| 416 } else { | 420 } else { |
| 417 // Use sscanf to parse the individual parts of the command line. At the | 421 // Use sscanf to parse the individual parts of the command line. At the |
| 418 // moment no command expects more than two parameters. | 422 // moment no command expects more than two parameters. |
| 419 int args = SScanF(line, | 423 int args = SScanF(line, |
| 420 "%" XSTR(COMMAND_SIZE) "s " | 424 "%" XSTR(COMMAND_SIZE) "s " |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 if (Simulator::IsIllegalAddress(start)) { | 543 if (Simulator::IsIllegalAddress(start)) { |
| 540 // If start isn't a valid address, warn and use PC instead. | 544 // If start isn't a valid address, warn and use PC instead. |
| 541 OS::Print("First argument yields invalid address: 0x%x\n", start); | 545 OS::Print("First argument yields invalid address: 0x%x\n", start); |
| 542 OS::Print("Using PC instead\n"); | 546 OS::Print("Using PC instead\n"); |
| 543 start = sim_->get_pc(); | 547 start = sim_->get_pc(); |
| 544 } | 548 } |
| 545 end = start + (length * Instr::kInstrSize); | 549 end = start + (length * Instr::kInstrSize); |
| 546 } | 550 } |
| 547 } | 551 } |
| 548 if ((start > 0) && (end > start)) { | 552 if ((start > 0) && (end > start)) { |
| 549 Disassembler::Disassemble(start, end); | 553 if (FLAG_support_disassembler) { |
| 554 Disassembler::Disassemble(start, end); |
| 555 } else { |
| 556 OS::Print("Disassembler not supported in this mode.\n"); |
| 557 } |
| 550 } else { | 558 } else { |
| 551 OS::Print("disasm [<address> [<number_of_instructions>]]\n"); | 559 OS::Print("disasm [<address> [<number_of_instructions>]]\n"); |
| 552 } | 560 } |
| 553 } else if (strcmp(cmd, "gdb") == 0) { | 561 } else if (strcmp(cmd, "gdb") == 0) { |
| 554 OS::Print("relinquishing control to gdb\n"); | 562 OS::Print("relinquishing control to gdb\n"); |
| 555 OS::DebugBreak(); | 563 OS::DebugBreak(); |
| 556 OS::Print("regaining control from gdb\n"); | 564 OS::Print("regaining control from gdb\n"); |
| 557 } else if (strcmp(cmd, "break") == 0) { | 565 } else if (strcmp(cmd, "break") == 0) { |
| 558 if (args == 2) { | 566 if (args == 2) { |
| 559 uint32_t addr; | 567 uint32_t addr; |
| (...skipping 3036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3596 } | 3604 } |
| 3597 | 3605 |
| 3598 | 3606 |
| 3599 // Executes the current instruction. | 3607 // Executes the current instruction. |
| 3600 void Simulator::InstructionDecode(Instr* instr) { | 3608 void Simulator::InstructionDecode(Instr* instr) { |
| 3601 pc_modified_ = false; | 3609 pc_modified_ = false; |
| 3602 if (IsTracingExecution()) { | 3610 if (IsTracingExecution()) { |
| 3603 OS::Print("%" Pu64 " ", icount_); | 3611 OS::Print("%" Pu64 " ", icount_); |
| 3604 const uword start = reinterpret_cast<uword>(instr); | 3612 const uword start = reinterpret_cast<uword>(instr); |
| 3605 const uword end = start + Instr::kInstrSize; | 3613 const uword end = start + Instr::kInstrSize; |
| 3606 Disassembler::Disassemble(start, end); | 3614 if (FLAG_support_disassembler) { |
| 3615 Disassembler::Disassemble(start, end); |
| 3616 } else { |
| 3617 OS::Print("Disassembler not supported in this mode.\n"); |
| 3618 } |
| 3607 } | 3619 } |
| 3608 if (instr->ConditionField() == kSpecialCondition) { | 3620 if (instr->ConditionField() == kSpecialCondition) { |
| 3609 if (instr->InstructionBits() == static_cast<int32_t>(0xf57ff01f)) { | 3621 if (instr->InstructionBits() == static_cast<int32_t>(0xf57ff01f)) { |
| 3610 // Format(instr, "clrex"); | 3622 // Format(instr, "clrex"); |
| 3611 ClearExclusive(); | 3623 ClearExclusive(); |
| 3612 } else { | 3624 } else { |
| 3613 if (instr->IsSIMDDataProcessing()) { | 3625 if (instr->IsSIMDDataProcessing()) { |
| 3614 DecodeSIMDDataProcessing(instr); | 3626 DecodeSIMDDataProcessing(instr); |
| 3615 } else { | 3627 } else { |
| 3616 UnimplementedInstruction(instr); | 3628 UnimplementedInstruction(instr); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3896 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); | 3908 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); |
| 3897 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); | 3909 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); |
| 3898 buf->Longjmp(); | 3910 buf->Longjmp(); |
| 3899 } | 3911 } |
| 3900 | 3912 |
| 3901 } // namespace dart | 3913 } // namespace dart |
| 3902 | 3914 |
| 3903 #endif // defined(USING_SIMULATOR) | 3915 #endif // defined(USING_SIMULATOR) |
| 3904 | 3916 |
| 3905 #endif // defined TARGET_ARCH_ARM | 3917 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |