Advanced disassembly viewer with sparse storage and interactive features. More...
#include <disassembly_viewer.h>
Public Member Functions | |
DisassemblyViewer ()=default | |
~DisassemblyViewer ()=default | |
void | RecordInstruction (uint32_t address, uint8_t opcode, const std::vector< uint8_t > &operands, const std::string &mnemonic, const std::string &operand_str) |
Record an instruction execution. | |
void | Render (uint32_t current_pc, const std::vector< uint32_t > &breakpoints) |
Render the disassembly viewer UI. | |
void | Clear () |
Clear all recorded instructions. | |
size_t | GetInstructionCount () const |
Get the number of unique instructions recorded. | |
bool | ExportToFile (const std::string &filepath) const |
Export disassembly to file. | |
void | JumpToAddress (uint32_t address) |
Jump to a specific address in the viewer. | |
void | SetAutoScroll (bool enabled) |
Set whether to auto-scroll to current PC. | |
std::vector< uint32_t > | GetSortedAddresses () const |
Get sorted list of addresses for rendering. | |
bool | IsAvailable () const |
Check if the disassembly viewer is available. | |
void | SetRecording (bool enabled) |
Enable/disable recording (for performance) | |
bool | IsRecording () const |
void | SetMaxInstructions (size_t max) |
Set maximum number of instructions to keep. | |
void | TrimToSize (size_t target_size) |
Clear old instructions to save memory. | |
Private Member Functions | |
void | RenderToolbar () |
void | RenderDisassemblyTable (uint32_t current_pc, const std::vector< uint32_t > &breakpoints) |
void | RenderContextMenu (uint32_t address) |
void | RenderSearchBar () |
ImVec4 | GetAddressColor (const DisassemblyEntry &entry, uint32_t current_pc) const |
ImVec4 | GetMnemonicColor (const DisassemblyEntry &entry) const |
std::string | FormatHexDump (const DisassemblyEntry &entry) const |
bool | PassesFilter (const DisassemblyEntry &entry) const |
Private Attributes | |
std::map< uint32_t, DisassemblyEntry > | instructions_ |
bool | recording_enabled_ = true |
size_t | max_instructions_ = 10000 |
char | search_filter_ [256] = "" |
uint32_t | selected_address_ = 0 |
uint32_t | scroll_to_address_ = 0 |
bool | auto_scroll_ = true |
bool | show_execution_counts_ = true |
bool | show_hex_dump_ = true |
Advanced disassembly viewer with sparse storage and interactive features.
This viewer provides a professional disassembly interface similar to modern debuggers and ROM hacking tools. Features include:
Definition at line 50 of file disassembly_viewer.h.
|
default |
|
default |
void yaze::emu::debug::DisassemblyViewer::RecordInstruction | ( | uint32_t | address, |
uint8_t | opcode, | ||
const std::vector< uint8_t > & | operands, | ||
const std::string & | mnemonic, | ||
const std::string & | operand_str | ||
) |
Record an instruction execution.
address | Full 24-bit address |
opcode | The opcode byte |
operands | Vector of operand bytes |
mnemonic | Instruction mnemonic |
operand_str | Formatted operand string |
Definition at line 30 of file disassembly_viewer.cc.
References yaze::emu::debug::DisassemblyEntry::address, yaze::emu::debug::DisassemblyEntry::execution_count, instructions_, yaze::emu::debug::DisassemblyEntry::is_breakpoint, yaze::emu::debug::DisassemblyEntry::is_current_pc, max_instructions_, yaze::emu::debug::DisassemblyEntry::mnemonic, yaze::emu::debug::DisassemblyEntry::opcode, yaze::emu::debug::DisassemblyEntry::operand_str, yaze::emu::debug::DisassemblyEntry::operands, recording_enabled_, yaze::emu::debug::DisassemblyEntry::size, and TrimToSize().
Referenced by yaze::emu::Emulator::Initialize().
void yaze::emu::debug::DisassemblyViewer::Render | ( | uint32_t | current_pc, |
const std::vector< uint32_t > & | breakpoints | ||
) |
Render the disassembly viewer UI.
current_pc | Current program counter (24-bit) |
breakpoints | List of breakpoint addresses |
Definition at line 89 of file disassembly_viewer.cc.
References instructions_, RenderDisassemblyTable(), RenderSearchBar(), and RenderToolbar().
void yaze::emu::debug::DisassemblyViewer::Clear | ( | ) |
Clear all recorded instructions.
Definition at line 418 of file disassembly_viewer.cc.
References instructions_, scroll_to_address_, and selected_address_.
Referenced by RenderToolbar().
|
inline |
Get the number of unique instructions recorded.
Definition at line 83 of file disassembly_viewer.h.
References instructions_.
Referenced by yaze::emu::ui::RenderCpuInstructionLog().
bool yaze::emu::debug::DisassemblyViewer::ExportToFile | ( | const std::string & | filepath | ) | const |
Export disassembly to file.
filepath | Path to output file |
Definition at line 424 of file disassembly_viewer.cc.
References FormatHexDump(), GetSortedAddresses(), and instructions_.
Referenced by RenderToolbar().
void yaze::emu::debug::DisassemblyViewer::JumpToAddress | ( | uint32_t | address | ) |
Jump to a specific address in the viewer.
address | Address to jump to |
Definition at line 451 of file disassembly_viewer.cc.
References auto_scroll_, scroll_to_address_, and selected_address_.
Referenced by RenderContextMenu().
|
inline |
Set whether to auto-scroll to current PC.
Definition at line 101 of file disassembly_viewer.h.
References auto_scroll_.
std::vector< uint32_t > yaze::emu::debug::DisassemblyViewer::GetSortedAddresses | ( | ) | const |
Get sorted list of addresses for rendering.
Definition at line 457 of file disassembly_viewer.cc.
References instructions_.
Referenced by ExportToFile(), and RenderDisassemblyTable().
|
inline |
Check if the disassembly viewer is available.
Definition at line 111 of file disassembly_viewer.h.
References instructions_.
|
inline |
Enable/disable recording (for performance)
Definition at line 116 of file disassembly_viewer.h.
References recording_enabled_.
|
inline |
Definition at line 117 of file disassembly_viewer.h.
References recording_enabled_.
Referenced by yaze::emu::ui::RenderCpuInstructionLog().
|
inline |
Set maximum number of instructions to keep.
Definition at line 122 of file disassembly_viewer.h.
References max_instructions_.
void yaze::emu::debug::DisassemblyViewer::TrimToSize | ( | size_t | target_size | ) |
Clear old instructions to save memory.
Definition at line 66 of file disassembly_viewer.cc.
References instructions_.
Referenced by RecordInstruction().
|
private |
Definition at line 103 of file disassembly_viewer.cc.
References auto_scroll_, Clear(), ExportToFile(), ICON_MD_CLEAR_ALL, ICON_MD_MEMORY, ICON_MD_SAVE, instructions_, show_execution_counts_, and show_hex_dump_.
Referenced by Render().
|
private |
Definition at line 164 of file disassembly_viewer.cc.
References auto_scroll_, FormatHexDump(), GetAddressColor(), GetMnemonicColor(), GetSortedAddresses(), ICON_MD_CIRCLE, ICON_MD_STOP, ICON_MD_TRENDING_UP, instructions_, PassesFilter(), RenderContextMenu(), scroll_to_address_, selected_address_, show_execution_counts_, and show_hex_dump_.
Referenced by Render().
|
private |
Definition at line 300 of file disassembly_viewer.cc.
References ICON_MD_CONTENT_COPY, ICON_MD_FLAG, ICON_MD_INFO, ICON_MD_MY_LOCATION, instructions_, and JumpToAddress().
Referenced by RenderDisassemblyTable().
|
private |
Definition at line 155 of file disassembly_viewer.cc.
References ICON_MD_SEARCH, and search_filter_.
Referenced by Render().
|
private |
Definition at line 330 of file disassembly_viewer.cc.
References yaze::emu::debug::DisassemblyEntry::is_breakpoint, and yaze::emu::debug::DisassemblyEntry::is_current_pc.
Referenced by RenderDisassemblyTable().
|
private |
Definition at line 341 of file disassembly_viewer.cc.
References yaze::emu::debug::DisassemblyEntry::mnemonic.
Referenced by RenderDisassemblyTable().
|
private |
Definition at line 364 of file disassembly_viewer.cc.
References yaze::emu::debug::DisassemblyEntry::opcode, and yaze::emu::debug::DisassemblyEntry::operands.
Referenced by ExportToFile(), and RenderDisassemblyTable().
|
private |
Definition at line 384 of file disassembly_viewer.cc.
References yaze::emu::debug::DisassemblyEntry::address, yaze::emu::debug::DisassemblyEntry::mnemonic, yaze::emu::debug::DisassemblyEntry::operand_str, and search_filter_.
Referenced by RenderDisassemblyTable().
|
private |
Definition at line 131 of file disassembly_viewer.h.
Referenced by Clear(), ExportToFile(), GetInstructionCount(), GetSortedAddresses(), IsAvailable(), RecordInstruction(), Render(), RenderContextMenu(), RenderDisassemblyTable(), RenderToolbar(), and TrimToSize().
|
private |
Definition at line 134 of file disassembly_viewer.h.
Referenced by IsRecording(), RecordInstruction(), and SetRecording().
|
private |
Definition at line 135 of file disassembly_viewer.h.
Referenced by RecordInstruction(), and SetMaxInstructions().
|
private |
Definition at line 138 of file disassembly_viewer.h.
Referenced by PassesFilter(), and RenderSearchBar().
|
private |
Definition at line 139 of file disassembly_viewer.h.
Referenced by Clear(), JumpToAddress(), and RenderDisassemblyTable().
|
private |
Definition at line 140 of file disassembly_viewer.h.
Referenced by Clear(), JumpToAddress(), and RenderDisassemblyTable().
|
private |
Definition at line 141 of file disassembly_viewer.h.
Referenced by JumpToAddress(), RenderDisassemblyTable(), RenderToolbar(), and SetAutoScroll().
|
private |
Definition at line 142 of file disassembly_viewer.h.
Referenced by RenderDisassemblyTable(), and RenderToolbar().
|
private |
Definition at line 143 of file disassembly_viewer.h.
Referenced by RenderDisassemblyTable(), and RenderToolbar().