From be8d0b76ca9740138b9747234ebbfaa6caa9f5fb Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Mon, 9 Jan 2023 21:49:50 +0100 Subject: PowerPC: Remove PC macro. --- Source/Core/Common/Debug/CodeTrace.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Source/Core/Common/Debug/CodeTrace.cpp') diff --git a/Source/Core/Common/Debug/CodeTrace.cpp b/Source/Core/Common/Debug/CodeTrace.cpp index d1cb913356..2b2694c1dd 100644 --- a/Source/Core/Common/Debug/CodeTrace.cpp +++ b/Source/Core/Common/Debug/CodeTrace.cpp @@ -60,7 +60,7 @@ InstructionAttributes CodeTrace::GetInstructionAttributes(const TraceOutput& ins // decision has to be made, otherwise used afterwards on a log file. InstructionAttributes tmp_attributes; tmp_attributes.instruction = instruction.instruction; - tmp_attributes.address = PC; + tmp_attributes.address = PowerPC::ppcState.pc; std::string instr = instruction.instruction; std::smatch match; @@ -108,9 +108,9 @@ TraceOutput CodeTrace::SaveCurrentInstruction() const { // Quickly save instruction and memory target for fast logging. TraceOutput output; - const std::string instr = PowerPC::debug_interface.Disassemble(PC); + const std::string instr = PowerPC::debug_interface.Disassemble(PowerPC::ppcState.pc); output.instruction = instr; - output.address = PC; + output.address = PowerPC::ppcState.pc; if (IsInstructionLoadStore(output.instruction)) output.memory_target = PowerPC::debug_interface.GetMemoryAddressFromInstruction(instr); -- cgit v1.2.3 From bbdfb4bc14d2586c838dd6bd40684ca7b490910e Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Tue, 10 Jan 2023 04:53:40 +0100 Subject: CodeTrace: Avoid ppcState global. --- Source/Core/Common/Debug/CodeTrace.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Source/Core/Common/Debug/CodeTrace.cpp') diff --git a/Source/Core/Common/Debug/CodeTrace.cpp b/Source/Core/Common/Debug/CodeTrace.cpp index 2b2694c1dd..09939bdf96 100644 --- a/Source/Core/Common/Debug/CodeTrace.cpp +++ b/Source/Core/Common/Debug/CodeTrace.cpp @@ -11,6 +11,7 @@ #include "Core/Debugger/PPCDebugInterface.h" #include "Core/HW/CPU.h" #include "Core/PowerPC/PowerPC.h" +#include "Core/System.h" namespace { @@ -56,11 +57,13 @@ void CodeTrace::SetRegTracked(const std::string& reg) InstructionAttributes CodeTrace::GetInstructionAttributes(const TraceOutput& instruction) const { + auto& system = Core::System::GetInstance(); + // Slower process of breaking down saved instruction. Only used when stepping through code if a // decision has to be made, otherwise used afterwards on a log file. InstructionAttributes tmp_attributes; tmp_attributes.instruction = instruction.instruction; - tmp_attributes.address = PowerPC::ppcState.pc; + tmp_attributes.address = system.GetPPCState().pc; std::string instr = instruction.instruction; std::smatch match; @@ -106,11 +109,14 @@ InstructionAttributes CodeTrace::GetInstructionAttributes(const TraceOutput& ins TraceOutput CodeTrace::SaveCurrentInstruction() const { + auto& system = Core::System::GetInstance(); + auto& ppc_state = system.GetPPCState(); + // Quickly save instruction and memory target for fast logging. TraceOutput output; - const std::string instr = PowerPC::debug_interface.Disassemble(PowerPC::ppcState.pc); + const std::string instr = PowerPC::debug_interface.Disassemble(ppc_state.pc); output.instruction = instr; - output.address = PowerPC::ppcState.pc; + output.address = ppc_state.pc; if (IsInstructionLoadStore(output.instruction)) output.memory_target = PowerPC::debug_interface.GetMemoryAddressFromInstruction(instr); -- cgit v1.2.3