mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-24 20:36:24 -05:00
Moved backtrace to ArmInterface
Added to both dynarmic and unicorn
This commit is contained in:
parent
7149332712
commit
5102c91256
6 changed files with 39 additions and 14 deletions
|
@ -141,6 +141,8 @@ public:
|
||||||
|
|
||||||
/// Prepare core for thread reschedule (if needed to correctly handle state)
|
/// Prepare core for thread reschedule (if needed to correctly handle state)
|
||||||
virtual void PrepareReschedule() = 0;
|
virtual void PrepareReschedule() = 0;
|
||||||
|
|
||||||
|
virtual void LogBacktrace() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
|
@ -278,6 +278,22 @@ void ARM_Dynarmic::PageTableChanged() {
|
||||||
current_page_table = Memory::GetCurrentPageTable();
|
current_page_table = Memory::GetCurrentPageTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ARM_Dynarmic::LogBacktrace() {
|
||||||
|
VAddr fp = GetReg(29);
|
||||||
|
VAddr lr = GetReg(30);
|
||||||
|
VAddr sp = GetReg(13);
|
||||||
|
VAddr pc = GetPC();
|
||||||
|
LOG_ERROR(Core_ARM, "Backtrace, sp={:016X}, pc={:016X}", sp, pc);
|
||||||
|
for (;;) {
|
||||||
|
LOG_ERROR(Core_ARM, "{:016X}", lr);
|
||||||
|
if (!fp) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
lr = Memory::Read64(fp + 8) - 4;
|
||||||
|
fp = Memory::Read64(fp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DynarmicExclusiveMonitor::DynarmicExclusiveMonitor(std::size_t core_count) : monitor(core_count) {}
|
DynarmicExclusiveMonitor::DynarmicExclusiveMonitor(std::size_t core_count) : monitor(core_count) {}
|
||||||
DynarmicExclusiveMonitor::~DynarmicExclusiveMonitor() = default;
|
DynarmicExclusiveMonitor::~DynarmicExclusiveMonitor() = default;
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,8 @@ public:
|
||||||
void ClearInstructionCache() override;
|
void ClearInstructionCache() override;
|
||||||
void PageTableChanged() override;
|
void PageTableChanged() override;
|
||||||
|
|
||||||
|
void LogBacktrace() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Dynarmic::A64::Jit> MakeJit() const;
|
std::unique_ptr<Dynarmic::A64::Jit> MakeJit() const;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/core_timing.h"
|
#include "core/core_timing.h"
|
||||||
#include "core/hle/kernel/svc.h"
|
#include "core/hle/kernel/svc.h"
|
||||||
|
#include "core/memory.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
|
@ -266,6 +267,22 @@ void ARM_Unicorn::ClearExclusiveState() {}
|
||||||
|
|
||||||
void ARM_Unicorn::ClearInstructionCache() {}
|
void ARM_Unicorn::ClearInstructionCache() {}
|
||||||
|
|
||||||
|
void ARM_Unicorn::LogBacktrace() {
|
||||||
|
VAddr fp = GetReg(29);
|
||||||
|
VAddr lr = GetReg(30);
|
||||||
|
VAddr sp = GetReg(13);
|
||||||
|
VAddr pc = GetPC();
|
||||||
|
LOG_ERROR(Core_ARM, "Backtrace, sp={:016X}, pc={:016X}", sp, pc);
|
||||||
|
for (;;) {
|
||||||
|
LOG_ERROR(Core_ARM, "{:016X}", lr);
|
||||||
|
if (!fp) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
lr = Memory::Read64(fp + 8) - 4;
|
||||||
|
fp = Memory::Read64(fp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ARM_Unicorn::RecordBreak(GDBStub::BreakpointAddress bkpt) {
|
void ARM_Unicorn::RecordBreak(GDBStub::BreakpointAddress bkpt) {
|
||||||
last_bkpt = bkpt;
|
last_bkpt = bkpt;
|
||||||
last_bkpt_hit = true;
|
last_bkpt_hit = true;
|
||||||
|
|
|
@ -40,6 +40,7 @@ public:
|
||||||
void ClearInstructionCache() override;
|
void ClearInstructionCache() override;
|
||||||
void PageTableChanged() override{};
|
void PageTableChanged() override{};
|
||||||
void RecordBreak(GDBStub::BreakpointAddress bkpt);
|
void RecordBreak(GDBStub::BreakpointAddress bkpt);
|
||||||
|
void LogBacktrace() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uc_engine* uc{};
|
uc_engine* uc{};
|
||||||
|
|
|
@ -389,20 +389,7 @@ bool Thread::InvokeWakeupCallback(ThreadWakeupReason reason, SharedPtr<Thread> t
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thread::LogBacktrace() {
|
void Thread::LogBacktrace() {
|
||||||
auto& system = Core::System::GetInstance();
|
Core::System::GetInstance().ArmInterface(processor_id).LogBacktrace();
|
||||||
VAddr fp = system.ArmInterface(processor_id).GetReg(29);
|
|
||||||
VAddr lr = system.ArmInterface(processor_id).GetReg(30);
|
|
||||||
VAddr sp = system.ArmInterface(processor_id).GetReg(13);
|
|
||||||
VAddr pc = system.ArmInterface(processor_id).GetPC();
|
|
||||||
LOG_ERROR(Debug, "Backtrace, sp={:016X}, pc={:016X}", sp, pc);
|
|
||||||
for (std::size_t i = 0; i < 256; i++) {
|
|
||||||
LOG_ERROR(Debug, "{:016X}", lr - 4);
|
|
||||||
if (!fp) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
lr = Memory::Read64(fp + 8);
|
|
||||||
fp = Memory::Read64(fp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in a new issue