mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-24 20:36:24 -05:00
Moved backtrace to ArmInterface
This commit is contained in:
parent
5102c91256
commit
08d5663cb8
8 changed files with 20 additions and 47 deletions
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
#include "common/logging/log.h"
|
||||||
|
#include "core/memory.h"
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
enum class VMAPermission : u8;
|
enum class VMAPermission : u8;
|
||||||
|
@ -142,7 +144,21 @@ 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;
|
void 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
|
@ -278,22 +278,6 @@ 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,8 +53,6 @@ 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;
|
||||||
|
|
||||||
|
|
|
@ -267,22 +267,6 @@ 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,7 +40,6 @@ 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{};
|
||||||
|
|
|
@ -625,8 +625,9 @@ static void Break(u32 reason, u64 info1, u64 info2) {
|
||||||
"Emulated program broke execution! reason=0x{:016X}, info1=0x{:016X}, info2=0x{:016X}",
|
"Emulated program broke execution! reason=0x{:016X}, info1=0x{:016X}, info2=0x{:016X}",
|
||||||
reason, info1, info2);
|
reason, info1, info2);
|
||||||
handle_debug_buffer(info1, info2);
|
handle_debug_buffer(info1, info2);
|
||||||
GetCurrentThread()->LogBacktrace();
|
Core::System::GetInstance()
|
||||||
|
.ArmInterface(static_cast<std::size_t>(GetCurrentThread()->GetProcessorID()))
|
||||||
|
.LogBacktrace();
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
|
|
||||||
Core::CurrentProcess()->PrepareForTermination();
|
Core::CurrentProcess()->PrepareForTermination();
|
||||||
|
|
|
@ -388,10 +388,6 @@ bool Thread::InvokeWakeupCallback(ThreadWakeupReason reason, SharedPtr<Thread> t
|
||||||
return wakeup_callback(reason, std::move(thread), std::move(object), index);
|
return wakeup_callback(reason, std::move(thread), std::move(object), index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thread::LogBacktrace() {
|
|
||||||
Core::System::GetInstance().ArmInterface(processor_id).LogBacktrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -240,11 +240,6 @@ public:
|
||||||
return status == ThreadStatus::WaitSynchAll;
|
return status == ThreadStatus::WaitSynchAll;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Logs the backtrace for the current thread
|
|
||||||
*/
|
|
||||||
void LogBacktrace();
|
|
||||||
|
|
||||||
ThreadContext& GetContext() {
|
ThreadContext& GetContext() {
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue