| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1692 | 1692 |
| 1693 } // namespace internal | 1693 } // namespace internal |
| 1694 } // namespace v8 | 1694 } // namespace v8 |
| 1695 | 1695 |
| 1696 | 1696 |
| 1697 //------------------------------------------------------------------------------ | 1697 //------------------------------------------------------------------------------ |
| 1698 | 1698 |
| 1699 namespace disasm { | 1699 namespace disasm { |
| 1700 | 1700 |
| 1701 const char* NameConverter::NameOfAddress(byte* addr) const { | 1701 const char* NameConverter::NameOfAddress(byte* addr) const { |
| 1702 v8::internal::SNPrintF(tmp_buffer_, "%p", addr); | 1702 v8::internal::SNPrintF(tmp_buffer_, "%p", static_cast<void*>(addr)); |
| 1703 return tmp_buffer_.start(); | 1703 return tmp_buffer_.start(); |
| 1704 } | 1704 } |
| 1705 | 1705 |
| 1706 | 1706 |
| 1707 const char* NameConverter::NameOfConstant(byte* addr) const { | 1707 const char* NameConverter::NameOfConstant(byte* addr) const { |
| 1708 return NameOfAddress(addr); | 1708 return NameOfAddress(addr); |
| 1709 } | 1709 } |
| 1710 | 1710 |
| 1711 | 1711 |
| 1712 const char* NameConverter::NameOfCPURegister(int reg) const { | 1712 const char* NameConverter::NameOfCPURegister(int reg) const { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1755 | 1755 |
| 1756 | 1756 |
| 1757 void Disassembler::Disassemble(FILE* f, byte* begin, byte* end) { | 1757 void Disassembler::Disassemble(FILE* f, byte* begin, byte* end) { |
| 1758 NameConverter converter; | 1758 NameConverter converter; |
| 1759 Disassembler d(converter); | 1759 Disassembler d(converter); |
| 1760 for (byte* pc = begin; pc < end;) { | 1760 for (byte* pc = begin; pc < end;) { |
| 1761 v8::internal::EmbeddedVector<char, 128> buffer; | 1761 v8::internal::EmbeddedVector<char, 128> buffer; |
| 1762 buffer[0] = '\0'; | 1762 buffer[0] = '\0'; |
| 1763 byte* prev_pc = pc; | 1763 byte* prev_pc = pc; |
| 1764 pc += d.InstructionDecode(buffer, pc); | 1764 pc += d.InstructionDecode(buffer, pc); |
| 1765 v8::internal::PrintF(f, "%p %08x %s\n", | 1765 v8::internal::PrintF(f, "%p %08x %s\n", static_cast<void*>(prev_pc), |
| 1766 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 1766 *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
| 1767 } | 1767 } |
| 1768 } | 1768 } |
| 1769 | 1769 |
| 1770 | 1770 |
| 1771 #undef UNSUPPORTED | 1771 #undef UNSUPPORTED |
| 1772 | 1772 |
| 1773 } // namespace disasm | 1773 } // namespace disasm |
| 1774 | 1774 |
| 1775 #endif // V8_TARGET_ARCH_MIPS | 1775 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |