| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 void Debugger::Stop(Instr* instr) { | 147 void Debugger::Stop(Instr* instr) { |
| 148 // Get the stop code. | 148 // Get the stop code. |
| 149 uint32_t code = instr->SvcField() & kStopCodeMask; | 149 uint32_t code = instr->SvcField() & kStopCodeMask; |
| 150 // Retrieve the encoded address, which comes just after this stop. | 150 // Retrieve the encoded address, which comes just after this stop. |
| 151 char* msg = *reinterpret_cast<char**>(sim_->get_pc() + Instr::kInstrSize); | 151 char* msg = *reinterpret_cast<char**>(sim_->get_pc() + Instr::kInstrSize); |
| 152 // Update this stop description. | 152 // Update this stop description. |
| 153 if (sim_->isWatchedStop(code) && !sim_->watched_stops[code].desc) { | 153 if (sim_->isWatchedStop(code) && !sim_->watched_stops[code].desc) { |
| 154 sim_->watched_stops[code].desc = msg; | 154 sim_->watched_stops[code].desc = msg; |
| 155 } | 155 } |
| 156 PrintF("Simulator hit %s\n", msg); | 156 // Print the stop message and code if it is not the default code. |
| 157 if (code != kMaxStopCode) { |
| 158 PrintF("Simulator hit stop %u: %s\n", code, msg); |
| 159 } else { |
| 160 PrintF("Simulator hit %s\n", msg); |
| 161 } |
| 157 sim_->set_pc(sim_->get_pc() + 2 * Instr::kInstrSize); | 162 sim_->set_pc(sim_->get_pc() + 2 * Instr::kInstrSize); |
| 158 Debug(); | 163 Debug(); |
| 159 } | 164 } |
| 160 #endif | 165 #endif |
| 161 | 166 |
| 162 | 167 |
| 163 int32_t Debugger::GetRegisterValue(int regnum) { | 168 int32_t Debugger::GetRegisterValue(int regnum) { |
| 164 if (regnum == kPCRegister) { | 169 if (regnum == kPCRegister) { |
| 165 return sim_->get_pc(); | 170 return sim_->get_pc(); |
| 166 } else { | 171 } else { |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 } | 448 } |
| 444 } else if (strcmp(cmd, "flags") == 0) { | 449 } else if (strcmp(cmd, "flags") == 0) { |
| 445 PrintF("N flag: %d; ", sim_->n_flag_); | 450 PrintF("N flag: %d; ", sim_->n_flag_); |
| 446 PrintF("Z flag: %d; ", sim_->z_flag_); | 451 PrintF("Z flag: %d; ", sim_->z_flag_); |
| 447 PrintF("C flag: %d; ", sim_->c_flag_); | 452 PrintF("C flag: %d; ", sim_->c_flag_); |
| 448 PrintF("V flag: %d\n", sim_->v_flag_); | 453 PrintF("V flag: %d\n", sim_->v_flag_); |
| 449 PrintF("INVALID OP flag: %d; ", sim_->inv_op_vfp_flag_); | 454 PrintF("INVALID OP flag: %d; ", sim_->inv_op_vfp_flag_); |
| 450 PrintF("DIV BY ZERO flag: %d; ", sim_->div_zero_vfp_flag_); | 455 PrintF("DIV BY ZERO flag: %d; ", sim_->div_zero_vfp_flag_); |
| 451 PrintF("OVERFLOW flag: %d; ", sim_->overflow_vfp_flag_); | 456 PrintF("OVERFLOW flag: %d; ", sim_->overflow_vfp_flag_); |
| 452 PrintF("UNDERFLOW flag: %d; ", sim_->underflow_vfp_flag_); | 457 PrintF("UNDERFLOW flag: %d; ", sim_->underflow_vfp_flag_); |
| 453 PrintF("INEXACT flag: %d; ", sim_->inexact_vfp_flag_); | 458 PrintF("INEXACT flag: %d;\n", sim_->inexact_vfp_flag_); |
| 454 } else if (strcmp(cmd, "stop") == 0) { | 459 } else if (strcmp(cmd, "stop") == 0) { |
| 455 int32_t value; | 460 int32_t value; |
| 456 intptr_t stop_pc = sim_->get_pc() - 2 * Instr::kInstrSize; | 461 intptr_t stop_pc = sim_->get_pc() - 2 * Instr::kInstrSize; |
| 457 Instr* stop_instr = reinterpret_cast<Instr*>(stop_pc); | 462 Instr* stop_instr = reinterpret_cast<Instr*>(stop_pc); |
| 458 Instr* msg_address = | 463 Instr* msg_address = |
| 459 reinterpret_cast<Instr*>(stop_pc + Instr::kInstrSize); | 464 reinterpret_cast<Instr*>(stop_pc + Instr::kInstrSize); |
| 460 if ((argc == 2) && (strcmp(arg1, "unstop") == 0)) { | 465 if ((argc == 2) && (strcmp(arg1, "unstop") == 0)) { |
| 461 // Remove the current stop. | 466 // Remove the current stop. |
| 462 if (sim_->isStopInstruction(stop_instr)) { | 467 if (sim_->isStopInstruction(stop_instr)) { |
| 463 stop_instr->SetInstructionBits(kNopInstr); | 468 stop_instr->SetInstructionBits(kNopInstr); |
| (...skipping 2431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2895 } | 2900 } |
| 2896 case 7: { | 2901 case 7: { |
| 2897 DecodeType7(instr); | 2902 DecodeType7(instr); |
| 2898 break; | 2903 break; |
| 2899 } | 2904 } |
| 2900 default: { | 2905 default: { |
| 2901 UNIMPLEMENTED(); | 2906 UNIMPLEMENTED(); |
| 2902 break; | 2907 break; |
| 2903 } | 2908 } |
| 2904 } | 2909 } |
| 2910 // If the instruction is a non taken conditional stop, we need to skip the |
| 2911 // inlined message address. |
| 2912 } else if (instr->IsStop()) { |
| 2913 set_pc(get_pc() + 2 * Instr::kInstrSize); |
| 2905 } | 2914 } |
| 2906 if (!pc_modified_) { | 2915 if (!pc_modified_) { |
| 2907 set_register(pc, reinterpret_cast<int32_t>(instr) + Instr::kInstrSize); | 2916 set_register(pc, reinterpret_cast<int32_t>(instr) + Instr::kInstrSize); |
| 2908 } | 2917 } |
| 2909 } | 2918 } |
| 2910 | 2919 |
| 2911 | 2920 |
| 2912 void Simulator::Execute() { | 2921 void Simulator::Execute() { |
| 2913 // Get the PC to simulate. Cannot use the accessor here as we need the | 2922 // Get the PC to simulate. Cannot use the accessor here as we need the |
| 2914 // raw PC value and not the one used as input to arithmetic instructions. | 2923 // raw PC value and not the one used as input to arithmetic instructions. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3046 uintptr_t address = *stack_slot; | 3055 uintptr_t address = *stack_slot; |
| 3047 set_register(sp, current_sp + sizeof(uintptr_t)); | 3056 set_register(sp, current_sp + sizeof(uintptr_t)); |
| 3048 return address; | 3057 return address; |
| 3049 } | 3058 } |
| 3050 | 3059 |
| 3051 } } // namespace assembler::arm | 3060 } } // namespace assembler::arm |
| 3052 | 3061 |
| 3053 #endif // USE_SIMULATOR | 3062 #endif // USE_SIMULATOR |
| 3054 | 3063 |
| 3055 #endif // V8_TARGET_ARCH_ARM | 3064 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |