From ee71ef961f5403cd197acea0ece77a3da72adf12 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 20 Feb 2021 16:16:43 -0800 Subject: [PATCH] Debugger: Keep char *s for memchecks. --- Core/Debugger/Breakpoints.cpp | 10 +++++----- Core/Debugger/Breakpoints.h | 6 +++--- Core/Debugger/MemBlockInfo.cpp | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Core/Debugger/Breakpoints.cpp b/Core/Debugger/Breakpoints.cpp index 6ee1ac8ee6..ddb2d2baf6 100644 --- a/Core/Debugger/Breakpoints.cpp +++ b/Core/Debugger/Breakpoints.cpp @@ -40,15 +40,15 @@ static std::mutex memCheckMutex_; std::vector CBreakPoints::memChecks_; std::vector CBreakPoints::cleanupMemChecks_; -void MemCheck::Log(u32 addr, bool write, int size, u32 pc, const std::string &reason) { +void MemCheck::Log(u32 addr, bool write, int size, u32 pc, const char *reason) { if (result & BREAK_ACTION_LOG) { const char *type = write ? "Write" : "Read"; if (logFormat.empty()) { - 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()); + NOTICE_LOG(MEMMAP, "CHK %s%i(%s) at %08x (%s), PC=%08x (%s)", type, size * 8, reason, 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(%s) at %08x: %s", type, size * 8, reason.c_str(), addr, formatted.c_str()); + NOTICE_LOG(MEMMAP, "CHK %s%i(%s) at %08x: %s", type, size * 8, reason, addr, formatted.c_str()); } } } @@ -63,7 +63,7 @@ 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, const std::string &reason) { +BreakAction MemCheck::Action(u32 addr, bool write, int size, u32 pc, const char *reason) { int mask = write ? MEMCHECK_WRITE : MEMCHECK_READ; if (cond & mask) { Log(addr, write, size, pc, reason); @@ -505,7 +505,7 @@ MemCheck *CBreakPoints::GetMemCheckLocked(u32 address, int size) { return 0; } -BreakAction CBreakPoints::ExecMemCheck(u32 address, bool write, int size, u32 pc, const std::string &reason) +BreakAction CBreakPoints::ExecMemCheck(u32 address, bool write, int size, u32 pc, const char *reason) { if (!anyMemChecks_) return BREAK_ACTION_IGNORE; diff --git a/Core/Debugger/Breakpoints.h b/Core/Debugger/Breakpoints.h index ffb9118cb5..c2a7d81b6a 100644 --- a/Core/Debugger/Breakpoints.h +++ b/Core/Debugger/Breakpoints.h @@ -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, const std::string &reason); + BreakAction Action(u32 addr, bool write, int size, u32 pc, const char *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, const std::string &reason); + void Log(u32 addr, bool write, int size, u32 pc, const char *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, const std::string &reason); + static BreakAction ExecMemCheck(u32 address, bool write, int size, u32 pc, const char *reason); static BreakAction ExecOpMemCheck(u32 address, u32 pc); // Executes memchecks but used by the jit. Cleanup finalizes after jit is done. diff --git a/Core/Debugger/MemBlockInfo.cpp b/Core/Debugger/MemBlockInfo.cpp index 3997a553fd..ef3f1ec239 100644 --- a/Core/Debugger/MemBlockInfo.cpp +++ b/Core/Debugger/MemBlockInfo.cpp @@ -75,7 +75,7 @@ struct PendingNotifyMem { std::string tag; }; -static constexpr size_t MAX_PENDING_NOTIFIES = 4096; +static constexpr size_t MAX_PENDING_NOTIFIES = 512; static MemSlabMap allocMap; static MemSlabMap suballocMap; static MemSlabMap writeMap; @@ -377,9 +377,9 @@ void NotifyMemInfoPC(MemBlockFlags flags, uint32_t start, uint32_t size, uint32_ } if (flags & MemBlockFlags::WRITE) { - CBreakPoints::ExecMemCheck(start, true, size, pc, tag); + CBreakPoints::ExecMemCheck(start, true, size, pc, tag.c_str()); } else if (flags & MemBlockFlags::READ) { - CBreakPoints::ExecMemCheck(start, false, size, pc, tag); + CBreakPoints::ExecMemCheck(start, false, size, pc, tag.c_str()); } }