diff options
author | Mai <mathew1800@gmail.com> | 2022-07-08 05:49:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-08 05:49:54 +0200 |
commit | 313f047f974249c0fa004056ced3f18a8c61eae4 (patch) | |
tree | 56d70869ae85bd0dce17923259d25e96be3c98a9 /src/core/arm/dynarmic/arm_dynarmic_64.cpp | |
parent | Merge pull request #8502 from liamwhite/end-wait (diff) | |
parent | core/arm: better support for backtrace generation (diff) | |
download | yuzu-313f047f974249c0fa004056ced3f18a8c61eae4.tar yuzu-313f047f974249c0fa004056ced3f18a8c61eae4.tar.gz yuzu-313f047f974249c0fa004056ced3f18a8c61eae4.tar.bz2 yuzu-313f047f974249c0fa004056ced3f18a8c61eae4.tar.lz yuzu-313f047f974249c0fa004056ced3f18a8c61eae4.tar.xz yuzu-313f047f974249c0fa004056ced3f18a8c61eae4.tar.zst yuzu-313f047f974249c0fa004056ced3f18a8c61eae4.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic_64.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp index 92266aa9e..c437f24b8 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp @@ -494,22 +494,22 @@ void ARM_Dynarmic_64::PageTableChanged(Common::PageTable& page_table, } std::vector<ARM_Interface::BacktraceEntry> ARM_Dynarmic_64::GetBacktrace(Core::System& system, - u64 fp, u64 lr) { + u64 fp, u64 lr, u64 pc) { std::vector<BacktraceEntry> out; auto& memory = system.Memory(); - // fp (= r29) points to the last frame record. - // Note that this is the frame record for the *previous* frame, not the current one. - // Note we need to subtract 4 from our last read to get the proper address + out.push_back({"", 0, pc, 0, ""}); + + // fp (= x29) points to the previous frame record. // Frame records are two words long: // fp+0 : pointer to previous frame record // fp+8 : value of lr for frame while (true) { out.push_back({"", 0, lr, 0, ""}); - if (!fp) { + if (!fp || (fp % 4 != 0) || !memory.IsValidVirtualAddressRange(fp, 16)) { break; } - lr = memory.Read64(fp + 8) - 4; + lr = memory.Read64(fp + 8); fp = memory.Read64(fp); } @@ -520,11 +520,12 @@ std::vector<ARM_Interface::BacktraceEntry> ARM_Dynarmic_64::GetBacktrace(Core::S std::vector<ARM_Interface::BacktraceEntry> ARM_Dynarmic_64::GetBacktraceFromContext( System& system, const ThreadContext64& ctx) { - return GetBacktrace(system, ctx.cpu_registers[29], ctx.cpu_registers[30]); + const auto& reg = ctx.cpu_registers; + return GetBacktrace(system, reg[29], reg[30], ctx.pc); } std::vector<ARM_Interface::BacktraceEntry> ARM_Dynarmic_64::GetBacktrace() const { - return GetBacktrace(system, GetReg(29), GetReg(30)); + return GetBacktrace(system, GetReg(29), GetReg(30), GetPC()); } } // namespace Core |