Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/mips/simulator-mips.cc

Issue 13469002: Cleanup: Rename Simulator::watched_stops to match style guide. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/simulator-mips.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 void MipsDebugger::Stop(Instruction* instr) { 125 void MipsDebugger::Stop(Instruction* instr) {
126 // Get the stop code. 126 // Get the stop code.
127 uint32_t code = instr->Bits(25, 6); 127 uint32_t code = instr->Bits(25, 6);
128 // Retrieve the encoded address, which comes just after this stop. 128 // Retrieve the encoded address, which comes just after this stop.
129 char** msg_address = 129 char** msg_address =
130 reinterpret_cast<char**>(sim_->get_pc() + Instr::kInstrSize); 130 reinterpret_cast<char**>(sim_->get_pc() + Instr::kInstrSize);
131 char* msg = *msg_address; 131 char* msg = *msg_address;
132 ASSERT(msg != NULL); 132 ASSERT(msg != NULL);
133 133
134 // Update this stop description. 134 // Update this stop description.
135 if (!watched_stops[code].desc) { 135 if (!watched_stops_[code].desc) {
136 watched_stops[code].desc = msg; 136 watched_stops_[code].desc = msg;
137 } 137 }
138 138
139 if (strlen(msg) > 0) { 139 if (strlen(msg) > 0) {
140 if (coverage_log != NULL) { 140 if (coverage_log != NULL) {
141 fprintf(coverage_log, "%s\n", str); 141 fprintf(coverage_log, "%s\n", str);
142 fflush(coverage_log); 142 fflush(coverage_log);
143 } 143 }
144 // Overwrite the instruction and address with nops. 144 // Overwrite the instruction and address with nops.
145 instr->SetInstructionBits(kNopInstr); 145 instr->SetInstructionBits(kNopInstr);
146 reinterpret_cast<Instr*>(msg_address)->SetInstructionBits(kNopInstr); 146 reinterpret_cast<Instr*>(msg_address)->SetInstructionBits(kNopInstr);
147 } 147 }
148 sim_->set_pc(sim_->get_pc() + 2 * Instruction::kInstructionSize); 148 sim_->set_pc(sim_->get_pc() + 2 * Instruction::kInstructionSize);
149 } 149 }
150 150
151 151
152 #else // GENERATED_CODE_COVERAGE 152 #else // GENERATED_CODE_COVERAGE
153 153
154 #define UNSUPPORTED() printf("Unsupported instruction.\n"); 154 #define UNSUPPORTED() printf("Unsupported instruction.\n");
155 155
156 static void InitializeCoverage() {} 156 static void InitializeCoverage() {}
157 157
158 158
159 void MipsDebugger::Stop(Instruction* instr) { 159 void MipsDebugger::Stop(Instruction* instr) {
160 // Get the stop code. 160 // Get the stop code.
161 uint32_t code = instr->Bits(25, 6); 161 uint32_t code = instr->Bits(25, 6);
162 // Retrieve the encoded address, which comes just after this stop. 162 // Retrieve the encoded address, which comes just after this stop.
163 char* msg = *reinterpret_cast<char**>(sim_->get_pc() + 163 char* msg = *reinterpret_cast<char**>(sim_->get_pc() +
164 Instruction::kInstrSize); 164 Instruction::kInstrSize);
165 // Update this stop description. 165 // Update this stop description.
166 if (!sim_->watched_stops[code].desc) { 166 if (!sim_->watched_stops_[code].desc) {
167 sim_->watched_stops[code].desc = msg; 167 sim_->watched_stops_[code].desc = msg;
168 } 168 }
169 PrintF("Simulator hit %s (%u)\n", msg, code); 169 PrintF("Simulator hit %s (%u)\n", msg, code);
170 sim_->set_pc(sim_->get_pc() + 2 * Instruction::kInstrSize); 170 sim_->set_pc(sim_->get_pc() + 2 * Instruction::kInstrSize);
171 Debug(); 171 Debug();
172 } 172 }
173 #endif // GENERATED_CODE_COVERAGE 173 #endif // GENERATED_CODE_COVERAGE
174 174
175 175
176 int32_t MipsDebugger::GetRegisterValue(int regnum) { 176 int32_t MipsDebugger::GetRegisterValue(int regnum) {
177 if (regnum == kNumSimuRegisters) { 177 if (regnum == kNumSimuRegisters) {
(...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 bool Simulator::IsStopInstruction(Instruction* instr) { 1629 bool Simulator::IsStopInstruction(Instruction* instr) {
1630 int32_t func = instr->FunctionFieldRaw(); 1630 int32_t func = instr->FunctionFieldRaw();
1631 uint32_t code = static_cast<uint32_t>(instr->Bits(25, 6)); 1631 uint32_t code = static_cast<uint32_t>(instr->Bits(25, 6));
1632 return (func == BREAK) && code > kMaxWatchpointCode && code <= kMaxStopCode; 1632 return (func == BREAK) && code > kMaxWatchpointCode && code <= kMaxStopCode;
1633 } 1633 }
1634 1634
1635 1635
1636 bool Simulator::IsEnabledStop(uint32_t code) { 1636 bool Simulator::IsEnabledStop(uint32_t code) {
1637 ASSERT(code <= kMaxStopCode); 1637 ASSERT(code <= kMaxStopCode);
1638 ASSERT(code > kMaxWatchpointCode); 1638 ASSERT(code > kMaxWatchpointCode);
1639 return !(watched_stops[code].count & kStopDisabledBit); 1639 return !(watched_stops_[code].count & kStopDisabledBit);
1640 } 1640 }
1641 1641
1642 1642
1643 void Simulator::EnableStop(uint32_t code) { 1643 void Simulator::EnableStop(uint32_t code) {
1644 if (!IsEnabledStop(code)) { 1644 if (!IsEnabledStop(code)) {
1645 watched_stops[code].count &= ~kStopDisabledBit; 1645 watched_stops_[code].count &= ~kStopDisabledBit;
1646 } 1646 }
1647 } 1647 }
1648 1648
1649 1649
1650 void Simulator::DisableStop(uint32_t code) { 1650 void Simulator::DisableStop(uint32_t code) {
1651 if (IsEnabledStop(code)) { 1651 if (IsEnabledStop(code)) {
1652 watched_stops[code].count |= kStopDisabledBit; 1652 watched_stops_[code].count |= kStopDisabledBit;
1653 } 1653 }
1654 } 1654 }
1655 1655
1656 1656
1657 void Simulator::IncreaseStopCounter(uint32_t code) { 1657 void Simulator::IncreaseStopCounter(uint32_t code) {
1658 ASSERT(code <= kMaxStopCode); 1658 ASSERT(code <= kMaxStopCode);
1659 if ((watched_stops[code].count & ~(1 << 31)) == 0x7fffffff) { 1659 if ((watched_stops_[code].count & ~(1 << 31)) == 0x7fffffff) {
1660 PrintF("Stop counter for code %i has overflowed.\n" 1660 PrintF("Stop counter for code %i has overflowed.\n"
1661 "Enabling this code and reseting the counter to 0.\n", code); 1661 "Enabling this code and reseting the counter to 0.\n", code);
1662 watched_stops[code].count = 0; 1662 watched_stops_[code].count = 0;
1663 EnableStop(code); 1663 EnableStop(code);
1664 } else { 1664 } else {
1665 watched_stops[code].count++; 1665 watched_stops_[code].count++;
1666 } 1666 }
1667 } 1667 }
1668 1668
1669 1669
1670 // Print a stop status. 1670 // Print a stop status.
1671 void Simulator::PrintStopInfo(uint32_t code) { 1671 void Simulator::PrintStopInfo(uint32_t code) {
1672 if (code <= kMaxWatchpointCode) { 1672 if (code <= kMaxWatchpointCode) {
1673 PrintF("That is a watchpoint, not a stop.\n"); 1673 PrintF("That is a watchpoint, not a stop.\n");
1674 return; 1674 return;
1675 } else if (code > kMaxStopCode) { 1675 } else if (code > kMaxStopCode) {
1676 PrintF("Code too large, only %u stops can be used\n", kMaxStopCode + 1); 1676 PrintF("Code too large, only %u stops can be used\n", kMaxStopCode + 1);
1677 return; 1677 return;
1678 } 1678 }
1679 const char* state = IsEnabledStop(code) ? "Enabled" : "Disabled"; 1679 const char* state = IsEnabledStop(code) ? "Enabled" : "Disabled";
1680 int32_t count = watched_stops[code].count & ~kStopDisabledBit; 1680 int32_t count = watched_stops_[code].count & ~kStopDisabledBit;
1681 // Don't print the state of unused breakpoints. 1681 // Don't print the state of unused breakpoints.
1682 if (count != 0) { 1682 if (count != 0) {
1683 if (watched_stops[code].desc) { 1683 if (watched_stops_[code].desc) {
1684 PrintF("stop %i - 0x%x: \t%s, \tcounter = %i, \t%s\n", 1684 PrintF("stop %i - 0x%x: \t%s, \tcounter = %i, \t%s\n",
1685 code, code, state, count, watched_stops[code].desc); 1685 code, code, state, count, watched_stops_[code].desc);
1686 } else { 1686 } else {
1687 PrintF("stop %i - 0x%x: \t%s, \tcounter = %i\n", 1687 PrintF("stop %i - 0x%x: \t%s, \tcounter = %i\n",
1688 code, code, state, count); 1688 code, code, state, count);
1689 } 1689 }
1690 } 1690 }
1691 } 1691 }
1692 1692
1693 1693
1694 void Simulator::SignalExceptions() { 1694 void Simulator::SignalExceptions() {
1695 for (int i = 1; i < kNumExceptions; i++) { 1695 for (int i = 1; i < kNumExceptions; i++) {
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after
2899 } 2899 }
2900 2900
2901 2901
2902 #undef UNSUPPORTED 2902 #undef UNSUPPORTED
2903 2903
2904 } } // namespace v8::internal 2904 } } // namespace v8::internal
2905 2905
2906 #endif // USE_SIMULATOR 2906 #endif // USE_SIMULATOR
2907 2907
2908 #endif // V8_TARGET_ARCH_MIPS 2908 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/simulator-mips.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698