mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-18 03:13:55 +00:00
Enable instruction details
This commit is contained in:
@@ -251,7 +251,7 @@ namespace
|
||||
return false;
|
||||
}
|
||||
|
||||
return cs_insn_group(disasm.get_handle(), &instructions[0], CS_GRP_RET);
|
||||
return cs_insn_group(disasm.get_handle(), instructions.data(), CS_GRP_RET);
|
||||
}
|
||||
|
||||
void handle_instruction(analysis_context& c, const uint64_t address)
|
||||
|
||||
@@ -1,14 +1,26 @@
|
||||
#include "std_include.hpp"
|
||||
|
||||
#include "disassembler.hpp"
|
||||
#include <utils/finally.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
void cse(const cs_err error)
|
||||
{
|
||||
if (error != CS_ERR_OK)
|
||||
{
|
||||
throw std::runtime_error(cs_strerror(error));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
disassembler::disassembler()
|
||||
{
|
||||
const auto res = cs_open(CS_ARCH_X86, CS_MODE_64, &this->handle_);
|
||||
if (res != CS_ERR_OK)
|
||||
{
|
||||
throw std::runtime_error("Failed to initialize capstone");
|
||||
}
|
||||
auto deleter = utils::finally([&] { this->release(); });
|
||||
|
||||
cse(cs_open(CS_ARCH_X86, CS_MODE_64, &this->handle_));
|
||||
cse(cs_option(this->handle_, CS_OPT_DETAIL, CS_OPT_ON));
|
||||
|
||||
deleter.cancel();
|
||||
}
|
||||
|
||||
disassembler::~disassembler()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <capstone/capstone.h>
|
||||
#include <utils/finally.hpp>
|
||||
|
||||
class instructions
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user