debugger: allow printing registers using logging breakpoint placeholders (#1510)

This allows a savy user, developer or modder to change the comment field of a logging breakpoint to include placeholders such as {r3} or {f3} to log the register values whenever that code is hit.
This commit is contained in:
Crementif 2025-03-07 23:40:17 +01:00 committed by GitHub
parent 31d2db6f78
commit 186e92221a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 78 additions and 17 deletions

View file

@ -202,14 +202,14 @@ void BreakpointWindow::OnLeftDClick(wxMouseEvent& event)
auto it = debuggerState.breakpoints.begin();
std::advance(it, index);
wxTextEntryDialog set_value_dialog(this, _("Enter a new comment."), wxString::Format(_("Set comment for breakpoint at address %08x"), address), (*it)->comment);
if (set_value_dialog.ShowModal() == wxID_OK)
const wxString dialogTitle = (*it)->bpType == DEBUGGER_BP_T_LOGGING ? _("Enter a new logging message") : _("Enter a new comment");
const wxString dialogMessage = (*it)->bpType == DEBUGGER_BP_T_LOGGING ? _("Set logging message when code at address %08x is ran.\nUse placeholders like {r3} or {f3} to log register values") : _("Set comment for breakpoint at address %08x");
wxTextEntryDialog set_comment_dialog(this, dialogMessage, dialogTitle, (*it)->comment);
if (set_comment_dialog.ShowModal() == wxID_OK)
{
(*it)->comment = set_value_dialog.GetValue().ToStdWstring();
m_breakpoints->SetItem(index, ColumnComment, set_value_dialog.GetValue());
(*it)->comment = set_comment_dialog.GetValue().ToStdWstring();
m_breakpoints->SetItem(index, ColumnComment, set_comment_dialog.GetValue());
}
return;
}
}