void Instruction::Dump (lldb_private::Stream *s, uint32_t max_opcode_byte_size, bool show_address, bool show_bytes, const ExecutionContext* exe_ctx) { size_t opcode_column_width = 7; const size_t operand_column_width = 25; CalculateMnemonicOperandsAndCommentIfNeeded (exe_ctx); StreamString ss; if (show_address) { m_address.Dump(&ss, exe_ctx ? exe_ctx->GetBestExecutionContextScope() : NULL, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress, 0); ss.PutCString(": "); } if (show_bytes) { if (m_opcode.GetType() == Opcode::eTypeBytes) { // x86_64 and i386 are the only ones that use bytes right now so // pad out the byte dump to be able to always show 15 bytes (3 chars each) // plus a space if (max_opcode_byte_size > 0) m_opcode.Dump (&ss, max_opcode_byte_size * 3 + 1); else m_opcode.Dump (&ss, 15 * 3 + 1); } else { // Else, we have ARM which can show up to a uint32_t 0x00000000 (10 spaces) // plus two for padding... if (max_opcode_byte_size > 0) m_opcode.Dump (&ss, max_opcode_byte_size * 3 + 1); else m_opcode.Dump (&ss, 12); } } const size_t opcode_pos = ss.GetSize(); // The default opcode size of 7 characters is plenty for most architectures // but some like arm can pull out the occasional vqrshrun.s16. We won't get // consistent column spacing in these cases, unfortunately. if (m_opcode_name.length() >= opcode_column_width) { opcode_column_width = m_opcode_name.length() + 1; } ss.PutCString (m_opcode_name.c_str()); ss.FillLastLineToColumn (opcode_pos + opcode_column_width, ' '); ss.PutCString (m_mnemonics.c_str()); if (!m_comment.empty()) { ss.FillLastLineToColumn (opcode_pos + opcode_column_width + operand_column_width, ' '); ss.PutCString (" ; "); ss.PutCString (m_comment.c_str()); } s->Write (ss.GetData(), ss.GetSize()); }
void Instruction::Dump (lldb_private::Stream *s, uint32_t max_opcode_byte_size, bool show_address, bool show_bytes, const ExecutionContext* exe_ctx, const SymbolContext *sym_ctx, const SymbolContext *prev_sym_ctx, const FormatEntity::Entry *disassembly_addr_format, size_t max_address_text_size) { size_t opcode_column_width = 7; const size_t operand_column_width = 25; CalculateMnemonicOperandsAndCommentIfNeeded (exe_ctx); StreamString ss; if (show_address) { Debugger::FormatDisassemblerAddress (disassembly_addr_format, sym_ctx, prev_sym_ctx, exe_ctx, &m_address, ss); ss.FillLastLineToColumn (max_address_text_size, ' '); } if (show_bytes) { if (m_opcode.GetType() == Opcode::eTypeBytes) { // x86_64 and i386 are the only ones that use bytes right now so // pad out the byte dump to be able to always show 15 bytes (3 chars each) // plus a space if (max_opcode_byte_size > 0) m_opcode.Dump (&ss, max_opcode_byte_size * 3 + 1); else m_opcode.Dump (&ss, 15 * 3 + 1); } else { // Else, we have ARM or MIPS which can show up to a uint32_t // 0x00000000 (10 spaces) plus two for padding... if (max_opcode_byte_size > 0) m_opcode.Dump (&ss, max_opcode_byte_size * 3 + 1); else m_opcode.Dump (&ss, 12); } } const size_t opcode_pos = ss.GetSizeOfLastLine(); // The default opcode size of 7 characters is plenty for most architectures // but some like arm can pull out the occasional vqrshrun.s16. We won't get // consistent column spacing in these cases, unfortunately. if (m_opcode_name.length() >= opcode_column_width) { opcode_column_width = m_opcode_name.length() + 1; } ss.PutCString (m_opcode_name.c_str()); ss.FillLastLineToColumn (opcode_pos + opcode_column_width, ' '); ss.PutCString (m_mnemonics.c_str()); if (!m_comment.empty()) { ss.FillLastLineToColumn (opcode_pos + opcode_column_width + operand_column_width, ' '); ss.PutCString (" ; "); ss.PutCString (m_comment.c_str()); } s->Write (ss.GetData(), ss.GetSize()); }
void Instruction::Dump (lldb_private::Stream *s, uint32_t max_opcode_byte_size, bool show_address, bool show_bytes, const ExecutionContext* exe_ctx) { const size_t opcode_column_width = 7; const size_t operand_column_width = 25; CalculateMnemonicOperandsAndCommentIfNeeded (exe_ctx); StreamString ss; if (show_address) { m_address.Dump(&ss, exe_ctx ? exe_ctx->GetBestExecutionContextScope() : NULL, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress, 0); ss.PutCString(": "); } if (show_bytes) { if (m_opcode.GetType() == Opcode::eTypeBytes) { // x86_64 and i386 are the only ones that use bytes right now so // pad out the byte dump to be able to always show 15 bytes (3 chars each) // plus a space if (max_opcode_byte_size > 0) m_opcode.Dump (&ss, max_opcode_byte_size * 3 + 1); else m_opcode.Dump (&ss, 15 * 3 + 1); } else { // Else, we have ARM which can show up to a uint32_t 0x00000000 (10 spaces) // plus two for padding... if (max_opcode_byte_size > 0) m_opcode.Dump (&ss, max_opcode_byte_size * 3 + 1); else m_opcode.Dump (&ss, 12); } } const size_t opcode_pos = ss.GetSize(); ss.PutCString (m_opcode_name.c_str()); ss.FillLastLineToColumn (opcode_pos + opcode_column_width, ' '); ss.PutCString (m_mnemocics.c_str()); if (!m_comment.empty()) { ss.FillLastLineToColumn (opcode_pos + opcode_column_width + operand_column_width, ' '); ss.PutCString (" ; "); ss.PutCString (m_comment.c_str()); } s->Write (ss.GetData(), ss.GetSize()); }