diff options
author | Oxore <oxore@protonmail.com> | 2025-02-01 16:56:01 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2025-02-01 18:26:18 +0300 |
commit | c76658ccce753b26bd8dc751f7b7cdeef2ab5b43 (patch) | |
tree | 73dc241fc9da3f2f9db5f0543e7ee578040bebb7 /src/disasm.h | |
parent | 6769fca1dd90f4e34e1fd6b2256c3795bbcaf658 (diff) |
WIP
Diffstat (limited to 'src/disasm.h')
-rw-r--r-- | src/disasm.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/disasm.h b/src/disasm.h index 13109a5..a3c589b 100644 --- a/src/disasm.h +++ b/src/disasm.h @@ -168,7 +168,6 @@ struct Symbol { class DisasmMap { const DisasmMapType _type; DisasmNode **_map{static_cast<DisasmNode **>(calloc(kRomSizeBytes, sizeof(*_map)))}; - size_t _code_size{}; Symbol *_symtab{}; size_t _symtab_size{}; TraceTable _tt{}; @@ -176,6 +175,9 @@ class DisasmMap { constexpr size_t findFirstSymbolAtAddress( uint32_t address, bool return_last_considered=false) const; DisasmNode &insertNode(uint32_t address, NodeType); + DisasmNode &insertNodeQuickPeek(uint32_t address, NodeType); + /// Returns primary, secondary ceases to exist + DisasmNode *mergeNodes(DisasmNode *primary, DisasmNode *secondary); DisasmNode &insertReferencedBy( const uint32_t by_addr, const uint32_t ref_addr, @@ -183,6 +185,8 @@ class DisasmMap { const ReferenceType ref_type); constexpr bool canBeAllocated(const DisasmNode& node) const; constexpr size_t symbolsCount() const { return _symtab_size / sizeof *_symtab; } + void disasmQuickPeek(const DataView &code, const Settings &); + void disasmProper(const DataView &code, const Settings &, size_t from=0, bool nested=false); public: constexpr const Symbol *Symtab() const { return _symtab; } constexpr size_t SymbolsCount() const { return symbolsCount(); } @@ -195,7 +199,13 @@ public: void InsertNode(uint32_t address, NodeType type); bool ApplySymbolsFromElf(const ELF::Image &); void ConsumeTraceTable(TraceTable &&); - void Disasm(const DataView &code, const Settings &, size_t from=0, bool nested=false); + void Disasm(const DataView &code, const Settings &s) + { + if (_type == DisasmMapType::kTraced) { + return disasmProper(code, s, 0, false); + } + return disasmQuickPeek(code, s); + } DisasmMap(DisasmMapType type): _type(type) {} ~DisasmMap(); }; |