threadUid is now ulong

This commit is contained in:
merry 2022-02-13 14:36:47 +00:00
parent d0afc6605f
commit ef92c9c5e4
6 changed files with 17 additions and 14 deletions

View file

@ -57,6 +57,8 @@ namespace ARMeilleure.State
public bool IsAarch32 { get; set; } public bool IsAarch32 { get; set; }
public ulong ThreadUid { get; set; }
internal ExecutionMode ExecutionMode internal ExecutionMode ExecutionMode
{ {
get get

View file

@ -25,8 +25,8 @@ namespace Ryujinx.HLE.Debugger
private Thread SocketThread; private Thread SocketThread;
private Thread HandlerThread; private Thread HandlerThread;
private long? cThread; private ulong? cThread;
private long? gThread; private ulong? gThread;
public Debugger(Switch device, ushort port) public Debugger(Switch device, ushort port)
{ {
@ -42,9 +42,9 @@ namespace Ryujinx.HLE.Debugger
} }
private void HaltApplication() => Device.System.DebugGetApplicationProcess().DebugStopAllThreads(); private void HaltApplication() => Device.System.DebugGetApplicationProcess().DebugStopAllThreads();
private long[] GetThreadIds() => Device.System.DebugGetApplicationProcess().DebugGetThreadUids(); private ulong[] GetThreadIds() => Device.System.DebugGetApplicationProcess().DebugGetThreadUids();
private ARMeilleure.State.ExecutionContext GetThread(long threadUid) => private ARMeilleure.State.ExecutionContext GetThread(ulong threadUid) =>
Device.System.DebugGetApplicationProcess().DebugGetThreadContext(threadUid); Device.System.DebugGetApplicationProcess().DebugGetThreadContext(threadUid);
private ARMeilleure.State.ExecutionContext[] GetThreads() => GetThreadIds().Select(GetThread).ToArray(); private ARMeilleure.State.ExecutionContext[] GetThreads() => GetThreadIds().Select(GetThread).ToArray();
private IVirtualMemoryManager GetMemory() => Device.System.DebugGetApplicationProcess().CpuMemory; private IVirtualMemoryManager GetMemory() => Device.System.DebugGetApplicationProcess().CpuMemory;
@ -188,7 +188,7 @@ namespace Ryujinx.HLE.Debugger
case 'H': case 'H':
{ {
char op = ss.ReadChar(); char op = ss.ReadChar();
long? threadId = ss.ReadRemainingAsThreadUid(); ulong? threadId = ss.ReadRemainingAsThreadUid();
CommandSetThread(op, threadId); CommandSetThread(op, threadId);
break; break;
} }
@ -303,7 +303,7 @@ namespace Ryujinx.HLE.Debugger
break; break;
case 'T': case 'T':
{ {
long? threadId = ss.ReadRemainingAsThreadUid(); ulong? threadId = ss.ReadRemainingAsThreadUid();
CommandIsAlive(threadId); CommandIsAlive(threadId);
break; break;
} }
@ -391,7 +391,7 @@ namespace Ryujinx.HLE.Debugger
} }
} }
void CommandSetThread(char op, long? threadId) void CommandSetThread(char op, ulong? threadId)
{ {
if (threadId == 0) if (threadId == 0)
{ {
@ -506,7 +506,7 @@ namespace Ryujinx.HLE.Debugger
Reply($"T00thread:{ctx.ThreadUid:x};"); Reply($"T00thread:{ctx.ThreadUid:x};");
} }
private void CommandIsAlive(long? threadId) private void CommandIsAlive(ulong? threadId)
{ {
if (GetThreads().Any(x => x.ThreadUid == threadId)) if (GetThreads().Any(x => x.ThreadUid == threadId))
{ {

View file

@ -5,8 +5,8 @@ namespace Ryujinx.HLE.Debugger
public interface IDebuggableProcess public interface IDebuggableProcess
{ {
void DebugStopAllThreads(); void DebugStopAllThreads();
long[] DebugGetThreadUids(); ulong[] DebugGetThreadUids();
ARMeilleure.State.ExecutionContext DebugGetThreadContext(long threadUid); ARMeilleure.State.ExecutionContext DebugGetThreadContext(ulong threadUid);
IVirtualMemoryManager CpuMemory { get; } IVirtualMemoryManager CpuMemory { get; }
void InvalidateCacheRegion(ulong address, ulong size); void InvalidateCacheRegion(ulong address, ulong size);
} }

View file

@ -75,10 +75,10 @@ namespace Ryujinx.HLE.Debugger
return result; return result;
} }
public long? ReadRemainingAsThreadUid() public ulong? ReadRemainingAsThreadUid()
{ {
string s = ReadRemaining(); string s = ReadRemaining();
return s == "-1" ? null : long.Parse(s, NumberStyles.HexNumber); return s == "-1" ? null : ulong.Parse(s, NumberStyles.HexNumber);
} }
public bool ConsumePrefix(string prefix) public bool ConsumePrefix(string prefix)

View file

@ -1213,7 +1213,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
} }
} }
public long[] DebugGetThreadUids() public ulong[] DebugGetThreadUids()
{ {
lock (_parent._threadingLock) lock (_parent._threadingLock)
{ {
@ -1221,7 +1221,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
} }
} }
public ARMeilleure.State.ExecutionContext DebugGetThreadContext(long threadUid) public ARMeilleure.State.ExecutionContext DebugGetThreadContext(ulong threadUid)
{ {
lock (_parent._threadingLock) lock (_parent._threadingLock)
{ {

View file

@ -212,6 +212,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
Context.Tpidr = (long)_tlsAddress; Context.Tpidr = (long)_tlsAddress;
ThreadUid = KernelContext.NewThreadUid(); ThreadUid = KernelContext.NewThreadUid();
Context.ThreadUid = ThreadUid;
HostThread.Name = customThreadStart != null ? $"HLE.OsThread.{ThreadUid}" : $"HLE.GuestThread.{ThreadUid}"; HostThread.Name = customThreadStart != null ? $"HLE.OsThread.{ThreadUid}" : $"HLE.GuestThread.{ThreadUid}";