OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 Debugger::Debugger(Simulator* sim) { | 84 Debugger::Debugger(Simulator* sim) { |
85 sim_ = sim; | 85 sim_ = sim; |
86 } | 86 } |
87 | 87 |
88 | 88 |
89 Debugger::~Debugger() { | 89 Debugger::~Debugger() { |
90 } | 90 } |
91 | 91 |
92 | 92 |
93 | 93 |
94 #ifdef ARM_GENERATED_CODE_COVERAGE | 94 #ifdef GENERATED_CODE_COVERAGE |
95 static FILE* coverage_log = NULL; | 95 static FILE* coverage_log = NULL; |
96 | 96 |
97 | 97 |
98 static void InitializeCoverage() { | 98 static void InitializeCoverage() { |
99 char* file_name = getenv("V8_GENERATED_CODE_COVERAGE_LOG"); | 99 char* file_name = getenv("V8_GENERATED_CODE_COVERAGE_LOG"); |
100 if (file_name != NULL) { | 100 if (file_name != NULL) { |
101 coverage_log = fopen(file_name, "aw+"); | 101 coverage_log = fopen(file_name, "aw+"); |
102 } | 102 } |
103 } | 103 } |
104 | 104 |
105 | 105 |
106 void Debugger::Stop(Instr* instr) { | 106 void Debugger::Stop(Instr* instr) { |
107 char* str = reinterpret_cast<char*>(instr->InstructionBits() & 0x0fffffff); | 107 char* str = reinterpret_cast<char*>(instr->InstructionBits() & 0x0fffffff); |
108 if (strlen(str) > 0) { | 108 if (strlen(str) > 0) { |
109 if (coverage_log != NULL) { | 109 if (coverage_log != NULL) { |
110 fprintf(coverage_log, "Simulator hit %s\n", str); | 110 fprintf(coverage_log, "%s\n", str); |
111 fflush(coverage_log); | 111 fflush(coverage_log); |
112 } | 112 } |
113 instr->SetInstructionBits(0xe1a00000); // Overwrite with nop. | 113 instr->SetInstructionBits(0xe1a00000); // Overwrite with nop. |
114 } | 114 } |
115 sim_->set_pc(sim_->get_pc() + Instr::kInstrSize); | 115 sim_->set_pc(sim_->get_pc() + Instr::kInstrSize); |
116 } | 116 } |
117 | 117 |
118 #else // ndef ARM_GENERATED_CODE_COVERAGE | 118 #else // ndef GENERATED_CODE_COVERAGE |
119 | 119 |
120 static void InitializeCoverage() { | 120 static void InitializeCoverage() { |
121 } | 121 } |
122 | 122 |
123 | 123 |
124 void Debugger::Stop(Instr* instr) { | 124 void Debugger::Stop(Instr* instr) { |
125 const char* str = (const char*)(instr->InstructionBits() & 0x0fffffff); | 125 const char* str = (const char*)(instr->InstructionBits() & 0x0fffffff); |
126 PrintF("Simulator hit %s\n", str); | 126 PrintF("Simulator hit %s\n", str); |
127 sim_->set_pc(sim_->get_pc() + Instr::kInstrSize); | 127 sim_->set_pc(sim_->get_pc() + Instr::kInstrSize); |
128 Debug(); | 128 Debug(); |
(...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1678 set_register(r10, r10_val); | 1678 set_register(r10, r10_val); |
1679 set_register(r11, r11_val); | 1679 set_register(r11, r11_val); |
1680 | 1680 |
1681 int result = get_register(r0); | 1681 int result = get_register(r0); |
1682 return reinterpret_cast<Object*>(result); | 1682 return reinterpret_cast<Object*>(result); |
1683 } | 1683 } |
1684 | 1684 |
1685 } } // namespace assembler::arm | 1685 } } // namespace assembler::arm |
1686 | 1686 |
1687 #endif // !defined(__arm__) | 1687 #endif // !defined(__arm__) |
OLD | NEW |