| 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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 // 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 |
| 419 // make them invisible to all commands. | 419 // make them invisible to all commands. |
| 420 UndoBreakpoints(); | 420 UndoBreakpoints(); |
| 421 | 421 |
| 422 while (!done) { | 422 while (!done) { |
| 423 if (last_pc != sim_->get_pc()) { | 423 if (last_pc != sim_->get_pc()) { |
| 424 last_pc = sim_->get_pc(); | 424 last_pc = sim_->get_pc(); |
| 425 if (Simulator::IsIllegalAddress(last_pc)) { | 425 if (Simulator::IsIllegalAddress(last_pc)) { |
| 426 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); |
| 427 } else { | 427 } else { |
| 428 Disassembler::Disassemble(last_pc, last_pc + Instr::kInstrSize); | 428 if (FLAG_support_disassembler) { |
| 429 Disassembler::Disassemble(last_pc, last_pc + Instr::kInstrSize); |
| 430 } else { |
| 431 OS::Print("Disassembler not supported in this mode.\n"); |
| 432 } |
| 429 } | 433 } |
| 430 } | 434 } |
| 431 char* line = ReadLine("sim> "); | 435 char* line = ReadLine("sim> "); |
| 432 if (line == NULL) { | 436 if (line == NULL) { |
| 433 FATAL("ReadLine failed"); | 437 FATAL("ReadLine failed"); |
| 434 } else { | 438 } else { |
| 435 // Use sscanf to parse the individual parts of the command line. At the | 439 // Use sscanf to parse the individual parts of the command line. At the |
| 436 // moment no command expects more than two parameters. | 440 // moment no command expects more than two parameters. |
| 437 int args = SScanF(line, | 441 int args = SScanF(line, |
| 438 "%" XSTR(COMMAND_SIZE) "s " | 442 "%" XSTR(COMMAND_SIZE) "s " |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 // If start isn't a valid address, warn and use PC instead. | 594 // If start isn't a valid address, warn and use PC instead. |
| 591 OS::Print("First argument yields invalid address: 0x%" Px64 "\n", | 595 OS::Print("First argument yields invalid address: 0x%" Px64 "\n", |
| 592 start); | 596 start); |
| 593 OS::Print("Using PC instead\n"); | 597 OS::Print("Using PC instead\n"); |
| 594 start = sim_->get_pc(); | 598 start = sim_->get_pc(); |
| 595 } | 599 } |
| 596 end = start + (length * Instr::kInstrSize); | 600 end = start + (length * Instr::kInstrSize); |
| 597 } | 601 } |
| 598 } | 602 } |
| 599 if ((start > 0) && (end > start)) { | 603 if ((start > 0) && (end > start)) { |
| 600 Disassembler::Disassemble(start, end); | 604 if (FLAG_support_disassembler) { |
| 605 Disassembler::Disassemble(start, end); |
| 606 } else { |
| 607 OS::Print("Disassembler not supported in this mode.\n"); |
| 608 } |
| 601 } else { | 609 } else { |
| 602 OS::Print("disasm [<address> [<number_of_instructions>]]\n"); | 610 OS::Print("disasm [<address> [<number_of_instructions>]]\n"); |
| 603 } | 611 } |
| 604 } else if (strcmp(cmd, "gdb") == 0) { | 612 } else if (strcmp(cmd, "gdb") == 0) { |
| 605 OS::Print("relinquishing control to gdb\n"); | 613 OS::Print("relinquishing control to gdb\n"); |
| 606 OS::DebugBreak(); | 614 OS::DebugBreak(); |
| 607 OS::Print("regaining control from gdb\n"); | 615 OS::Print("regaining control from gdb\n"); |
| 608 } else if (strcmp(cmd, "break") == 0) { | 616 } else if (strcmp(cmd, "break") == 0) { |
| 609 if (args == 2) { | 617 if (args == 2) { |
| 610 uint64_t addr; | 618 uint64_t addr; |
| (...skipping 2746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3357 } | 3365 } |
| 3358 | 3366 |
| 3359 | 3367 |
| 3360 // Executes the current instruction. | 3368 // Executes the current instruction. |
| 3361 void Simulator::InstructionDecode(Instr* instr) { | 3369 void Simulator::InstructionDecode(Instr* instr) { |
| 3362 pc_modified_ = false; | 3370 pc_modified_ = false; |
| 3363 if (IsTracingExecution()) { | 3371 if (IsTracingExecution()) { |
| 3364 OS::Print("%" Pu64 " ", icount_); | 3372 OS::Print("%" Pu64 " ", icount_); |
| 3365 const uword start = reinterpret_cast<uword>(instr); | 3373 const uword start = reinterpret_cast<uword>(instr); |
| 3366 const uword end = start + Instr::kInstrSize; | 3374 const uword end = start + Instr::kInstrSize; |
| 3367 Disassembler::Disassemble(start, end); | 3375 if (FLAG_support_disassembler) { |
| 3376 Disassembler::Disassemble(start, end); |
| 3377 } else { |
| 3378 OS::Print("Disassembler not supported in this mode.\n"); |
| 3379 } |
| 3368 } | 3380 } |
| 3369 | 3381 |
| 3370 if (instr->IsDPImmediateOp()) { | 3382 if (instr->IsDPImmediateOp()) { |
| 3371 DecodeDPImmediate(instr); | 3383 DecodeDPImmediate(instr); |
| 3372 } else if (instr->IsCompareBranchOp()) { | 3384 } else if (instr->IsCompareBranchOp()) { |
| 3373 DecodeCompareBranch(instr); | 3385 DecodeCompareBranch(instr); |
| 3374 } else if (instr->IsLoadStoreOp()) { | 3386 } else if (instr->IsLoadStoreOp()) { |
| 3375 DecodeLoadStore(instr); | 3387 DecodeLoadStore(instr); |
| 3376 } else if (instr->IsDPRegisterOp()) { | 3388 } else if (instr->IsDPRegisterOp()) { |
| 3377 DecodeDPRegister(instr); | 3389 DecodeDPRegister(instr); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3556 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); | 3568 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); |
| 3557 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); | 3569 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); |
| 3558 buf->Longjmp(); | 3570 buf->Longjmp(); |
| 3559 } | 3571 } |
| 3560 | 3572 |
| 3561 } // namespace dart | 3573 } // namespace dart |
| 3562 | 3574 |
| 3563 #endif // !defined(USING_SIMULATOR) | 3575 #endif // !defined(USING_SIMULATOR) |
| 3564 | 3576 |
| 3565 #endif // defined TARGET_ARCH_ARM64 | 3577 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |