OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 // A Disassembler object is used to disassemble a block of code instruction by | 5 // A Disassembler object is used to disassemble a block of code instruction by |
6 // instruction. The default implementation of the NameConverter object can be | 6 // instruction. The default implementation of the NameConverter object can be |
7 // overriden to modify register names or to do symbol lookup on addresses. | 7 // overriden to modify register names or to do symbol lookup on addresses. |
8 // | 8 // |
9 // The example below will disassemble a block of code and print it to stdout. | 9 // The example below will disassemble a block of code and print it to stdout. |
10 // | 10 // |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1350 } | 1350 } |
1351 | 1351 |
1352 } // namespace internal | 1352 } // namespace internal |
1353 } // namespace v8 | 1353 } // namespace v8 |
1354 | 1354 |
1355 //------------------------------------------------------------------------------ | 1355 //------------------------------------------------------------------------------ |
1356 | 1356 |
1357 namespace disasm { | 1357 namespace disasm { |
1358 | 1358 |
1359 const char* NameConverter::NameOfAddress(byte* addr) const { | 1359 const char* NameConverter::NameOfAddress(byte* addr) const { |
1360 v8::internal::SNPrintF(tmp_buffer_, "%p", addr); | 1360 v8::internal::SNPrintF(tmp_buffer_, "%p", static_cast<void*>(addr)); |
1361 return tmp_buffer_.start(); | 1361 return tmp_buffer_.start(); |
1362 } | 1362 } |
1363 | 1363 |
1364 const char* NameConverter::NameOfConstant(byte* addr) const { | 1364 const char* NameConverter::NameOfConstant(byte* addr) const { |
1365 return NameOfAddress(addr); | 1365 return NameOfAddress(addr); |
1366 } | 1366 } |
1367 | 1367 |
1368 const char* NameConverter::NameOfCPURegister(int reg) const { | 1368 const char* NameConverter::NameOfCPURegister(int reg) const { |
1369 return v8::internal::Register::from_code(reg).ToString(); | 1369 return v8::internal::Register::from_code(reg).ToString(); |
1370 } | 1370 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 int Disassembler::ConstantPoolSizeAt(byte* instruction) { return -1; } | 1404 int Disassembler::ConstantPoolSizeAt(byte* instruction) { return -1; } |
1405 | 1405 |
1406 void Disassembler::Disassemble(FILE* f, byte* begin, byte* end) { | 1406 void Disassembler::Disassemble(FILE* f, byte* begin, byte* end) { |
1407 NameConverter converter; | 1407 NameConverter converter; |
1408 Disassembler d(converter); | 1408 Disassembler d(converter); |
1409 for (byte* pc = begin; pc < end;) { | 1409 for (byte* pc = begin; pc < end;) { |
1410 v8::internal::EmbeddedVector<char, 128> buffer; | 1410 v8::internal::EmbeddedVector<char, 128> buffer; |
1411 buffer[0] = '\0'; | 1411 buffer[0] = '\0'; |
1412 byte* prev_pc = pc; | 1412 byte* prev_pc = pc; |
1413 pc += d.InstructionDecode(buffer, pc); | 1413 pc += d.InstructionDecode(buffer, pc); |
1414 v8::internal::PrintF(f, "%p %08x %s\n", prev_pc, | 1414 v8::internal::PrintF(f, "%p %08x %s\n", static_cast<void*>(prev_pc), |
1415 *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 1415 *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
1416 } | 1416 } |
1417 } | 1417 } |
1418 | 1418 |
1419 } // namespace disasm | 1419 } // namespace disasm |
1420 | 1420 |
1421 #endif // V8_TARGET_ARCH_S390 | 1421 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |