mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Debugger: Add formats to breakpoint logging.
This commit is contained in:
parent
901239c05e
commit
b92fab88b6
2 changed files with 49 additions and 9 deletions
|
@ -24,6 +24,7 @@
|
|||
#include "Core/Debugger/Breakpoints.h"
|
||||
#include "Core/Debugger/SymbolMap.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/MIPS/MIPSAnalyst.h"
|
||||
#include "Core/MIPS/MIPSDebugInterface.h"
|
||||
#include "Core/MIPS/JitCommon/JitCommon.h"
|
||||
|
@ -689,17 +690,55 @@ bool CBreakPoints::EvaluateLogFormat(DebugInterface *cpu, const std::string &fmt
|
|||
if (expression.empty()) {
|
||||
result += "{}";
|
||||
} else {
|
||||
int type = 'x';
|
||||
if (expression.length() > 2 && expression[expression.length() - 2] == ':') {
|
||||
switch (expression[expression.length() - 1]) {
|
||||
case 'd':
|
||||
case 'f':
|
||||
case 'p':
|
||||
case 's':
|
||||
case 'x':
|
||||
type = expression[expression.length() - 1];
|
||||
expression.resize(expression.length() - 2);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Assume a ternary.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!cpu->initExpression(expression.c_str(), exp)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
u32 expResult;
|
||||
char resultString[32];
|
||||
if (!cpu->parseExpression(exp, expResult)) {
|
||||
union {
|
||||
int i;
|
||||
u32 u;
|
||||
float f;
|
||||
} expResult;
|
||||
char resultString[256];
|
||||
if (!cpu->parseExpression(exp, expResult.u)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
snprintf(resultString, 32, "%08x", expResult);
|
||||
switch (type) {
|
||||
case 'd':
|
||||
snprintf(resultString, sizeof(resultString), "%d", expResult.i);
|
||||
break;
|
||||
case 'f':
|
||||
snprintf(resultString, sizeof(resultString), "%f", expResult.f);
|
||||
break;
|
||||
case 'p':
|
||||
snprintf(resultString, sizeof(resultString), "%08x[%08x]", expResult.u, Memory::IsValidAddress(expResult.u) ? Memory::Read_U32(expResult.u) : 0);
|
||||
break;
|
||||
case 's':
|
||||
snprintf(resultString, sizeof(resultString) - 1, "%s", Memory::IsValidAddress(expResult.u) ? Memory::GetCharPointer(expResult.u) : "(invalid)");
|
||||
break;
|
||||
case 'x':
|
||||
snprintf(resultString, sizeof(resultString), "%08x", expResult.u);
|
||||
break;
|
||||
}
|
||||
result += resultString;
|
||||
}
|
||||
|
||||
|
|
|
@ -351,7 +351,7 @@ BEGIN
|
|||
CONTROL "",IDC_TABDATATYPE,"SysTabControl32",TCS_BUTTONS,0,1,205,15
|
||||
END
|
||||
|
||||
IDD_BREAKPOINT DIALOGEX 0, 0, 236, 109
|
||||
IDD_BREAKPOINT DIALOGEX 0, 0, 236, 119
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Breakpoint"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
|
@ -369,10 +369,11 @@ BEGIN
|
|||
EDITTEXT IDC_BREAKPOINT_CONDITION,41,49,187,14,ES_AUTOHSCROLL
|
||||
LTEXT "Log fmt",IDC_STATIC,7,71,31,8
|
||||
EDITTEXT IDC_BREAKPOINT_LOG_FORMAT,41,69,187,14,ES_AUTOHSCROLL
|
||||
CONTROL "Break",IDC_BREAKPOINT_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,91,41,10
|
||||
CONTROL "Log",IDC_BREAKPOINT_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,91,27,10
|
||||
DEFPUSHBUTTON "OK",IDC_BREAKPOINT_OK,144,88,41,14
|
||||
PUSHBUTTON "Cancel",IDC_BREAKPOINT_CANCEL,186,88,42,14
|
||||
LTEXT "Use {a1+a2} or {s1:d} to log expressions",IDC_STATIC,41,85,187,8
|
||||
CONTROL "Break",IDC_BREAKPOINT_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,101,41,10
|
||||
CONTROL "Log",IDC_BREAKPOINT_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,101,27,10
|
||||
DEFPUSHBUTTON "OK",IDC_BREAKPOINT_OK,144,98,41,14
|
||||
PUSHBUTTON "Cancel",IDC_BREAKPOINT_CANCEL,186,98,42,14
|
||||
END
|
||||
|
||||
IDD_DUMPMEMORY DIALOGEX 0, 0, 230, 85
|
||||
|
|
Loading…
Add table
Reference in a new issue