| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <limits.h> | 5 #include <limits.h> |
| 6 #include <stdarg.h> | 6 #include <stdarg.h> |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "src/v8.h" | 10 #include "src/v8.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 MipsDebugger::~MipsDebugger() { | 104 MipsDebugger::~MipsDebugger() { |
| 105 } | 105 } |
| 106 | 106 |
| 107 | 107 |
| 108 #ifdef GENERATED_CODE_COVERAGE | 108 #ifdef GENERATED_CODE_COVERAGE |
| 109 static FILE* coverage_log = NULL; | 109 static FILE* coverage_log = NULL; |
| 110 | 110 |
| 111 | 111 |
| 112 static void InitializeCoverage() { | 112 static void InitializeCoverage() { |
| 113 char* file_name = getenv("V8_GENERATED_CODE_COVERAGE_LOG"); | 113 char* file_name = getenv("V8_GENERATED_CODE_COVERAGE_LOG"); |
| 114 if (file_name != NULL) { | 114 if (file_name != NULL && NULL == coverage_log) { |
| 115 coverage_log = fopen(file_name, "aw+"); | 115 coverage_log = fopen(file_name, "aw+"); |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 | 118 |
| 119 static void DeinitCoverageLog() { |
| 120 if (coverage_log != NULL) { |
| 121 fclose(coverage_log); |
| 122 coverage_log = NULL; |
| 123 } |
| 124 } |
| 119 | 125 |
| 120 void MipsDebugger::Stop(Instruction* instr) { | 126 void MipsDebugger::Stop(Instruction* instr) { |
| 121 // Get the stop code. | 127 // Get the stop code. |
| 122 uint32_t code = instr->Bits(25, 6); | 128 uint32_t code = instr->Bits(25, 6); |
| 123 // Retrieve the encoded address, which comes just after this stop. | 129 // Retrieve the encoded address, which comes just after this stop. |
| 124 char** msg_address = | 130 char** msg_address = |
| 125 reinterpret_cast<char**>(sim_->get_pc() + Instr::kInstrSize); | 131 reinterpret_cast<char**>(sim_->get_pc() + Instr::kInstrSize); |
| 126 char* msg = *msg_address; | 132 char* msg = *msg_address; |
| 127 ASSERT(msg != NULL); | 133 ASSERT(msg != NULL); |
| 128 | 134 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 143 // TODO(yuyin): 2 -> 3? | 149 // TODO(yuyin): 2 -> 3? |
| 144 sim_->set_pc(sim_->get_pc() + 3 * Instruction::kInstructionSize); | 150 sim_->set_pc(sim_->get_pc() + 3 * Instruction::kInstructionSize); |
| 145 } | 151 } |
| 146 | 152 |
| 147 | 153 |
| 148 #else // GENERATED_CODE_COVERAGE | 154 #else // GENERATED_CODE_COVERAGE |
| 149 | 155 |
| 150 #define UNSUPPORTED() printf("Unsupported instruction.\n"); | 156 #define UNSUPPORTED() printf("Unsupported instruction.\n"); |
| 151 | 157 |
| 152 static void InitializeCoverage() {} | 158 static void InitializeCoverage() {} |
| 159 static void DeinitCoverageLog() {} |
| 153 | 160 |
| 154 | 161 |
| 155 void MipsDebugger::Stop(Instruction* instr) { | 162 void MipsDebugger::Stop(Instruction* instr) { |
| 156 // Get the stop code. | 163 // Get the stop code. |
| 157 uint32_t code = instr->Bits(25, 6); | 164 uint32_t code = instr->Bits(25, 6); |
| 158 // Retrieve the encoded address, which comes just after this stop. | 165 // Retrieve the encoded address, which comes just after this stop. |
| 159 char* msg = *reinterpret_cast<char**>(sim_->get_pc() + | 166 char* msg = *reinterpret_cast<char**>(sim_->get_pc() + |
| 160 Instruction::kInstrSize); | 167 Instruction::kInstrSize); |
| 161 // Update this stop description. | 168 // Update this stop description. |
| 162 if (!sim_->watched_stops_[code].desc) { | 169 if (!sim_->watched_stops_[code].desc) { |
| (...skipping 3136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3299 } | 3306 } |
| 3300 | 3307 |
| 3301 | 3308 |
| 3302 #undef UNSUPPORTED | 3309 #undef UNSUPPORTED |
| 3303 | 3310 |
| 3304 } } // namespace v8::internal | 3311 } } // namespace v8::internal |
| 3305 | 3312 |
| 3306 #endif // USE_SIMULATOR | 3313 #endif // USE_SIMULATOR |
| 3307 | 3314 |
| 3308 #endif // V8_TARGET_ARCH_MIPS64 | 3315 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |