Debugger: Add dbg.logexec option to log debugger script execution output (fixes #1121)#1122
Merged
sa666666 merged 8 commits intostella-emu:masterfrom Feb 14, 2026
Merged
Conversation
Member
|
Are you going to update the Debugger documentation too? |
Contributor
Author
Yes, I just updated the Debugger documentation too. The |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description
Summary
This PR adds two new command line arguments that enhance Stella's debugger scripting capabilities:
-dbg.logexec- Enables logging of debugger script execution output to a file-dbg.script- Specifies a custom script file to execute on debugger startupThese features make it possible to use Stella's debugger scripts in automated and headless workflows, where debugger UI output is not available.
This addresses feature request #1121 and is related to #509.
Motivation
Debugger scripts executed via the
execcommand currently write their output only to the debugger UI. This makes it difficult to:For example, a script that advances frames and prints
_scanEndcannot currently be validated without manual interaction.Changes
New
-dbg.logexecoptionAdded new command line argument
dbg.logexec(default: false)-dbg.logexec 1 -dbg.logexec truelogExec, which toggles exec script logging on/off in the interactive debuggerLogging behavior:
When enabled, all executed debugger commands and their results are written to:
Format:
Example output:
Log write failures are non-blocking and emit a warning without interrupting script execution.
New
-dbg.scriptparameterAdded command line parameter
-dbg.script <file>to specify a custom script file to execute on debugger startup.Execution order:
autoexec.script(if present)[romname].script(if present)-dbg.script(if provided)Use case:
Allows running temporary or session-specific debug scripts without modifying permanent
autoexec.scriptor[romname].scriptfiles. Particularly useful for:-dbg.logexecfor fully automated script execution and result captureScript parsing improvements
;are treated as comments and skippedUsage Examples
Basic script execution with logging
In debugger:
Output written to:
test.script.output.txtBasic script execution with automatic logging
stella -dbg.logexec true -debug game.binIn debugger:
Output written to:
test.script.output.txtCustom script on startup
Automated testing workflow
# Combine both features for fully automated debugging stella -dbg.script custom.script -dbg.logexec 1 -debug game.binThis will:
custom.scripton debugger startup (after autoexec and romname scripts)custom.script.output.txtFiles Modified
-dbg.logexecchanges:src/emucore/Settings.cxx- Added parameter definition and help textsrc/debugger/DebuggerParser.cxx- Added logging functionality and comment parsingsrc/gui/DeveloperDialog.cxx- Added UI toggle for logExecdocs/index.html- Added command line parameter documentation-dbg.scriptchanges:src/emucore/Settings.cxx- Added parameter definition and help textsrc/debugger/Debugger.cxx- ModifiedautoExec()to execute the specified scriptdocs/index.html- Added command line parameter documentationdocs/debugger.html- Updated Startup section with execution order detailsNotes
These changes do not alter existing debugger behavior when the new options are disabled and are fully opt-in.