From 040d9a43367f4e2a3aa57ddb47c41d5d13b5b39e Mon Sep 17 00:00:00 2001 From: TryTwo Date: Mon, 19 May 2025 23:13:00 -0700 Subject: Debugger symbols: Add new symbol type: Notes.. Notes are for naming single instructions, or small groups of instructions. Notes are separate from function symbols, and can be searched separately. Unlike functions, notes of different length can overlap each other. In the instruction window, a note will always display over the function symbol. --- Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp') diff --git a/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp b/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp index 1f5de76ff0..fd9155a680 100644 --- a/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp @@ -137,8 +137,9 @@ constexpr int CODE_VIEW_COLUMN_ADDRESS = 1; constexpr int CODE_VIEW_COLUMN_INSTRUCTION = 2; constexpr int CODE_VIEW_COLUMN_PARAMETERS = 3; constexpr int CODE_VIEW_COLUMN_DESCRIPTION = 4; -constexpr int CODE_VIEW_COLUMN_BRANCH_ARROWS = 5; -constexpr int CODE_VIEW_COLUMNCOUNT = 6; +constexpr int CODE_VIEW_COLUMN_NOTE = 5; +constexpr int CODE_VIEW_COLUMN_BRANCH_ARROWS = 6; +constexpr int CODE_VIEW_COLUMNCOUNT = 7; CodeViewWidget::CodeViewWidget() : m_system(Core::System::GetInstance()), m_ppc_symbol_db(m_system.GetPPCSymbolDB()) @@ -161,6 +162,7 @@ CodeViewWidget::CodeViewWidget() setHorizontalHeaderItem(CODE_VIEW_COLUMN_INSTRUCTION, new QTableWidgetItem(tr("Instr."))); setHorizontalHeaderItem(CODE_VIEW_COLUMN_PARAMETERS, new QTableWidgetItem(tr("Parameters"))); setHorizontalHeaderItem(CODE_VIEW_COLUMN_DESCRIPTION, new QTableWidgetItem(tr("Symbols"))); + setHorizontalHeaderItem(CODE_VIEW_COLUMN_NOTE, new QTableWidgetItem(tr("Notes"))); setHorizontalHeaderItem(CODE_VIEW_COLUMN_BRANCH_ARROWS, new QTableWidgetItem(tr("Branches"))); setFont(Settings::Instance().GetDebugFont()); @@ -333,6 +335,11 @@ void CodeViewWidget::Update(const Core::CPUThreadGuard* guard) std::string param = (split == std::string::npos ? "" : disas.substr(split + 1)); const std::string_view desc = debug_interface.GetDescription(addr); + const Common::Note* note = m_ppc_symbol_db.GetNoteFromAddr(addr); + std::string note_string; + if (note != nullptr) + note_string = note->name; + // Adds whitespace and a minimum size to ins and param. Helps to prevent frequent resizing while // scrolling. const QString ins_formatted = @@ -344,9 +351,11 @@ void CodeViewWidget::Update(const Core::CPUThreadGuard* guard) auto* ins_item = new QTableWidgetItem(ins_formatted); auto* param_item = new QTableWidgetItem(param_formatted); auto* description_item = new QTableWidgetItem(desc_formatted); + auto* note_item = new QTableWidgetItem(QString::fromStdString(note_string)); auto* branch_item = new QTableWidgetItem(); - for (auto* item : {bp_item, addr_item, ins_item, param_item, description_item, branch_item}) + for (auto* item : + {bp_item, addr_item, ins_item, param_item, description_item, note_item, branch_item}) { item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); item->setData(Qt::UserRole, addr); @@ -408,6 +417,7 @@ void CodeViewWidget::Update(const Core::CPUThreadGuard* guard) setItem(i, CODE_VIEW_COLUMN_INSTRUCTION, ins_item); setItem(i, CODE_VIEW_COLUMN_PARAMETERS, param_item); setItem(i, CODE_VIEW_COLUMN_DESCRIPTION, description_item); + setItem(i, CODE_VIEW_COLUMN_NOTE, note_item); setItem(i, CODE_VIEW_COLUMN_BRANCH_ARROWS, branch_item); if (addr == GetAddress()) @@ -416,6 +426,9 @@ void CodeViewWidget::Update(const Core::CPUThreadGuard* guard) } } + m_ppc_symbol_db.NoteExists() ? showColumn(CODE_VIEW_COLUMN_NOTE) : + hideColumn(CODE_VIEW_COLUMN_NOTE); + CalculateBranchIndentation(); m_ppc_symbol_db.FillInCallers(); -- cgit v1.2.3