mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-11 01:08:30 +12:00
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:
parent
31d2db6f78
commit
186e92221a
5 changed files with 78 additions and 17 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -538,7 +538,7 @@ void DisasmCtrl::OnKeyPressed(sint32 key_code, const wxPoint& position)
|
|||
auto optVirtualAddress = LinePixelPosToAddress(position.y);
|
||||
switch (key_code)
|
||||
{
|
||||
case WXK_F9:
|
||||
case WXK_F9:
|
||||
{
|
||||
if (optVirtualAddress)
|
||||
{
|
||||
|
@ -549,7 +549,7 @@ void DisasmCtrl::OnKeyPressed(sint32 key_code, const wxPoint& position)
|
|||
}
|
||||
return;
|
||||
}
|
||||
case 'G':
|
||||
case 'G':
|
||||
{
|
||||
if(IsKeyDown(WXK_CONTROL))
|
||||
{
|
||||
|
@ -686,6 +686,7 @@ void DisasmCtrl::OnContextMenu(const wxPoint& position, uint32 line)
|
|||
// show dialog
|
||||
wxMenu menu;
|
||||
menu.Append(IDContextMenu_ToggleBreakpoint, _("Toggle breakpoint"));
|
||||
menu.Append(IDContextMenu_ToggleLoggingBreakpoint, _("Toggle logging point"));
|
||||
if(debugger_hasPatch(virtualAddress))
|
||||
menu.Append(IDContextMenu_RestoreOriginalInstructions, _("Restore original instructions"));
|
||||
menu.AppendSeparator();
|
||||
|
@ -707,6 +708,13 @@ void DisasmCtrl::OnContextMenuEntryClicked(wxCommandEvent& event)
|
|||
wxPostEvent(this->m_parent, evt);
|
||||
break;
|
||||
}
|
||||
case IDContextMenu_ToggleLoggingBreakpoint:
|
||||
{
|
||||
debugger_toggleLoggingBreakpoint(m_contextMenuAddress);
|
||||
wxCommandEvent evt(wxEVT_BREAKPOINT_CHANGE);
|
||||
wxPostEvent(this->m_parent, evt);
|
||||
break;
|
||||
}
|
||||
case IDContextMenu_RestoreOriginalInstructions:
|
||||
{
|
||||
debugger_removePatch(m_contextMenuAddress);
|
||||
|
|
|
@ -8,6 +8,7 @@ class DisasmCtrl : public TextList
|
|||
enum
|
||||
{
|
||||
IDContextMenu_ToggleBreakpoint = wxID_HIGHEST + 1,
|
||||
IDContextMenu_ToggleLoggingBreakpoint,
|
||||
IDContextMenu_RestoreOriginalInstructions,
|
||||
IDContextMenu_CopyAddress,
|
||||
IDContextMenu_CopyUnrelocatedAddress,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue