mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-15 13:31:40 +00:00
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.
This commit is contained in:
parent
5eb61024c6
commit
040d9a4336
5 changed files with 122 additions and 5 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue