Skip to content

Commit

Permalink
Merge pull request hrydgard#19716 from hrydgard/more-debugger-work
Browse files Browse the repository at this point in the history
More debugger code cleanup
  • Loading branch information
hrydgard authored Dec 10, 2024
2 parents 5f68f81 + e114848 commit 2e39a88
Show file tree
Hide file tree
Showing 16 changed files with 554 additions and 537 deletions.
1 change: 1 addition & 0 deletions Common/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ enum class Log {
HTTP,
Printf,
TexReplacement,
GeDebugger,

sceAudio,
sceCtrl,
Expand Down
30 changes: 15 additions & 15 deletions Common/Log/LogManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,21 @@ static const char * const g_logTypeNames[] = {
"HTTP",
"PRINTF",
"TEXREPLACE",

"SCEAUDIO",
"SCECTRL",
"SCEDISP",
"SCEFONT",
"SCEGE",
"SCEINTC",
"SCEIO",
"SCEKERNEL",
"SCEMODULE",
"SCENET",
"SCERTC",
"SCESAS",
"SCEUTIL",
"SCEMISC",
"DEBUGGER",
"SCEAUDIO",
"SCECTRL",
"SCEDISP",
"SCEFONT",
"SCEGE",
"SCEINTC",
"SCEIO",
"SCEKERNEL",
"SCEMODULE",
"SCENET",
"SCERTC",
"SCESAS",
"SCEUTIL",
"SCEMISC",
};

void LogManager::Init(bool *enabledSetting, bool headless) {
Expand Down
14 changes: 7 additions & 7 deletions GPU/Common/GPUDebugInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ bool GEExpressionFunctions::parseReference(char *str, uint32_t &referenceIndex)
// For now, let's just support the register bits directly.
GECmdInfo info;
if (GECmdInfoByName(str, info)) {
referenceIndex = info.reg;
referenceIndex = info.cmd;
return true;
}

Expand Down Expand Up @@ -599,8 +599,8 @@ bool GEExpressionFunctions::parseFieldReference(const char *ref, const char *fie
}

for (const auto &entry : fieldNames) {
if (entry.fmt == info.fmt && strcasecmp(field, entry.name) == 0) {
referenceIndex = (info.reg << 12) | (uint32_t)entry.field;
if (entry.fmt == info.cmdFmt && strcasecmp(field, entry.name) == 0) {
referenceIndex = (info.cmd << 12) | (uint32_t)entry.field;
return true;
}
}
Expand All @@ -624,7 +624,7 @@ bool GEExpressionFunctions::parseSymbol(char *str, uint32_t &symbolValue) {
uint32_t GEExpressionFunctions::getReferenceValue(uint32_t referenceIndex) {
GPUgstate state = gpu_->GetGState();
if (referenceIndex < 0x100) {
GECmdFormat fmt = GECmdInfoByCmd(GECommand(referenceIndex)).fmt;
GECmdFormat fmt = GECmdInfoByCmd(GECommand(referenceIndex)).cmdFmt;
uint32_t value = state.cmdmem[referenceIndex];
if (fmt == GECmdFormat::FLOAT)
return value << 8;
Expand All @@ -633,7 +633,7 @@ uint32_t GEExpressionFunctions::getReferenceValue(uint32_t referenceIndex) {

if (referenceIndex >= (uint32_t)GEReferenceIndex::FIELD_START && referenceIndex <= (uint32_t)GEReferenceIndex::FIELD_END) {
uint32_t value = state.cmdmem[referenceIndex >> 12] & 0x00FFFFFF;
GECmdFormat fmt = GECmdInfoByCmd(GECommand(referenceIndex >> 12)).fmt;
GECmdFormat fmt = GECmdInfoByCmd(GECommand(referenceIndex >> 12)).cmdFmt;
return getFieldValue(fmt, GECmdField(referenceIndex & 0xFF), value);
}

Expand Down Expand Up @@ -898,14 +898,14 @@ uint32_t GEExpressionFunctions::getFieldValue(GECmdFormat fmt, GECmdField field,

ExpressionType GEExpressionFunctions::getReferenceType(uint32_t referenceIndex) {
if (referenceIndex < 0x100) {
GECmdFormat fmt = GECmdInfoByCmd(GECommand(referenceIndex)).fmt;
GECmdFormat fmt = GECmdInfoByCmd(GECommand(referenceIndex)).cmdFmt;
if (fmt == GECmdFormat::FLOAT)
return EXPR_TYPE_FLOAT;
return EXPR_TYPE_UINT;
}

if (referenceIndex >= (uint32_t)GEReferenceIndex::FIELD_START && referenceIndex <= (uint32_t)GEReferenceIndex::FIELD_END) {
GECmdFormat fmt = GECmdInfoByCmd(GECommand(referenceIndex >> 12)).fmt;
GECmdFormat fmt = GECmdInfoByCmd(GECommand(referenceIndex >> 12)).cmdFmt;
return getFieldType(fmt, GECmdField(referenceIndex & 0xFF));
}

Expand Down
1 change: 1 addition & 0 deletions GPU/Debugger/Breakpoints.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#pragma once

#include <string>
#include "Common/CommonTypes.h"

namespace GPUBreakpoints {
Expand Down
10 changes: 5 additions & 5 deletions GPU/Debugger/Debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ NotifyResult NotifyCommand(u32 pc) {
}

if (isBreakpoint && pc == g_skipPcOnce) {
INFO_LOG(Log::G3D, "Skipping break at %08x (last break was here)", g_skipPcOnce);
INFO_LOG(Log::GeDebugger, "Skipping GE break at %08x (last break was here)", g_skipPcOnce);
g_skipPcOnce = 0;
return process ? NotifyResult::Execute : NotifyResult::Skip;
}
Expand All @@ -179,10 +179,10 @@ NotifyResult NotifyCommand(u32 pc) {

auto info = gpuDebug->DisassembleOp(pc);
if (lastStepTime >= 0.0) {
NOTICE_LOG(Log::G3D, "Waiting at %08x, %s (%fms)", pc, info.desc.c_str(), (time_now_d() - lastStepTime) * 1000.0);
NOTICE_LOG(Log::GeDebugger, "Waiting at %08x, %s (%fms)", pc, info.desc.c_str(), (time_now_d() - lastStepTime) * 1000.0);
lastStepTime = -1.0;
} else {
NOTICE_LOG(Log::G3D, "Waiting at %08x, %s", pc, info.desc.c_str());
NOTICE_LOG(Log::GeDebugger, "Waiting at %08x, %s", pc, info.desc.c_str());
}

g_skipPcOnce = pc;
Expand All @@ -199,10 +199,10 @@ void NotifyDraw() {
return;
if (breakNext == BreakNext::DRAW && !GPUStepping::IsStepping()) {
if (lastStepTime >= 0.0) {
NOTICE_LOG(Log::G3D, "Waiting at a draw (%fms)", (time_now_d() - lastStepTime) * 1000.0);
NOTICE_LOG(Log::GeDebugger, "Waiting at a draw (%fms)", (time_now_d() - lastStepTime) * 1000.0);
lastStepTime = -1.0;
} else {
NOTICE_LOG(Log::G3D, "Waiting at a draw");
NOTICE_LOG(Log::GeDebugger, "Waiting at a draw");
}
g_drawNotified = true;
}
Expand Down
Loading

0 comments on commit 2e39a88

Please sign in to comment.