From db0aa54233d14b8feaf9fd382a3d64fda3614c4b Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 22 Apr 2018 02:48:17 -0300 Subject: [PATCH] Print guest stack trace on a few points that can throw exceptions --- ChocolArm64/Instruction/AInstEmitException.cs | 1 - Ryujinx.Core/OsHle/Kernel/SvcHandler.cs | 2 ++ Ryujinx.Core/OsHle/Kernel/SvcSystem.cs | 7 ++++++- Ryujinx.Core/OsHle/Process.cs | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChocolArm64/Instruction/AInstEmitException.cs b/ChocolArm64/Instruction/AInstEmitException.cs index 041e2890a..3e444c730 100644 --- a/ChocolArm64/Instruction/AInstEmitException.cs +++ b/ChocolArm64/Instruction/AInstEmitException.cs @@ -1,7 +1,6 @@ using ChocolArm64.Decoder; using ChocolArm64.State; using ChocolArm64.Translation; -using System.Reflection; using System.Reflection.Emit; namespace ChocolArm64.Instruction diff --git a/Ryujinx.Core/OsHle/Kernel/SvcHandler.cs b/Ryujinx.Core/OsHle/Kernel/SvcHandler.cs index c74da061a..25d2767e3 100644 --- a/Ryujinx.Core/OsHle/Kernel/SvcHandler.cs +++ b/Ryujinx.Core/OsHle/Kernel/SvcHandler.cs @@ -93,6 +93,8 @@ namespace Ryujinx.Core.OsHle.Kernel } else { + Process.PrintStackTrace(ThreadState); + throw new NotImplementedException(e.Id.ToString("x4")); } } diff --git a/Ryujinx.Core/OsHle/Kernel/SvcSystem.cs b/Ryujinx.Core/OsHle/Kernel/SvcSystem.cs index 48e8ce385..056b5059d 100644 --- a/Ryujinx.Core/OsHle/Kernel/SvcSystem.cs +++ b/Ryujinx.Core/OsHle/Kernel/SvcSystem.cs @@ -211,6 +211,8 @@ namespace Ryujinx.Core.OsHle.Kernel long Unknown = (long)ThreadState.X1; long Info = (long)ThreadState.X2; + Process.PrintStackTrace(ThreadState); + throw new GuestBrokeExecutionException(); } @@ -297,7 +299,10 @@ namespace Ryujinx.Core.OsHle.Kernel ThreadState.X1 = MemoryRegions.MapRegionSize; break; - default: throw new NotImplementedException($"SvcGetInfo: {InfoType} {Handle} {InfoId}"); + default: + Process.PrintStackTrace(ThreadState); + + throw new NotImplementedException($"SvcGetInfo: {InfoType} {Handle:x8} {InfoId}"); } ThreadState.X0 = 0; diff --git a/Ryujinx.Core/OsHle/Process.cs b/Ryujinx.Core/OsHle/Process.cs index 0f8c726c6..6591ed5aa 100644 --- a/Ryujinx.Core/OsHle/Process.cs +++ b/Ryujinx.Core/OsHle/Process.cs @@ -303,7 +303,7 @@ namespace Ryujinx.Core.OsHle Trace.AppendLine(" " + SubName + " (" + GetNsoNameAndAddress(Position) + ")"); } - Logging.Trace(LogClass.CPU, Trace.ToString()); + Logging.Info(LogClass.CPU, Trace.ToString()); } private string GetNsoNameAndAddress(long Position)