2021-12-07 22:47:41 +01:00
|
|
|
#include "content/views/view_disassembler.hpp"
|
2020-11-22 23:07:50 +01:00
|
|
|
|
2021-01-13 17:28:27 +01:00
|
|
|
#include <hex/providers/provider.hpp>
|
2021-08-29 22:15:18 +02:00
|
|
|
#include <hex/helpers/fmt.hpp>
|
2020-11-22 23:07:50 +01:00
|
|
|
|
|
|
|
#include <cstring>
|
2021-02-22 11:56:33 +01:00
|
|
|
#include <thread>
|
|
|
|
|
2020-11-22 23:07:50 +01:00
|
|
|
using namespace std::literals::string_literals;
|
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
namespace hex::plugin::builtin {
|
2020-11-22 23:07:50 +01:00
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
ViewDisassembler::ViewDisassembler() : View("hex.builtin.view.disassembler.name") {
|
2021-03-27 11:36:36 +01:00
|
|
|
EventManager::subscribe<EventDataChanged>(this, [this]() {
|
2021-02-22 11:56:33 +01:00
|
|
|
this->disassemble();
|
2020-11-22 23:07:50 +01:00
|
|
|
});
|
2020-11-28 16:15:12 +01:00
|
|
|
|
2021-03-27 11:36:36 +01:00
|
|
|
EventManager::subscribe<EventRegionSelected>(this, [this](Region region) {
|
2020-11-28 16:15:12 +01:00
|
|
|
if (this->m_shouldMatchSelection) {
|
2021-09-20 23:40:36 +02:00
|
|
|
if (region.address == size_t(-1)) {
|
|
|
|
this->m_codeRegion[0] = this->m_codeRegion[1] = 0;
|
|
|
|
} else {
|
|
|
|
this->m_codeRegion[0] = region.address;
|
|
|
|
this->m_codeRegion[1] = region.address + region.size;
|
|
|
|
}
|
2020-11-28 16:15:12 +01:00
|
|
|
}
|
|
|
|
});
|
2021-12-05 22:09:43 +01:00
|
|
|
|
|
|
|
EventManager::subscribe<EventFileUnloaded>(this, [this]{
|
|
|
|
this->m_disassembly.clear();
|
|
|
|
});
|
2020-11-22 23:07:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ViewDisassembler::~ViewDisassembler() {
|
2021-03-27 11:36:36 +01:00
|
|
|
EventManager::unsubscribe<EventDataChanged>(this);
|
|
|
|
EventManager::unsubscribe<EventRegionSelected>(this);
|
2021-12-05 22:09:43 +01:00
|
|
|
EventManager::unsubscribe<EventFileUnloaded>(this);
|
2020-11-22 23:07:50 +01:00
|
|
|
}
|
|
|
|
|
2021-02-22 11:56:33 +01:00
|
|
|
void ViewDisassembler::disassemble() {
|
|
|
|
this->m_disassembly.clear();
|
|
|
|
this->m_disassembling = true;
|
2020-11-22 23:07:50 +01:00
|
|
|
|
2021-02-22 11:56:33 +01:00
|
|
|
std::thread([this] {
|
2020-11-22 23:07:50 +01:00
|
|
|
csh capstoneHandle;
|
|
|
|
cs_insn *instructions = nullptr;
|
|
|
|
|
|
|
|
cs_mode mode = cs_mode(this->m_modeBasicARM | this->m_modeExtraARM | this->m_modeBasicMIPS | this->m_modeBasicX86 | this->m_modeBasicPPC);
|
|
|
|
|
|
|
|
if (this->m_littleEndianMode)
|
|
|
|
mode = cs_mode(mode | CS_MODE_LITTLE_ENDIAN);
|
|
|
|
else
|
|
|
|
mode = cs_mode(mode | CS_MODE_BIG_ENDIAN);
|
|
|
|
|
|
|
|
if (this->m_micoMode)
|
|
|
|
mode = cs_mode(mode | CS_MODE_MICRO);
|
|
|
|
|
|
|
|
if (this->m_sparcV9Mode)
|
|
|
|
mode = cs_mode(mode | CS_MODE_V9);
|
|
|
|
|
2020-12-05 17:32:30 +01:00
|
|
|
if (cs_open(Disassembler::toCapstoneArchictecture(this->m_architecture), mode, &capstoneHandle) == CS_ERR_OK) {
|
2020-11-22 23:07:50 +01:00
|
|
|
|
2021-05-23 23:04:20 +02:00
|
|
|
cs_option(capstoneHandle, CS_OPT_SKIPDATA, CS_OPT_ON);
|
|
|
|
|
2021-09-21 02:29:54 +02:00
|
|
|
auto provider = ImHexApi::Provider::get();
|
2020-11-22 23:07:50 +01:00
|
|
|
std::vector<u8> buffer(2048, 0x00);
|
2021-12-16 23:48:52 +01:00
|
|
|
size_t size = (this->m_codeRegion[1] - this->m_codeRegion[0] + 1);
|
|
|
|
|
|
|
|
auto task = ImHexApi::Tasks::createTask("hex.builtin.view.disassembler.disassembling", size);
|
|
|
|
for (u64 address = 0; address < size; address += 2048) {
|
|
|
|
task.update(address);
|
|
|
|
|
2020-11-28 16:15:12 +01:00
|
|
|
size_t bufferSize = std::min(u64(2048), (this->m_codeRegion[1] - this->m_codeRegion[0] + 1) - address);
|
2020-12-27 15:39:06 +01:00
|
|
|
provider->read(this->m_codeRegion[0] + address, buffer.data(), bufferSize);
|
2020-11-22 23:07:50 +01:00
|
|
|
|
2020-11-28 16:15:12 +01:00
|
|
|
size_t instructionCount = cs_disasm(capstoneHandle, buffer.data(), bufferSize, this->m_baseAddress + address, 0, &instructions);
|
2020-11-22 23:07:50 +01:00
|
|
|
|
|
|
|
if (instructionCount == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
u64 usedBytes = 0;
|
|
|
|
for (u32 instr = 0; instr < instructionCount; instr++) {
|
|
|
|
Disassembly disassembly = { 0 };
|
|
|
|
disassembly.address = instructions[instr].address;
|
2020-11-28 16:15:12 +01:00
|
|
|
disassembly.offset = this->m_codeRegion[0] + address + usedBytes;
|
2020-11-23 13:10:14 +01:00
|
|
|
disassembly.size = instructions[instr].size;
|
2020-11-23 15:22:26 +01:00
|
|
|
disassembly.mnemonic = instructions[instr].mnemonic;
|
|
|
|
disassembly.operators = instructions[instr].op_str;
|
2020-11-22 23:07:50 +01:00
|
|
|
|
2022-01-15 14:14:53 +01:00
|
|
|
for (u16 i = 0; i < instructions[instr].size; i++)
|
2021-03-03 19:58:22 +01:00
|
|
|
disassembly.bytes += hex::format("{0:02X} ", instructions[instr].bytes[i]);
|
2020-11-22 23:07:50 +01:00
|
|
|
disassembly.bytes.pop_back();
|
|
|
|
|
|
|
|
this->m_disassembly.push_back(disassembly);
|
|
|
|
|
|
|
|
usedBytes += instructions[instr].size;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (instructionCount < bufferSize)
|
|
|
|
address -= (bufferSize - usedBytes);
|
|
|
|
|
|
|
|
cs_free(instructions, instructionCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
cs_close(&capstoneHandle);
|
|
|
|
}
|
|
|
|
|
2021-02-22 11:56:33 +01:00
|
|
|
this->m_disassembling = false;
|
|
|
|
}).detach();
|
2020-11-22 23:07:50 +01:00
|
|
|
|
2021-02-22 11:56:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ViewDisassembler::drawContent() {
|
2020-11-22 23:07:50 +01:00
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
if (ImGui::Begin(View::toWindowName("hex.builtin.view.disassembler.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
2020-11-22 23:07:50 +01:00
|
|
|
|
2021-09-21 02:29:54 +02:00
|
|
|
auto provider = ImHexApi::Provider::get();
|
|
|
|
if (ImHexApi::Provider::isValid() && provider->isReadable()) {
|
2021-12-07 22:47:41 +01:00
|
|
|
ImGui::TextUnformatted("hex.builtin.view.disassembler.position"_lang);
|
2020-11-28 16:15:12 +01:00
|
|
|
ImGui::Separator();
|
2020-11-22 23:07:50 +01:00
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
ImGui::InputScalar("hex.builtin.view.disassembler.base"_lang, ImGuiDataType_U64, &this->m_baseAddress, nullptr, nullptr, "%08llX", ImGuiInputTextFlags_CharsHexadecimal);
|
|
|
|
ImGui::InputScalarN("hex.builtin.view.disassembler.region"_lang, ImGuiDataType_U64, this->m_codeRegion, 2, nullptr, nullptr, "%08llX", ImGuiInputTextFlags_CharsHexadecimal);
|
2021-05-23 22:46:33 +02:00
|
|
|
|
2021-02-11 23:09:45 +01:00
|
|
|
ImGui::Checkbox("hex.common.match_selection"_lang, &this->m_shouldMatchSelection);
|
2021-05-23 22:46:33 +02:00
|
|
|
if (ImGui::IsItemEdited()) {
|
|
|
|
// Force execution of Region Selection Event
|
|
|
|
EventManager::post<RequestSelectionChange>(Region{ 0, 0 });
|
|
|
|
}
|
2020-11-22 23:07:50 +01:00
|
|
|
|
|
|
|
ImGui::NewLine();
|
2021-12-07 22:47:41 +01:00
|
|
|
ImGui::TextUnformatted("hex.builtin.view.disassembler.settings.header"_lang);
|
2020-11-22 23:07:50 +01:00
|
|
|
ImGui::Separator();
|
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
ImGui::Combo("hex.builtin.view.disassembler.arch"_lang, reinterpret_cast<int*>(&this->m_architecture), Disassembler::ArchitectureNames, Disassembler::getArchitectureSupportedCount());
|
2020-11-22 23:07:50 +01:00
|
|
|
|
|
|
|
|
2021-02-25 21:51:12 +01:00
|
|
|
if (ImGui::BeginChild("modes", ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 6), true, ImGuiWindowFlags_AlwaysAutoResize)) {
|
2020-11-22 23:07:50 +01:00
|
|
|
|
2021-02-11 23:09:45 +01:00
|
|
|
if (ImGui::RadioButton("hex.common.little_endian"_lang, this->m_littleEndianMode))
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_littleEndianMode = true;
|
|
|
|
ImGui::SameLine();
|
2021-02-11 23:09:45 +01:00
|
|
|
if (ImGui::RadioButton("hex.common.big_endian"_lang, !this->m_littleEndianMode))
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_littleEndianMode = false;
|
|
|
|
|
|
|
|
ImGui::NewLine();
|
|
|
|
|
|
|
|
switch (this->m_architecture) {
|
2020-12-05 17:32:30 +01:00
|
|
|
case Architecture::ARM:
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeBasicMIPS = cs_mode(0);
|
|
|
|
this->m_modeBasicX86 = cs_mode(0);
|
|
|
|
this->m_modeBasicPPC = cs_mode(0);
|
|
|
|
this->m_micoMode = false;
|
|
|
|
this->m_sparcV9Mode = false;
|
|
|
|
|
2020-11-23 13:10:14 +01:00
|
|
|
if (this->m_modeBasicARM == cs_mode(0))
|
|
|
|
this->m_modeBasicARM = CS_MODE_ARM;
|
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
if (ImGui::RadioButton("hex.builtin.view.disassembler.arm.arm"_lang, this->m_modeBasicARM == CS_MODE_ARM))
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeBasicARM = CS_MODE_ARM;
|
|
|
|
ImGui::SameLine();
|
2021-12-07 22:47:41 +01:00
|
|
|
if (ImGui::RadioButton("hex.builtin.view.disassembler.arm.thumb"_lang, this->m_modeBasicARM == CS_MODE_THUMB))
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeBasicARM = CS_MODE_THUMB;
|
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
if (ImGui::RadioButton("hex.builtin.view.disassembler.arm.default"_lang, (this->m_modeExtraARM & (CS_MODE_MCLASS | CS_MODE_V8)) == 0))
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeExtraARM = cs_mode(0);
|
|
|
|
ImGui::SameLine();
|
2021-12-07 22:47:41 +01:00
|
|
|
if (ImGui::RadioButton("hex.builtin.view.disassembler.arm.cortex_m"_lang, (this->m_modeExtraARM & (CS_MODE_MCLASS | CS_MODE_V8)) == CS_MODE_MCLASS))
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeExtraARM = CS_MODE_MCLASS;
|
|
|
|
ImGui::SameLine();
|
2021-12-07 22:47:41 +01:00
|
|
|
if (ImGui::RadioButton("hex.builtin.view.disassembler.arm.armv8"_lang, (this->m_modeExtraARM & (CS_MODE_MCLASS | CS_MODE_V8)) == CS_MODE_V8))
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeExtraARM = CS_MODE_V8;
|
|
|
|
break;
|
2020-12-05 17:32:30 +01:00
|
|
|
case Architecture::MIPS:
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeBasicARM = cs_mode(0);
|
|
|
|
this->m_modeExtraARM = cs_mode(0);
|
|
|
|
this->m_modeBasicX86 = cs_mode(0);
|
|
|
|
this->m_modeBasicPPC = cs_mode(0);
|
|
|
|
this->m_sparcV9Mode = false;
|
|
|
|
|
2020-11-23 13:10:14 +01:00
|
|
|
if (this->m_modeBasicMIPS == cs_mode(0))
|
|
|
|
this->m_modeBasicMIPS = CS_MODE_MIPS32;
|
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
if (ImGui::RadioButton("hex.builtin.view.disassembler.mips.mips32"_lang, this->m_modeBasicMIPS == CS_MODE_MIPS32))
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeBasicMIPS = CS_MODE_MIPS32;
|
|
|
|
ImGui::SameLine();
|
2021-12-07 22:47:41 +01:00
|
|
|
if (ImGui::RadioButton("hex.builtin.view.disassembler.mips.mips64"_lang, this->m_modeBasicMIPS == CS_MODE_MIPS64))
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeBasicMIPS = CS_MODE_MIPS64;
|
|
|
|
ImGui::SameLine();
|
2021-12-07 22:47:41 +01:00
|
|
|
if (ImGui::RadioButton("hex.builtin.view.disassembler.mips.mips32R6"_lang, this->m_modeBasicMIPS == CS_MODE_MIPS32R6))
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeBasicMIPS = CS_MODE_MIPS32R6;
|
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
ImGui::Checkbox("hex.builtin.view.disassembler.mips.micro"_lang, &this->m_micoMode);
|
2020-11-22 23:07:50 +01:00
|
|
|
break;
|
2020-12-05 17:32:30 +01:00
|
|
|
case Architecture::X86:
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeBasicARM = cs_mode(0);
|
|
|
|
this->m_modeExtraARM = cs_mode(0);
|
|
|
|
this->m_modeBasicMIPS = cs_mode(0);
|
|
|
|
this->m_modeBasicPPC = cs_mode(0);
|
|
|
|
this->m_micoMode = false;
|
|
|
|
this->m_sparcV9Mode = false;
|
|
|
|
|
2020-11-23 13:10:14 +01:00
|
|
|
if (this->m_modeBasicX86 == cs_mode(0))
|
|
|
|
this->m_modeBasicX86 = CS_MODE_16;
|
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
if (ImGui::RadioButton("hex.builtin.view.disassembler.x86.16bit"_lang, this->m_modeBasicX86 == CS_MODE_16))
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeBasicX86 = CS_MODE_16;
|
|
|
|
ImGui::SameLine();
|
2021-12-07 22:47:41 +01:00
|
|
|
if (ImGui::RadioButton("hex.builtin.view.disassembler.x86.32bit"_lang, this->m_modeBasicX86 == CS_MODE_32))
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeBasicX86 = CS_MODE_32;
|
|
|
|
ImGui::SameLine();
|
2021-12-07 22:47:41 +01:00
|
|
|
if (ImGui::RadioButton("hex.builtin.view.disassembler.x86.64bit"_lang, this->m_modeBasicX86 == CS_MODE_64))
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeBasicX86 = CS_MODE_64;
|
|
|
|
break;
|
2020-12-05 17:32:30 +01:00
|
|
|
case Architecture::PPC:
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeBasicARM = cs_mode(0);
|
|
|
|
this->m_modeExtraARM = cs_mode(0);
|
|
|
|
this->m_modeBasicMIPS = cs_mode(0);
|
|
|
|
this->m_modeBasicX86 = cs_mode(0);
|
|
|
|
this->m_micoMode = false;
|
|
|
|
this->m_sparcV9Mode = false;
|
|
|
|
|
2020-11-23 13:10:14 +01:00
|
|
|
if (m_modeBasicPPC == cs_mode(0))
|
|
|
|
this->m_modeBasicPPC = CS_MODE_32;
|
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
if (ImGui::RadioButton("hex.builtin.view.disassembler.ppc.32bit"_lang, this->m_modeBasicPPC == CS_MODE_32))
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeBasicPPC = CS_MODE_32;
|
|
|
|
ImGui::SameLine();
|
2021-12-07 22:47:41 +01:00
|
|
|
if (ImGui::RadioButton("hex.builtin.view.disassembler.ppc.64bit"_lang, this->m_modeBasicPPC == CS_MODE_64))
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeBasicPPC = CS_MODE_64;
|
|
|
|
break;
|
2020-12-05 17:32:30 +01:00
|
|
|
case Architecture::SPARC:
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeBasicARM = cs_mode(0);
|
|
|
|
this->m_modeExtraARM = cs_mode(0);
|
|
|
|
this->m_modeBasicMIPS = cs_mode(0);
|
|
|
|
this->m_modeBasicX86 = cs_mode(0);
|
|
|
|
this->m_modeBasicPPC = cs_mode(0);
|
|
|
|
this->m_micoMode = false;
|
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
ImGui::Checkbox("hex.builtin.view.disassembler.sparc.v9"_lang, &this->m_sparcV9Mode);
|
2020-11-22 23:07:50 +01:00
|
|
|
break;
|
2020-12-05 17:32:30 +01:00
|
|
|
case Architecture::ARM64:
|
|
|
|
case Architecture::SYSZ:
|
|
|
|
case Architecture::XCORE:
|
|
|
|
case Architecture::M68K:
|
|
|
|
case Architecture::TMS320C64X:
|
|
|
|
case Architecture::M680X:
|
|
|
|
case Architecture::EVM:
|
2020-11-22 23:07:50 +01:00
|
|
|
this->m_modeBasicARM = cs_mode(0);
|
|
|
|
this->m_modeExtraARM = cs_mode(0);
|
|
|
|
this->m_modeBasicMIPS = cs_mode(0);
|
|
|
|
this->m_modeBasicX86 = cs_mode(0);
|
|
|
|
this->m_modeBasicPPC = cs_mode(0);
|
|
|
|
this->m_micoMode = false;
|
|
|
|
this->m_sparcV9Mode = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2021-08-28 16:02:53 +02:00
|
|
|
ImGui::EndChild();
|
2020-11-22 23:07:50 +01:00
|
|
|
|
2021-02-22 11:56:33 +01:00
|
|
|
ImGui::Disabled([this] {
|
2021-12-07 22:47:41 +01:00
|
|
|
if (ImGui::Button("hex.builtin.view.disassembler.disassemble"_lang))
|
2021-02-22 11:56:33 +01:00
|
|
|
this->disassemble();
|
|
|
|
}, this->m_disassembling);
|
|
|
|
|
|
|
|
if (this->m_disassembling) {
|
|
|
|
ImGui::SameLine();
|
2021-12-07 22:47:41 +01:00
|
|
|
ImGui::TextSpinner("hex.builtin.view.disassembler.disassembling"_lang);
|
2021-02-22 11:56:33 +01:00
|
|
|
}
|
|
|
|
|
2020-11-22 23:07:50 +01:00
|
|
|
ImGui::NewLine();
|
2020-11-28 16:15:12 +01:00
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
ImGui::TextUnformatted("hex.builtin.view.disassembler.disassembly.title"_lang);
|
2020-11-22 23:07:50 +01:00
|
|
|
ImGui::Separator();
|
|
|
|
|
2020-11-23 15:22:26 +01:00
|
|
|
if (ImGui::BeginTable("##disassembly", 4, ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg | ImGuiTableFlags_Reorderable)) {
|
|
|
|
ImGui::TableSetupScrollFreeze(0, 1);
|
2021-12-07 22:47:41 +01:00
|
|
|
ImGui::TableSetupColumn("hex.builtin.view.disassembler.disassembly.address"_lang);
|
|
|
|
ImGui::TableSetupColumn("hex.builtin.view.disassembler.disassembly.offset"_lang);
|
|
|
|
ImGui::TableSetupColumn("hex.builtin.view.disassembler.disassembly.bytes"_lang);
|
|
|
|
ImGui::TableSetupColumn("hex.builtin.view.disassembler.disassembly.title"_lang);
|
2020-11-23 15:22:26 +01:00
|
|
|
|
2022-01-10 21:38:52 +01:00
|
|
|
if (!this->m_disassembling) {
|
|
|
|
ImGuiListClipper clipper;
|
|
|
|
clipper.Begin(this->m_disassembly.size());
|
|
|
|
|
|
|
|
ImGui::TableHeadersRow();
|
|
|
|
while (clipper.Step()) {
|
|
|
|
for (u64 i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) {
|
|
|
|
const auto &instruction = this->m_disassembly[i];
|
|
|
|
ImGui::TableNextRow();
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
if (ImGui::Selectable(("##DisassemblyLine"s + std::to_string(i)).c_str(), false, ImGuiSelectableFlags_SpanAllColumns)) {
|
|
|
|
EventManager::post<RequestSelectionChange>(Region { instruction.offset, instruction.size });
|
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::TextFormatted("0x{0:X}", instruction.address);
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::TextFormatted("0x{0:X}", instruction.offset);
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::TextUnformatted(instruction.bytes.c_str());
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::TextFormattedColored(ImColor(0xFFD69C56), "{}", instruction.mnemonic);
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::TextUnformatted(instruction.operators.c_str());
|
2020-11-22 23:07:50 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-10 21:38:52 +01:00
|
|
|
clipper.End();
|
|
|
|
}
|
2020-11-22 23:07:50 +01:00
|
|
|
|
2020-11-23 15:22:26 +01:00
|
|
|
ImGui::EndTable();
|
2020-11-22 23:07:50 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ImGui::End();
|
|
|
|
}
|
|
|
|
|
2020-12-22 18:10:01 +01:00
|
|
|
void ViewDisassembler::drawMenu() {
|
2020-11-23 23:57:19 +01:00
|
|
|
|
2020-11-22 23:07:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|