mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 13:27:41 -07:00
Fix gdb break on start & gdb ports not closing after restarting/crashing (#2167)
This commit is contained in:
parent
98d969ab15
commit
b60f42b281
@ -110,6 +110,7 @@ const u32 ARM::ConditionTable[16] =
|
|||||||
ARM::ARM(u32 num, bool jit, std::optional<GDBArgs> gdb, melonDS::NDS& nds) :
|
ARM::ARM(u32 num, bool jit, std::optional<GDBArgs> gdb, melonDS::NDS& nds) :
|
||||||
#ifdef GDBSTUB_ENABLED
|
#ifdef GDBSTUB_ENABLED
|
||||||
GdbStub(this, gdb ? (num ? gdb->PortARM7 : gdb->PortARM9) : 0),
|
GdbStub(this, gdb ? (num ? gdb->PortARM7 : gdb->PortARM9) : 0),
|
||||||
|
BreakOnStartup(gdb ? (num ? gdb->ARM7BreakOnStartup : gdb->ARM9BreakOnStartup) : false),
|
||||||
#endif
|
#endif
|
||||||
Num(num), // well uh
|
Num(num), // well uh
|
||||||
NDS(nds)
|
NDS(nds)
|
||||||
|
@ -101,6 +101,15 @@ bool GdbStub::Init()
|
|||||||
Log(LogLevel::Error, "[GDB] err: can't create a socket fd\n");
|
Log(LogLevel::Error, "[GDB] err: can't create a socket fd\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
// Make sure the port can be reused immediately after melonDS stops and/or restarts
|
||||||
|
int enable = 1;
|
||||||
|
#ifdef _WIN32
|
||||||
|
setsockopt(SockFd, SOL_SOCKET, SO_REUSEADDR, (const char*)&enable, sizeof(enable));
|
||||||
|
#else
|
||||||
|
setsockopt(SockFd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#ifndef __linux__
|
#ifndef __linux__
|
||||||
SocketSetBlocking(SockFd, false);
|
SocketSetBlocking(SockFd, false);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user