| 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_MIPS) | 9 #if defined(TARGET_ARCH_MIPS) |
| 10 | 10 |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 // Undo all set breakpoints while running in the debugger shell. This will | 411 // Undo all set breakpoints while running in the debugger shell. This will |
| 412 // make them invisible to all commands. | 412 // make them invisible to all commands. |
| 413 UndoBreakpoints(); | 413 UndoBreakpoints(); |
| 414 | 414 |
| 415 while (!done) { | 415 while (!done) { |
| 416 if (last_pc != sim_->get_pc()) { | 416 if (last_pc != sim_->get_pc()) { |
| 417 last_pc = sim_->get_pc(); | 417 last_pc = sim_->get_pc(); |
| 418 if (Simulator::IsIllegalAddress(last_pc)) { | 418 if (Simulator::IsIllegalAddress(last_pc)) { |
| 419 OS::Print("pc is out of bounds: 0x%" Px "\n", last_pc); | 419 OS::Print("pc is out of bounds: 0x%" Px "\n", last_pc); |
| 420 } else { | 420 } else { |
| 421 Disassembler::Disassemble(last_pc, last_pc + Instr::kInstrSize); | 421 if (FLAG_support_disassembler) { |
| 422 Disassembler::Disassemble(last_pc, last_pc + Instr::kInstrSize); |
| 423 } else { |
| 424 OS::Print("Disassembler not supported in this mode.\n"); |
| 425 } |
| 422 } | 426 } |
| 423 } | 427 } |
| 424 char* line = ReadLine("sim> "); | 428 char* line = ReadLine("sim> "); |
| 425 if (line == NULL) { | 429 if (line == NULL) { |
| 426 FATAL("ReadLine failed"); | 430 FATAL("ReadLine failed"); |
| 427 } else { | 431 } else { |
| 428 // Use sscanf to parse the individual parts of the command line. At the | 432 // Use sscanf to parse the individual parts of the command line. At the |
| 429 // moment no command expects more than two parameters. | 433 // moment no command expects more than two parameters. |
| 430 int args = SScanF(line, | 434 int args = SScanF(line, |
| 431 "%" XSTR(COMMAND_SIZE) "s " | 435 "%" XSTR(COMMAND_SIZE) "s " |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 if (Simulator::IsIllegalAddress(start)) { | 553 if (Simulator::IsIllegalAddress(start)) { |
| 550 // If start isn't a valid address, warn and use PC instead. | 554 // If start isn't a valid address, warn and use PC instead. |
| 551 OS::Print("First argument yields invalid address: 0x%x\n", start); | 555 OS::Print("First argument yields invalid address: 0x%x\n", start); |
| 552 OS::Print("Using PC instead\n"); | 556 OS::Print("Using PC instead\n"); |
| 553 start = sim_->get_pc(); | 557 start = sim_->get_pc(); |
| 554 } | 558 } |
| 555 end = start + (length * Instr::kInstrSize); | 559 end = start + (length * Instr::kInstrSize); |
| 556 } | 560 } |
| 557 } | 561 } |
| 558 if ((start > 0) && (end > start)) { | 562 if ((start > 0) && (end > start)) { |
| 559 Disassembler::Disassemble(start, end); | 563 if (FLAG_support_disassembler) { |
| 564 Disassembler::Disassemble(start, end); |
| 565 } else { |
| 566 OS::Print("Disassembler not supported in this mode.\n"); |
| 567 } |
| 560 } else { | 568 } else { |
| 561 OS::Print("disasm [<address> [<number_of_instructions>]]\n"); | 569 OS::Print("disasm [<address> [<number_of_instructions>]]\n"); |
| 562 } | 570 } |
| 563 } else if (strcmp(cmd, "gdb") == 0) { | 571 } else if (strcmp(cmd, "gdb") == 0) { |
| 564 OS::Print("relinquishing control to gdb\n"); | 572 OS::Print("relinquishing control to gdb\n"); |
| 565 OS::DebugBreak(); | 573 OS::DebugBreak(); |
| 566 OS::Print("regaining control from gdb\n"); | 574 OS::Print("regaining control from gdb\n"); |
| 567 } else if (strcmp(cmd, "break") == 0) { | 575 } else if (strcmp(cmd, "break") == 0) { |
| 568 if (args == 2) { | 576 if (args == 2) { |
| 569 uint32_t addr; | 577 uint32_t addr; |
| (...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1989 } | 1997 } |
| 1990 } | 1998 } |
| 1991 } | 1999 } |
| 1992 | 2000 |
| 1993 | 2001 |
| 1994 void Simulator::InstructionDecode(Instr* instr) { | 2002 void Simulator::InstructionDecode(Instr* instr) { |
| 1995 if (IsTracingExecution()) { | 2003 if (IsTracingExecution()) { |
| 1996 OS::Print("%" Pu64 " ", icount_); | 2004 OS::Print("%" Pu64 " ", icount_); |
| 1997 const uword start = reinterpret_cast<uword>(instr); | 2005 const uword start = reinterpret_cast<uword>(instr); |
| 1998 const uword end = start + Instr::kInstrSize; | 2006 const uword end = start + Instr::kInstrSize; |
| 1999 Disassembler::Disassemble(start, end); | 2007 if (FLAG_support_disassembler) { |
| 2008 Disassembler::Disassemble(start, end); |
| 2009 } else { |
| 2010 OS::Print("Disassembler not supported in this mode.\n"); |
| 2011 } |
| 2000 } | 2012 } |
| 2001 | 2013 |
| 2002 switch (instr->OpcodeField()) { | 2014 switch (instr->OpcodeField()) { |
| 2003 case SPECIAL: { | 2015 case SPECIAL: { |
| 2004 DecodeSpecial(instr); | 2016 DecodeSpecial(instr); |
| 2005 break; | 2017 break; |
| 2006 } | 2018 } |
| 2007 case SPECIAL2: { | 2019 case SPECIAL2: { |
| 2008 DecodeSpecial2(instr); | 2020 DecodeSpecial2(instr); |
| 2009 break; | 2021 break; |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2499 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); | 2511 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); |
| 2500 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); | 2512 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); |
| 2501 buf->Longjmp(); | 2513 buf->Longjmp(); |
| 2502 } | 2514 } |
| 2503 | 2515 |
| 2504 } // namespace dart | 2516 } // namespace dart |
| 2505 | 2517 |
| 2506 #endif // defined(USING_SIMULATOR) | 2518 #endif // defined(USING_SIMULATOR) |
| 2507 | 2519 |
| 2508 #endif // defined TARGET_ARCH_MIPS | 2520 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |