mirror of
https://github.com/holub/mame
synced 2025-04-25 17:56:43 +03:00
Eliminated 'device_disasm_interface::disassemble(std::string &buffer, ...'
This commit is contained in:
parent
92d3c78696
commit
932f69d6e9
@ -2401,11 +2401,11 @@ void debugger_commands::execute_dasm(int ref, int params, const char *param[])
|
||||
|
||||
/* now write the data out */
|
||||
util::ovectorstream output;
|
||||
util::ovectorstream disasm;
|
||||
output.reserve(512);
|
||||
for (u64 i = 0; i < length; )
|
||||
{
|
||||
int pcbyte = space->address_to_byte(offset + i) & space->bytemask();
|
||||
std::string disasm;
|
||||
const char *comment;
|
||||
offs_t tempaddr;
|
||||
int numbytes = 0;
|
||||
@ -2429,6 +2429,8 @@ void debugger_commands::execute_dasm(int ref, int params, const char *param[])
|
||||
}
|
||||
|
||||
/* disassemble the result */
|
||||
disasm.clear();
|
||||
disasm.seekp(0);
|
||||
i += numbytes = dasmintf->disassemble(disasm, offset + i, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
|
||||
}
|
||||
|
||||
@ -2445,7 +2447,8 @@ void debugger_commands::execute_dasm(int ref, int params, const char *param[])
|
||||
}
|
||||
|
||||
/* add the disassembly */
|
||||
stream_format(output, "%s", disasm);
|
||||
disasm.put('\0');
|
||||
stream_format(output, "%s", &disasm.vec()[0]);
|
||||
|
||||
/* attempt to add the comment */
|
||||
comment = space->device().debug()->comment_text(tempaddr);
|
||||
@ -2604,10 +2607,11 @@ void debugger_commands::execute_history(int ref, int params, const char *param[]
|
||||
argbuf[numbytes] = m_cpu.read_opcode(*space, pcbyte + numbytes, 1);
|
||||
}
|
||||
|
||||
std::string buffer;
|
||||
util::ovectorstream buffer;
|
||||
dasmintf->disassemble(buffer, pc, opbuf, argbuf);
|
||||
buffer.put('\0');
|
||||
|
||||
m_console.printf("%0*X: %s\n", space->logaddrchars(), pc, buffer.c_str());
|
||||
m_console.printf("%0*X: %s\n", space->logaddrchars(), pc, &buffer.vec()[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2627,7 +2627,7 @@ u32 device_debug::compute_opcode_crc32(offs_t pc) const
|
||||
if (m_disasm != nullptr)
|
||||
{
|
||||
// disassemble to our buffer
|
||||
std::string diasmbuf;
|
||||
std::ostringstream diasmbuf;
|
||||
numbytes = m_disasm->disassemble(diasmbuf, pc, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
|
||||
}
|
||||
|
||||
@ -3026,7 +3026,9 @@ u32 device_debug::dasm_wrapped(std::string &buffer, offs_t pc)
|
||||
}
|
||||
|
||||
// disassemble to our buffer
|
||||
uint32_t result = m_disasm->disassemble(buffer, pc, opbuf, argbuf);
|
||||
std::ostringstream stream;
|
||||
uint32_t result = m_disasm->disassemble(stream, pc, opbuf, argbuf);
|
||||
buffer = stream.str();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs)
|
||||
instlen = 1;
|
||||
if (source.m_space.device().memory().translate(source.m_space.spacenum(), TRANSLATE_FETCH, physpcbyte))
|
||||
{
|
||||
std::string dasmbuffer;
|
||||
std::ostringstream dasmbuffer;
|
||||
instlen = source.m_disasmintf->disassemble(dasmbuffer, scanpc, &opbuf[1000 + scanpcbyte - targetpcbyte], &argbuf[1000 + scanpcbyte - targetpcbyte]) & DASMFLAG_LENGTHMASK;
|
||||
}
|
||||
|
||||
@ -335,6 +335,7 @@ void debug_view_disasm::generate_bytes(offs_t pcbyte, int numbytes, int minbytes
|
||||
|
||||
bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
|
||||
{
|
||||
util::ovectorstream buffer;
|
||||
bool changed = false;
|
||||
const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source);
|
||||
const int char_num = source.m_space.is_octal() ? 3 : 2;
|
||||
@ -392,7 +393,8 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
|
||||
source.m_space.logaddrchars()/2*char_num, source.m_space.byte_to_address(pcbyte));
|
||||
|
||||
// make sure we can translate the address, and then disassemble the result
|
||||
std::string buffer;
|
||||
buffer.clear();
|
||||
buffer.seekp(0);
|
||||
int numbytes = 0;
|
||||
offs_t physpcbyte = pcbyte;
|
||||
if (source.m_space.device().memory().translate(source.m_space.spacenum(), TRANSLATE_FETCH_DEBUG, physpcbyte))
|
||||
@ -410,10 +412,12 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
|
||||
pc += numbytes = source.m_disasmintf->disassemble(buffer, pc & source.m_space.logaddrmask(), opbuf, argbuf) & DASMFLAG_LENGTHMASK;
|
||||
}
|
||||
else
|
||||
buffer = "<unmapped>";
|
||||
buffer << "<unmapped>";
|
||||
|
||||
buffer.put('\0');
|
||||
|
||||
// append the disassembly to the buffer
|
||||
util::stream_format(m_dasm.seekp(base + m_divider1 + 1), "%2$-*1$.*1$s ", m_dasm_width, buffer);
|
||||
util::stream_format(m_dasm.seekp(base + m_divider1 + 1), "%2$-*1$.*1$s ", m_dasm_width, &buffer.vec()[0]);
|
||||
|
||||
// output the right column
|
||||
if (m_right_column == DASM_RIGHTCOL_RAW || m_right_column == DASM_RIGHTCOL_ENCRYPTED)
|
||||
|
@ -90,16 +90,3 @@ offs_t device_disasm_interface::disassemble(std::ostream &stream, offs_t pc, con
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// disassemble - interface for disassembly
|
||||
//-------------------------------------------------
|
||||
|
||||
offs_t device_disasm_interface::disassemble(std::string &buffer, offs_t pc, const u8 *oprom, const u8 *opram, uint32_t options)
|
||||
{
|
||||
std::stringstream stream;
|
||||
offs_t result = disassemble(stream, pc, oprom, opram, options);
|
||||
buffer = stream.str();
|
||||
return result;
|
||||
}
|
||||
|
@ -74,7 +74,6 @@ public:
|
||||
|
||||
// interface for disassembly
|
||||
offs_t disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options = 0);
|
||||
offs_t disassemble(std::string &buffer, offs_t pc, const u8 *oprom, const u8 *opram, u32 options = 0);
|
||||
|
||||
protected:
|
||||
// required operation overrides
|
||||
|
Loading…
Reference in New Issue
Block a user