mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-06-04 19:39:15 +00:00
[ci skip] chore: Fix usage of var
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Memory;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ryujinx.HLE.Debugger
|
||||
{
|
||||
@@ -52,7 +53,7 @@ namespace Ryujinx.HLE.Debugger
|
||||
return false;
|
||||
}
|
||||
|
||||
var originalInstruction = new byte[length];
|
||||
byte[] originalInstruction = new byte[length];
|
||||
if (!ReadMemory(address, originalInstruction))
|
||||
{
|
||||
Logger.Error?.Print(LogClass.GdbStub, $"Failed to read memory at 0x{address:X16} to set breakpoint.");
|
||||
@@ -65,7 +66,7 @@ namespace Ryujinx.HLE.Debugger
|
||||
return false;
|
||||
}
|
||||
|
||||
var breakpoint = new Breakpoint(originalInstruction);
|
||||
Breakpoint breakpoint = new(originalInstruction);
|
||||
if (_breakpoints.TryAdd(address, breakpoint))
|
||||
{
|
||||
Logger.Debug?.Print(LogClass.GdbStub, $"Breakpoint set at 0x{address:X16}");
|
||||
@@ -106,7 +107,7 @@ namespace Ryujinx.HLE.Debugger
|
||||
/// </summary>
|
||||
public void ClearAll()
|
||||
{
|
||||
foreach (var bp in _breakpoints)
|
||||
foreach (KeyValuePair<ulong, Breakpoint> bp in _breakpoints)
|
||||
{
|
||||
if (!WriteMemory(bp.Key, bp.Value.OriginalData))
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.HLE.HOS.Kernel.Process;
|
||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
@@ -25,11 +26,11 @@ namespace Ryujinx.HLE.Debugger
|
||||
|
||||
public string GetMinidump()
|
||||
{
|
||||
var response = new StringBuilder();
|
||||
StringBuilder response = new();
|
||||
response.AppendLine("=== Begin Minidump ===\n");
|
||||
response.AppendLine(GetProcessInfo());
|
||||
|
||||
foreach (var thread in GetThreads())
|
||||
foreach (KThread thread in GetThreads())
|
||||
{
|
||||
response.AppendLine($"=== Thread {thread.ThreadUid} ===");
|
||||
try
|
||||
@@ -66,7 +67,7 @@ namespace Ryujinx.HLE.Debugger
|
||||
if (Process is not { } kProcess)
|
||||
return "No application process found\n";
|
||||
|
||||
var sb = new StringBuilder();
|
||||
StringBuilder sb = new();
|
||||
|
||||
sb.AppendLine($"Program Id: 0x{kProcess.TitleId:x16}");
|
||||
sb.AppendLine($"Application: {(kProcess.IsApplication ? 1 : 0)}");
|
||||
@@ -81,7 +82,7 @@ namespace Ryujinx.HLE.Debugger
|
||||
$" Stack: 0x{kProcess.MemoryManager.StackRegionStart:x10} - 0x{kProcess.MemoryManager.StackRegionEnd - 1:x10}");
|
||||
|
||||
sb.AppendLine("Modules:");
|
||||
var debugger = kProcess.Debugger;
|
||||
HleProcessDebugger debugger = kProcess.Debugger;
|
||||
if (debugger != null)
|
||||
{
|
||||
foreach (HleProcessDebugger.Image image in debugger.GetLoadedImages())
|
||||
|
||||
@@ -194,7 +194,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = new byte[len];
|
||||
byte[] data = new byte[len];
|
||||
Debugger.DebugProcess.CpuMemory.Read(addr, data);
|
||||
Processor.Reply(Helpers.ToHex(data));
|
||||
}
|
||||
@@ -211,7 +211,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = new byte[len];
|
||||
byte[] data = new byte[len];
|
||||
for (ulong i = 0; i < len; i++)
|
||||
{
|
||||
data[i] = (byte)ss.ReadLengthAsHex(2);
|
||||
|
||||
@@ -267,7 +267,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||
{
|
||||
moduleName = string.Empty;
|
||||
|
||||
var rodataStart = image.BaseAddress + image.Size;
|
||||
ulong rodataStart = image.BaseAddress + image.Size;
|
||||
|
||||
KMemoryInfo roInfo = _owner.MemoryManager.QueryMemory(rodataStart);
|
||||
if (roInfo.Permission != KMemoryPermission.Read)
|
||||
@@ -275,7 +275,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||
return false;
|
||||
}
|
||||
|
||||
var rwdataStart = roInfo.Address + roInfo.Size;
|
||||
ulong rwdataStart = roInfo.Address + roInfo.Size;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -305,7 +305,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||
}
|
||||
|
||||
pathLength = Math.Min(pathLength, rodataBuf.Length - 8);
|
||||
var pathBuf = rodataBuf.Slice(8, pathLength);
|
||||
Span<byte> pathBuf = rodataBuf.Slice(8, pathLength);
|
||||
int lastSlash = pathBuf.LastIndexOfAny(new byte[] { (byte)'\\', (byte)'/' });
|
||||
|
||||
moduleName = Encoding.ASCII.GetString(pathBuf.Slice(lastSlash + 1).TrimEnd((byte)0));
|
||||
@@ -483,12 +483,11 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||
|
||||
lock (_images)
|
||||
{
|
||||
var image = new Image(textOffset, textSize, symbols.OrderBy(x => x.Value).ToArray());
|
||||
Image image = new(textOffset, textSize, symbols.OrderBy(x => x.Value).ToArray());
|
||||
|
||||
string moduleName;
|
||||
if (!GetModuleName(out moduleName, image))
|
||||
if (!GetModuleName(out string moduleName, image))
|
||||
{
|
||||
var newIndex = _images.Count;
|
||||
int newIndex = _images.Count;
|
||||
moduleName = $"(unknown{newIndex})";
|
||||
}
|
||||
image.Name = moduleName;
|
||||
|
||||
Reference in New Issue
Block a user