Enable instruction details

This commit is contained in:
momo5502
2025-08-16 13:48:52 +02:00
parent 03541adc22
commit ee2835d658
3 changed files with 19 additions and 8 deletions

View File

@@ -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)

View File

@@ -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()

View File

@@ -1,7 +1,6 @@
#pragma once
#include <capstone/capstone.h>
#include <utils/finally.hpp>
class instructions
{