gdb: Catch SocketException from TcpListener#Start

This commit is contained in:
GreemDev 2025-10-21 22:15:14 -05:00
parent 886981004d
commit 1bb2af84ce
2 changed files with 14 additions and 3 deletions

View file

@ -1,5 +1,6 @@
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.HLE.Debugger.Gdb; using Ryujinx.HLE.Debugger.Gdb;
using System;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
@ -9,11 +10,21 @@ namespace Ryujinx.HLE.Debugger
{ {
public partial class Debugger public partial class Debugger
{ {
private void DebuggerThreadMain() private void MainLoop()
{ {
IPEndPoint endpoint = new(IPAddress.Any, GdbStubPort); IPEndPoint endpoint = new(IPAddress.Any, GdbStubPort);
_listenerSocket = new TcpListener(endpoint); _listenerSocket = new TcpListener(endpoint);
try
{
_listenerSocket.Start(); _listenerSocket.Start();
}
catch (SocketException se)
{
Logger.Notice.Print(LogClass.GdbStub, $"Failed to create TCP client for GDB client: {Enum.GetName(se.SocketErrorCode)}");
return;
}
Logger.Notice.Print(LogClass.GdbStub, $"Currently waiting on {endpoint} for GDB client"); Logger.Notice.Print(LogClass.GdbStub, $"Currently waiting on {endpoint} for GDB client");
while (!_shuttingDown) while (!_shuttingDown)

View file

@ -45,7 +45,7 @@ namespace Ryujinx.HLE.Debugger
ARMeilleure.Optimizations.EnableDebugging = true; ARMeilleure.Optimizations.EnableDebugging = true;
_debuggerThread = new Thread(DebuggerThreadMain); _debuggerThread = new Thread(MainLoop);
_debuggerThread.Start(); _debuggerThread.Start();
_messageHandlerThread = new Thread(MessageHandlerMain); _messageHandlerThread = new Thread(MessageHandlerMain);
_messageHandlerThread.Start(); _messageHandlerThread.Start();