mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
Debugger: Log access reason on memory breakpoint.
This commit is contained in:
parent
f7740edc6d
commit
44a0c54538
@ -40,14 +40,15 @@ static std::mutex memCheckMutex_;
|
||||
std::vector<MemCheck> CBreakPoints::memChecks_;
|
||||
std::vector<MemCheck *> CBreakPoints::cleanupMemChecks_;
|
||||
|
||||
void MemCheck::Log(u32 addr, bool write, int size, u32 pc) {
|
||||
void MemCheck::Log(u32 addr, bool write, int size, u32 pc, const std::string &reason) {
|
||||
if (result & BREAK_ACTION_LOG) {
|
||||
const char *type = write ? "Write" : "Read";
|
||||
if (logFormat.empty()) {
|
||||
NOTICE_LOG(MEMMAP, "CHK %s%i at %08x (%s), PC=%08x (%s)", write ? "Write" : "Read", size * 8, addr, g_symbolMap->GetDescription(addr).c_str(), pc, g_symbolMap->GetDescription(pc).c_str());
|
||||
NOTICE_LOG(MEMMAP, "CHK %s%i(%s) at %08x (%s), PC=%08x (%s)", type, size * 8, reason.c_str(), addr, g_symbolMap->GetDescription(addr).c_str(), pc, g_symbolMap->GetDescription(pc).c_str());
|
||||
} else {
|
||||
std::string formatted;
|
||||
CBreakPoints::EvaluateLogFormat(currentDebugMIPS, logFormat, formatted);
|
||||
NOTICE_LOG(MEMMAP, "CHK %s%i at %08x: %s", write ? "Write" : "Read", size * 8, addr, formatted.c_str());
|
||||
NOTICE_LOG(MEMMAP, "CHK %s%i(%s) at %08x: %s", type, size * 8, reason.c_str(), addr, formatted.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -62,10 +63,10 @@ BreakAction MemCheck::Apply(u32 addr, bool write, int size, u32 pc) {
|
||||
return BREAK_ACTION_IGNORE;
|
||||
}
|
||||
|
||||
BreakAction MemCheck::Action(u32 addr, bool write, int size, u32 pc) {
|
||||
BreakAction MemCheck::Action(u32 addr, bool write, int size, u32 pc, const std::string &reason) {
|
||||
int mask = write ? MEMCHECK_WRITE : MEMCHECK_READ;
|
||||
if (cond & mask) {
|
||||
Log(addr, write, size, pc);
|
||||
Log(addr, write, size, pc, reason);
|
||||
if ((result & BREAK_ACTION_PAUSE) && coreState != CORE_POWERUP) {
|
||||
Core_EnableStepping(true);
|
||||
host->SetDebugMode(true);
|
||||
@ -94,7 +95,7 @@ void MemCheck::JitBeforeAction(u32 addr, bool write, int size, u32 pc) {
|
||||
// We have to break to find out if it changed.
|
||||
Core_EnableStepping(true);
|
||||
} else {
|
||||
Action(addr, write, size, pc);
|
||||
Action(addr, write, size, pc, "CPU");
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,7 +117,7 @@ void MemCheck::JitCleanup(bool changed)
|
||||
return;
|
||||
|
||||
if (changed)
|
||||
Log(lastAddr, true, lastSize, lastPC);
|
||||
Log(lastAddr, true, lastSize, lastPC, "CPU");
|
||||
|
||||
// Resume if it should not have gone to stepping, or if it did not change.
|
||||
if ((!(result & BREAK_ACTION_PAUSE) || !changed) && coreState == CORE_STEPPING)
|
||||
@ -504,7 +505,7 @@ MemCheck *CBreakPoints::GetMemCheckLocked(u32 address, int size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
BreakAction CBreakPoints::ExecMemCheck(u32 address, bool write, int size, u32 pc)
|
||||
BreakAction CBreakPoints::ExecMemCheck(u32 address, bool write, int size, u32 pc, const std::string &reason)
|
||||
{
|
||||
if (!anyMemChecks_)
|
||||
return BREAK_ACTION_IGNORE;
|
||||
@ -514,7 +515,7 @@ BreakAction CBreakPoints::ExecMemCheck(u32 address, bool write, int size, u32 pc
|
||||
check->Apply(address, write, size, pc);
|
||||
auto copy = *check;
|
||||
guard.unlock();
|
||||
return copy.Action(address, write, size, pc);
|
||||
return copy.Action(address, write, size, pc, reason);
|
||||
}
|
||||
return BREAK_ACTION_IGNORE;
|
||||
}
|
||||
@ -547,7 +548,7 @@ BreakAction CBreakPoints::ExecOpMemCheck(u32 address, u32 pc)
|
||||
check->Apply(address, write, size, pc);
|
||||
auto copy = *check;
|
||||
guard.unlock();
|
||||
return copy.Action(address, write, size, pc);
|
||||
return copy.Action(address, write, size, pc, "CPU");
|
||||
}
|
||||
}
|
||||
return BREAK_ACTION_IGNORE;
|
||||
|
@ -96,13 +96,13 @@ struct MemCheck {
|
||||
// Called on the stored memcheck (affects numHits, etc.)
|
||||
BreakAction Apply(u32 addr, bool write, int size, u32 pc);
|
||||
// Called on a copy.
|
||||
BreakAction Action(u32 addr, bool write, int size, u32 pc);
|
||||
BreakAction Action(u32 addr, bool write, int size, u32 pc, const std::string &reason);
|
||||
void JitBeforeApply(u32 addr, bool write, int size, u32 pc);
|
||||
void JitBeforeAction(u32 addr, bool write, int size, u32 pc);
|
||||
bool JitApplyChanged();
|
||||
void JitCleanup(bool changed);
|
||||
|
||||
void Log(u32 addr, bool write, int size, u32 pc);
|
||||
void Log(u32 addr, bool write, int size, u32 pc, const std::string &reason);
|
||||
|
||||
bool IsEnabled() const {
|
||||
return (result & BREAK_ACTION_PAUSE) != 0;
|
||||
@ -151,7 +151,7 @@ public:
|
||||
|
||||
static bool GetMemCheck(u32 start, u32 end, MemCheck *check);
|
||||
static bool GetMemCheckInRange(u32 address, int size, MemCheck *check);
|
||||
static BreakAction ExecMemCheck(u32 address, bool write, int size, u32 pc);
|
||||
static BreakAction ExecMemCheck(u32 address, bool write, int size, u32 pc, const std::string &reason);
|
||||
static BreakAction ExecOpMemCheck(u32 address, u32 pc);
|
||||
|
||||
// Executes memchecks but used by the jit. Cleanup finalizes after jit is done.
|
||||
|
@ -27,8 +27,8 @@ void NotifyMemInfoPC(MemBlockFlags flags, uint32_t start, uint32_t size, uint32_
|
||||
// TODO
|
||||
|
||||
if (flags & MemBlockFlags::WRITE) {
|
||||
CBreakPoints::ExecMemCheck(start, true, size, pc);
|
||||
CBreakPoints::ExecMemCheck(start, true, size, pc, tag);
|
||||
} else if (flags & MemBlockFlags::READ) {
|
||||
CBreakPoints::ExecMemCheck(start, false, size, pc);
|
||||
CBreakPoints::ExecMemCheck(start, false, size, pc, tag);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user