drcbe: fixed logging problem

This commit is contained in:
Patrick Mackinlay 2020-07-10 12:26:12 +07:00
parent e8831b72a9
commit 6b14322fc1
3 changed files with 16 additions and 17 deletions

View File

@ -398,6 +398,14 @@ const drcbe_x64::opcode_table_entry drcbe_x64::s_opcode_table_source[] =
{ uml::OP_ICOPYF, &drcbe_x64::op_icopyf } // ICOPYF dst,src
};
class ThrowableErrorHandler : public ErrorHandler
{
public:
void handleError(Error err, const char *message, BaseEmitter *origin) override
{
throw emu_fatalerror("asmjit error %d: %s", err, message);
}
};
//**************************************************************************
@ -854,7 +862,7 @@ void drcbe_x64::generate(drcuml_block &block, const instruction *instlist, uint3
a.addValidationOptions(BaseEmitter::kValidationOptionIntermediate);
// generate code
const char *blockname = nullptr;
std::string blockname;
for (int inum = 0; inum < numinst; inum++)
{
const instruction &inst = instlist[inum];
@ -873,12 +881,12 @@ void drcbe_x64::generate(drcuml_block &block, const instruction *instlist, uint3
}
// extract a blockname
if (blockname == nullptr)
if (blockname.empty())
{
if (inst.opcode() == OP_HANDLE)
blockname = inst.param(0).handle().string();
else if (inst.opcode() == OP_HASH)
blockname = string_format("Code: mode=%d PC=%08X", (uint32_t)inst.param(0).immediate(), (offs_t)inst.param(1).immediate()).c_str();
blockname = string_format("Code: mode=%d PC=%08X", (uint32_t)inst.param(0).immediate(), (offs_t)inst.param(1).immediate());
}
// generate code
@ -892,7 +900,7 @@ void drcbe_x64::generate(drcuml_block &block, const instruction *instlist, uint3
// log it
if (m_log != nullptr)
x86log_disasm_code_range(m_log, (blockname == nullptr) ? "Unknown block" : blockname, dst, dst + bytes);
x86log_disasm_code_range(m_log, (blockname.empty()) ? "Unknown block" : blockname.c_str(), dst, dst + bytes);
// tell all of our utility objects that the block is finished
m_hash.block_end(block);

View File

@ -277,13 +277,4 @@ private:
using drc::drcbe_x64;
class ThrowableErrorHandler : public ErrorHandler
{
public:
void handleError(Error err, const char *message, BaseEmitter *origin) override
{
throw emu_fatalerror("asmjit error %d: %s", err, message);
}
};
#endif /* MAME_DEVICES_CPU_DRCBEX64_H */

View File

@ -784,7 +784,7 @@ void drcbe_x86::generate(drcuml_block &block, const instruction *instlist, uint3
x86code *dst = base;
// generate code
const char *blockname = nullptr;
std::string blockname;
for (int inum = 0; inum < numinst; inum++)
{
const instruction &inst = instlist[inum];
@ -798,12 +798,12 @@ void drcbe_x86::generate(drcuml_block &block, const instruction *instlist, uint3
}
// extract a blockname
if (blockname == nullptr)
if (blockname.empty())
{
if (inst.opcode() == OP_HANDLE)
blockname = inst.param(0).handle().string();
else if (inst.opcode() == OP_HASH)
blockname = string_format("Code: mode=%d PC=%08X", (uint32_t)inst.param(0).immediate(), (offs_t)inst.param(1).immediate()).c_str();
blockname = string_format("Code: mode=%d PC=%08X", (uint32_t)inst.param(0).immediate(), (offs_t)inst.param(1).immediate());
}
// generate code
@ -816,7 +816,7 @@ void drcbe_x86::generate(drcuml_block &block, const instruction *instlist, uint3
// log it
if (m_log != nullptr)
x86log_disasm_code_range(m_log, (blockname == nullptr) ? "Unknown block" : blockname, base, m_cache.top());
x86log_disasm_code_range(m_log, (blockname.empty()) ? "Unknown block" : blockname.c_str(), base, m_cache.top());
// tell all of our utility objects that the block is finished
m_hash.block_end(block);