2020-11-22 22:07:50 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-01-13 16:28:27 +00:00
|
|
|
#include <hex/views/view.hpp>
|
|
|
|
|
2020-12-05 16:32:30 +00:00
|
|
|
#include "helpers/disassembler.hpp"
|
2020-11-22 22:07:50 +00:00
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace hex {
|
|
|
|
|
|
|
|
namespace prv { class Provider; }
|
|
|
|
|
|
|
|
struct Disassembly {
|
|
|
|
u64 address;
|
|
|
|
u64 offset;
|
2020-11-23 12:10:14 +00:00
|
|
|
size_t size;
|
2020-11-22 22:07:50 +00:00
|
|
|
std::string bytes;
|
2020-11-23 14:22:26 +00:00
|
|
|
std::string mnemonic;
|
|
|
|
std::string operators;
|
2020-11-22 22:07:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ViewDisassembler : public View {
|
|
|
|
public:
|
2020-12-27 14:39:06 +00:00
|
|
|
explicit ViewDisassembler();
|
2020-11-22 22:07:50 +00:00
|
|
|
~ViewDisassembler() override;
|
|
|
|
|
2020-12-22 17:10:01 +00:00
|
|
|
void drawContent() override;
|
|
|
|
void drawMenu() override;
|
2020-11-22 22:07:50 +00:00
|
|
|
|
|
|
|
private:
|
2021-02-22 10:56:33 +00:00
|
|
|
bool m_disassembling = false;
|
2020-11-22 22:07:50 +00:00
|
|
|
|
|
|
|
u64 m_baseAddress = 0;
|
2020-11-28 15:15:12 +00:00
|
|
|
u64 m_codeRegion[2] = { 0 };
|
|
|
|
bool m_shouldMatchSelection = false;
|
2020-11-22 22:07:50 +00:00
|
|
|
|
2020-12-05 16:32:30 +00:00
|
|
|
Architecture m_architecture = Architecture::ARM;
|
2020-11-22 22:07:50 +00:00
|
|
|
cs_mode m_modeBasicARM = cs_mode(0), m_modeExtraARM = cs_mode(0), m_modeBasicMIPS = cs_mode(0), m_modeBasicPPC = cs_mode(0), m_modeBasicX86 = cs_mode(0);
|
|
|
|
bool m_littleEndianMode = true, m_micoMode = false, m_sparcV9Mode = false;
|
|
|
|
|
|
|
|
std::vector<Disassembly> m_disassembly;
|
|
|
|
|
2021-02-22 10:56:33 +00:00
|
|
|
void disassemble();
|
2020-11-22 22:07:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|