mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-15 08:49:20 +01:00
Core/Debugger_SymbolMap: Remove redundant system parameters from interface
The CPU thread guard already allows access to the system instance. We can remove the system parameter to reduce rendundancy here.
This commit is contained in:
parent
514b3e6f55
commit
75ec350dc4
@ -26,10 +26,10 @@ static bool IsStackBottom(const Core::CPUThreadGuard& guard, u32 addr)
|
|||||||
return !addr || !PowerPC::MMU::HostIsRAMAddress(guard, addr);
|
return !addr || !PowerPC::MMU::HostIsRAMAddress(guard, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WalkTheStack(Core::System& system, const Core::CPUThreadGuard& guard,
|
static void WalkTheStack(const Core::CPUThreadGuard& guard,
|
||||||
const std::function<void(u32)>& stack_step)
|
const std::function<void(u32)>& stack_step)
|
||||||
{
|
{
|
||||||
auto& ppc_state = system.GetPPCState();
|
const auto& ppc_state = guard.GetSystem().GetPPCState();
|
||||||
|
|
||||||
if (!IsStackBottom(guard, ppc_state.gpr[1]))
|
if (!IsStackBottom(guard, ppc_state.gpr[1]))
|
||||||
{
|
{
|
||||||
@ -52,10 +52,9 @@ static void WalkTheStack(Core::System& system, const Core::CPUThreadGuard& guard
|
|||||||
// Returns callstack "formatted for debugging" - meaning that it
|
// Returns callstack "formatted for debugging" - meaning that it
|
||||||
// includes LR as the last item, and all items are the last step,
|
// includes LR as the last item, and all items are the last step,
|
||||||
// instead of "pointing ahead"
|
// instead of "pointing ahead"
|
||||||
bool GetCallstack(Core::System& system, const Core::CPUThreadGuard& guard,
|
bool GetCallstack(const Core::CPUThreadGuard& guard, std::vector<CallstackEntry>& output)
|
||||||
std::vector<CallstackEntry>& output)
|
|
||||||
{
|
{
|
||||||
auto& ppc_state = system.GetPPCState();
|
const auto& ppc_state = guard.GetSystem().GetPPCState();
|
||||||
|
|
||||||
if (!Core::IsRunning() || !PowerPC::MMU::HostIsRAMAddress(guard, ppc_state.gpr[1]))
|
if (!Core::IsRunning() || !PowerPC::MMU::HostIsRAMAddress(guard, ppc_state.gpr[1]))
|
||||||
return false;
|
return false;
|
||||||
@ -75,7 +74,7 @@ bool GetCallstack(Core::System& system, const Core::CPUThreadGuard& guard,
|
|||||||
entry.vAddress = LR(ppc_state) - 4;
|
entry.vAddress = LR(ppc_state) - 4;
|
||||||
output.push_back(entry);
|
output.push_back(entry);
|
||||||
|
|
||||||
WalkTheStack(system, guard, [&entry, &output](u32 func_addr) {
|
WalkTheStack(guard, [&entry, &output](u32 func_addr) {
|
||||||
std::string func_desc = g_symbolDB.GetDescription(func_addr);
|
std::string func_desc = g_symbolDB.GetDescription(func_addr);
|
||||||
if (func_desc.empty() || func_desc == "Invalid")
|
if (func_desc.empty() || func_desc == "Invalid")
|
||||||
func_desc = "(unknown)";
|
func_desc = "(unknown)";
|
||||||
@ -87,10 +86,10 @@ bool GetCallstack(Core::System& system, const Core::CPUThreadGuard& guard,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintCallstack(Core::System& system, const Core::CPUThreadGuard& guard,
|
void PrintCallstack(const Core::CPUThreadGuard& guard, Common::Log::LogType type,
|
||||||
Common::Log::LogType type, Common::Log::LogLevel level)
|
Common::Log::LogLevel level)
|
||||||
{
|
{
|
||||||
auto& ppc_state = system.GetPPCState();
|
const auto& ppc_state = guard.GetSystem().GetPPCState();
|
||||||
|
|
||||||
GENERIC_LOG_FMT(type, level, "== STACK TRACE - SP = {:08x} ==", ppc_state.gpr[1]);
|
GENERIC_LOG_FMT(type, level, "== STACK TRACE - SP = {:08x} ==", ppc_state.gpr[1]);
|
||||||
|
|
||||||
@ -105,7 +104,7 @@ void PrintCallstack(Core::System& system, const Core::CPUThreadGuard& guard,
|
|||||||
LR(ppc_state));
|
LR(ppc_state));
|
||||||
}
|
}
|
||||||
|
|
||||||
WalkTheStack(system, guard, [type, level](u32 func_addr) {
|
WalkTheStack(guard, [type, level](u32 func_addr) {
|
||||||
std::string func_desc = g_symbolDB.GetDescription(func_addr);
|
std::string func_desc = g_symbolDB.GetDescription(func_addr);
|
||||||
if (func_desc.empty() || func_desc == "Invalid")
|
if (func_desc.empty() || func_desc == "Invalid")
|
||||||
func_desc = "(unknown)";
|
func_desc = "(unknown)";
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
namespace Core
|
namespace Core
|
||||||
{
|
{
|
||||||
class CPUThreadGuard;
|
class CPUThreadGuard;
|
||||||
class System;
|
}
|
||||||
} // namespace Core
|
|
||||||
|
|
||||||
namespace Dolphin_Debugger
|
namespace Dolphin_Debugger
|
||||||
{
|
{
|
||||||
@ -24,10 +23,9 @@ struct CallstackEntry
|
|||||||
u32 vAddress = 0;
|
u32 vAddress = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool GetCallstack(Core::System& system, const Core::CPUThreadGuard& guard,
|
bool GetCallstack(const Core::CPUThreadGuard& guard, std::vector<CallstackEntry>& output);
|
||||||
std::vector<CallstackEntry>& output);
|
void PrintCallstack(const Core::CPUThreadGuard& guard, Common::Log::LogType type,
|
||||||
void PrintCallstack(Core::System& system, const Core::CPUThreadGuard& guard,
|
Common::Log::LogLevel level);
|
||||||
Common::Log::LogType type, Common::Log::LogLevel level);
|
|
||||||
void PrintDataBuffer(Common::Log::LogType type, const u8* data, size_t size,
|
void PrintDataBuffer(Common::Log::LogType type, const u8* data, size_t size,
|
||||||
std::string_view title);
|
std::string_view title);
|
||||||
} // namespace Dolphin_Debugger
|
} // namespace Dolphin_Debugger
|
||||||
|
@ -115,9 +115,8 @@ static double CallstackFunc(expr_func* f, vec_expr_t* args, void* c)
|
|||||||
|
|
||||||
std::vector<Dolphin_Debugger::CallstackEntry> stack;
|
std::vector<Dolphin_Debugger::CallstackEntry> stack;
|
||||||
{
|
{
|
||||||
auto& system = Core::System::GetInstance();
|
Core::CPUThreadGuard guard(Core::System::GetInstance());
|
||||||
Core::CPUThreadGuard guard(system);
|
const bool success = Dolphin_Debugger::GetCallstack(guard, stack);
|
||||||
bool success = Dolphin_Debugger::GetCallstack(system, guard, stack);
|
|
||||||
if (!success)
|
if (!success)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,7 @@ void Interpreter::unknown_instruction(Interpreter& interpreter, UGeckoInstructio
|
|||||||
const u32 opcode = PowerPC::MMU::HostRead_U32(guard, last_pc);
|
const u32 opcode = PowerPC::MMU::HostRead_U32(guard, last_pc);
|
||||||
const std::string disasm = Common::GekkoDisassembler::Disassemble(opcode, last_pc);
|
const std::string disasm = Common::GekkoDisassembler::Disassemble(opcode, last_pc);
|
||||||
NOTICE_LOG_FMT(POWERPC, "Last PC = {:08x} : {}", last_pc, disasm);
|
NOTICE_LOG_FMT(POWERPC, "Last PC = {:08x} : {}", last_pc, disasm);
|
||||||
Dolphin_Debugger::PrintCallstack(system, guard, Common::Log::LogType::POWERPC,
|
Dolphin_Debugger::PrintCallstack(guard, Common::Log::LogType::POWERPC,
|
||||||
Common::Log::LogLevel::LNOTICE);
|
Common::Log::LogLevel::LNOTICE);
|
||||||
|
|
||||||
const auto& ppc_state = interpreter.m_ppc_state;
|
const auto& ppc_state = interpreter.m_ppc_state;
|
||||||
|
@ -344,7 +344,7 @@ void CodeWidget::UpdateCallstack()
|
|||||||
|
|
||||||
const bool success = [this, &stack] {
|
const bool success = [this, &stack] {
|
||||||
Core::CPUThreadGuard guard(m_system);
|
Core::CPUThreadGuard guard(m_system);
|
||||||
return Dolphin_Debugger::GetCallstack(m_system, guard, stack);
|
return Dolphin_Debugger::GetCallstack(guard, stack);
|
||||||
}();
|
}();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user