Add cmd line: -debugger-auto-run <script file>

. Use this to override the default "DebuggerAutoRun.txt"
This commit is contained in:
tomcw
2025-08-31 17:38:39 +01:00
parent afe3824f99
commit 8b31042c13
5 changed files with 24 additions and 5 deletions

View File

@@ -777,6 +777,13 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
{
g_cmdLine.useAltCpuEmulation = true;
}
else if (strcmp(lpCmdLine, "-debugger-auto-run") == 0)
{
lpCmdLine = GetCurrArg(lpNextArg);
lpNextArg = GetNextArg(lpNextArg);
g_cmdLine.debuggerAutoRunScriptFilename = lpCmdLine;
}
else // unsupported
{
LogFileOutput("Unsupported arg: %s\n", lpCmdLine);

View File

@@ -126,7 +126,8 @@ struct CmdLine
bool auxSlotEmpty;
SS_CARDTYPE auxSlotInsert;
std::string sBootSectorFileName;
size_t nBootSectorFileSize;
size_t nBootSectorFileSize;
std::string debuggerAutoRunScriptFilename;
};
bool ProcessCmdLine(LPSTR lpCmdLine);

View File

@@ -360,6 +360,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
static bool g_bScriptReadOk = false;
static std::string g_sAutoRunScriptFilename("DebuggerAutoRun.txt");
// Private ________________________________________________________________________________________
@@ -9093,11 +9095,9 @@ void DebugInitialize ()
{
doneAutoRun = true;
const std::string debuggerAutoRunName = "DebuggerAutoRun.txt";
// Look in g_sCurrentDir, otherwise try g_sProgramDir
std::string pathname = g_sCurrentDir + debuggerAutoRunName;
std::string pathname = g_sCurrentDir + g_sAutoRunScriptFilename;
errno_t error = strncpy_s(g_aArgs[1].sArg, MAX_PATH, pathname.c_str(), pathname.size());
if (error != 0)
{
@@ -9111,7 +9111,7 @@ void DebugInitialize ()
if (!g_bScriptReadOk)
{
pathname = g_sProgramDir + debuggerAutoRunName;
pathname = g_sProgramDir + g_sAutoRunScriptFilename;
error = strncpy_s(g_aArgs[1].sArg, MAX_PATH, pathname.c_str(), pathname.size());
if (error != 0)
{
@@ -9829,3 +9829,10 @@ bool IsDebugSteppingAtFullSpeed (void)
{
return (g_nAppMode == MODE_STEPPING) && g_bDebugFullSpeed;
}
//===========================================================================
void DebugSetAutoRunScript (std::string& sAutoRunScriptFilename)
{
g_sAutoRunScriptFilename = sAutoRunScriptFilename;
}

View File

@@ -192,3 +192,4 @@
bool DebuggerCheckMemBreakpoints(WORD nAddress, WORD nSize, bool isDmaToMemory);
void ClearTempBreakpoints();
void DebugSetAutoRunScript(std::string& sAutoRunScriptFilename);

View File

@@ -930,6 +930,9 @@ static void RepeatInitialization(void)
if (g_cmdLine.useAltCpuEmulation)
ForceAltCpuEmulation();
if (!g_cmdLine.debuggerAutoRunScriptFilename.empty())
DebugSetAutoRunScript(g_cmdLine.debuggerAutoRunScriptFilename);
// Call DebugInitialize() after SetCurrentImageDir()
DebugInitialize();
LogFileOutput("Main: DebugInitialize()\n");