Add -debugwait cmd line arg to wait for C# debugger attach on engine start

This commit is contained in:
Wojtek Figat
2021-05-14 19:25:31 +02:00
parent 5745e4e522
commit 16e67780ad
3 changed files with 13 additions and 1 deletions

View File

@@ -109,7 +109,10 @@ bool CommandLine::Parse(const Char* cmdLine)
PARSE_BOOL_SWITCH("-novsync ", NoVSync);
PARSE_BOOL_SWITCH("-nolog ", NoLog);
PARSE_BOOL_SWITCH("-std ", Std);
#if !BUILD_RELEASE
PARSE_ARG_SWITCH("-debug ", DebuggerAddress);
PARSE_BOOL_SWITCH("-debugwait ", WaitForDebugger);
#endif
#if PLATFORM_HAS_HEADLESS_MODE
PARSE_BOOL_SWITCH("-headless ", Headless);
#endif

View File

@@ -49,11 +49,20 @@ public:
/// </summary>
Nullable<bool> Std;
#if !BUILD_RELEASE
/// <summary>
/// -debug !ip:port! (Mono debugger address)
/// </summary>
Nullable<String> DebuggerAddress;
/// <summary>
/// -debugwait (instructs Mono debugger to wait for client attach for 5 seconds)
/// </summary>
Nullable<bool> WaitForDebugger;
#endif
#if PLATFORM_HAS_HEADLESS_MODE
/// <summary>

View File

@@ -423,7 +423,7 @@ bool MCore::LoadEngine()
}
char buffer[150];
sprintf(buffer, "--debugger-agent=transport=dt_socket,address=%s:%d,embedding=1,server=y,suspend=n,loglevel=%d", debuggerIp.Get(), debuggerPort, debuggerLogLevel);
sprintf(buffer, "--debugger-agent=transport=dt_socket,address=%s:%d,embedding=1,server=y,suspend=%s,loglevel=%d", debuggerIp.Get(), debuggerPort, CommandLine::Options.WaitForDebugger ? "y,timeout=5000" : "n", debuggerLogLevel);
const char* options[] = {
"--soft-breakpoints",