2020-11-22 23:07:50 +01:00
|
|
|
#pragma once
|
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
#include <hex/ui/view.hpp>
|
2021-01-13 17:28:27 +01:00
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
#include <hex/helpers/disassembler.hpp>
|
2020-11-22 23:07:50 +01:00
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
namespace hex::plugin::builtin {
|
2020-11-22 23:07:50 +01:00
|
|
|
|
2022-01-24 20:53:17 +01:00
|
|
|
namespace prv {
|
|
|
|
class Provider;
|
|
|
|
}
|
2020-11-22 23:07:50 +01:00
|
|
|
|
|
|
|
struct Disassembly {
|
|
|
|
u64 address;
|
|
|
|
u64 offset;
|
2020-11-23 13:10:14 +01:00
|
|
|
size_t size;
|
2020-11-22 23:07:50 +01:00
|
|
|
std::string bytes;
|
2020-11-23 15:22:26 +01:00
|
|
|
std::string mnemonic;
|
|
|
|
std::string operators;
|
2020-11-22 23:07:50 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class ViewDisassembler : public View {
|
|
|
|
public:
|
2020-12-27 15:39:06 +01:00
|
|
|
explicit ViewDisassembler();
|
2020-11-22 23:07:50 +01:00
|
|
|
~ViewDisassembler() override;
|
|
|
|
|
2020-12-22 18:10:01 +01:00
|
|
|
void drawContent() override;
|
2020-11-22 23:07:50 +01:00
|
|
|
|
|
|
|
private:
|
2021-02-22 11:56:33 +01:00
|
|
|
bool m_disassembling = false;
|
2020-11-22 23:07:50 +01:00
|
|
|
|
|
|
|
u64 m_baseAddress = 0;
|
2020-11-28 16:15:12 +01:00
|
|
|
u64 m_codeRegion[2] = { 0 };
|
|
|
|
bool m_shouldMatchSelection = false;
|
2020-11-22 23:07:50 +01:00
|
|
|
|
2020-12-05 17:32:30 +01:00
|
|
|
Architecture m_architecture = Architecture::ARM;
|
2022-01-24 23:56:02 +01:00
|
|
|
cs_mode m_mode = cs_mode(0);
|
2020-11-22 23:07:50 +01:00
|
|
|
|
|
|
|
std::vector<Disassembly> m_disassembly;
|
|
|
|
|
2021-02-22 11:56:33 +01:00
|
|
|
void disassemble();
|
2020-11-22 23:07:50 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|