From 78a3b197f44f625f4fe4b372f814b2cc795b21e9 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Sun, 3 Dec 2017 17:07:47 +0100
Subject: [PATCH] loadconfig bug fixed save commands explained in debugger doc
load/saveconfig allowed for multi-bank ROMs (with warning)
---
docs/debugger.html | 119 +++++++++++++++++++++-----------
src/debugger/CartDebug.cxx | 21 +++---
src/debugger/DebuggerParser.cxx | 6 +-
3 files changed, 94 insertions(+), 52 deletions(-)
diff --git a/docs/debugger.html b/docs/debugger.html
index 989fb15ca..ff36d303f 100644
--- a/docs/debugger.html
+++ b/docs/debugger.html
@@ -349,7 +349,7 @@ to change the meaning of an expression. The prefixes are:
assumed to be in the default base. When you first start Stella,
the default base is 16 (hexadecimal). You can change it with the
"base" command. If you want to change the default base to decimal permanently,
- you can put a "base #10" command in your "autoexec.stella" file (see
+ you can put a "base #10" command in your "autoexec.script" file (see
the section on "Startup").
Remember, you can use arbitrarily complex expressions with any
@@ -357,7 +357,7 @@ to change the meaning of an expression. The prefixes are:
-
+
Breakpoints, watches and traps, oh my!
Breakpoints
@@ -463,41 +463,6 @@ presses both Select and Reset:
and expression for each function. Functions can be removed with
"delfunction label", where the labels come from "listfunctions".
-If you've defined a lot of complex functions, you probably will
-want to re-use them in future runs of the debugger. You can save all
-your functions, breakpoints, conditional breaks, and watches with the
-"save" command. If you name your saved file the same as the ROM filename
-and place it in the ROM directory, it'll be auto-loaded next time you
-load the same ROM in Stella. The save file is just a plain text file
-called "rom_filename.stella", so you can edit it and add new functions, etc.
-You can also create a file called "autoexec.stella" which will be loaded
-when the debugger starts, no matter what ROM you have loaded. The location
-of this file will depend on the version of Stella, as follows:
-
-
-
- Linux/Unix |
- ~/.stella/autoexec.stella |
-
-
- Macintosh |
- ~/Library/Application Support/Stella/autoexec.stella |
-
-
- Windows |
- %APPDATA%\Stella\autoexec.stella
- OR
- _BASEDIR_\autoexec.stella
- (if a file named 'basedir.txt' exists in the application
- directory containing the full pathname for _BASEDIR_)
- |
-
-
-Note that these '.stella' script files are only accessed if you enter
-the debugger at least once during a program run. This means you can create
-these files, and not worry about slowing down emulation unless you're
-actively using the debugger.
-
Built-in Functions
Stella has some pre-defined functions for use with the "breakif"
@@ -632,6 +597,81 @@ can remove a trap with "deltrap number", where the number comes from
"listtraps" or by entering the identical trap again. You can get rid of
all traps at once with the "cleartraps" command.
+
+Save your work!
+Stella offers several commands to save your work inside the debugger for
+later re-use.
+
+save
+If you've defined a lot of complex functions, you probably will
+want to re-use them in future runs of the debugger. You can save all
+your functions, breakpoints, conditional breaks, traps and watches with the
+"save" command. If you name your saved file the same as the ROM filename
+and place it in the ROM directory, it'll be auto-loaded next time you
+load the same ROM in Stella. The save file is just a plain text file
+called "rom_filename.script", so you can edit it and add new functions, etc.
+While "save" is ROM specific, you can also create a file called
+"autoexec.script" which will be loaded when the debugger starts, no matter
+what ROM you have loaded. The location of this file will depend on the
+version of Stella, as follows:
+
+
+
+ Linux/Unix |
+ ~/.stella/autoexec.script |
+
+
+ Macintosh |
+ ~/Library/Application Support/Stella/autoexec.script |
+
+
+ Windows |
+ %APPDATA%\Stella\autoexec.script
+ OR
+ _BASEDIR_\autoexec.script
+ (if a file named 'basedir.txt' exists in the application
+ directory containing the full pathname for _BASEDIR_)
+ |
+
+
+Note that these '.script' script files are only accessed if you enter
+the debugger at least once during a program run. This means you can create
+these files, and not worry about slowing down emulation unless you're
+actively using the debugger.
+
+saveconfig
+The "saveconfig" command creates a DiStella configuration file which is
+based on Stella's runtime and static analsyis of the current ROM.
+This will be automatically loaded the next time your start the debugger.
+From there on, you can continue analyzing the ROM and then use "saveconfig"
+again to update the configuration. You can also use "loadconfig" to load it
+manually.
+
Note that this is not tested for multi-banked ROMs.
+
+savedis
+While your are playing or debugging a game, Stella will gather runtime
+information about the ROM. It can then use that information together with
+a static analysis of the ROM and therefore create a better disassembly
+than DiStella alone. "savedis" allows you to save that disassembly as the
+result of this combined analysis.
+Note that this currently only works for single banked ROMs. For larger
+ROMs, the created disassembly is incomplete.
+
+saverom
+If you have manipulated a ROM, you can save it with "saverom". The file is
+named '<rom_filename>.a26'.
+
+saveses
+The "saveses" command dumps the whole prompt session into a file named
+"YYYY-MM-DD_HH-mm-ss.txt". So you can later lookup what you did exactly
+when you were debugging at that time.
+
+savestate
+This command work identical to the save state hotkey (F9) during emulation.
+Any previously saved state can be loaded with "loadstate" plus the slot
+number (0-9).
+
+
Prompt commands:
Type "help" to see this list in the debugger.
@@ -702,11 +742,11 @@ clearsavestateifs - Clear all savestate points
runto - Run until string xx in disassembly
runtopc - Run until PC is set to value xx
s - Set Stack Pointer to value xx
- save - Save breaks, watches, traps to file xx
+ save - Save breaks, watches, traps and functions to file xx
saveconfig - Save Distella config file (with default name)
savedis - Save Distella disassembly (with default name)
saverom - Save (possibly patched) ROM (with default name)
- saveses - Save console session to file xx
+ saveses - Save console session (with default name)
savesnap - Save current TIA image to PNG file
savestate - Save emulator state xx (valid args 0-9)
savestateif - Create savestate on <condition>
@@ -732,7 +772,6 @@ clearsavestateifs - Clear all savestate points
z - Zero Flag: set (0 or 1), or toggle (no arg)
-
(B) TIA Tab
diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx
index 108c3d62a..8850ee4a3 100644
--- a/src/debugger/CartDebug.cxx
+++ b/src/debugger/CartDebug.cxx
@@ -831,9 +831,6 @@ string CartDebug::loadSymbolFile()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartDebug::loadConfigFile()
{
- if(myConsole.cartridge().bankCount() > 1)
- return DebuggerParser::red("config file for multi-bank ROM not yet supported");
-
// There are two possible locations for loading config files
// (in order of decreasing relevance):
// 1) ROM dir based on properties entry name
@@ -934,15 +931,17 @@ string CartDebug::loadConfigFile()
}
myDebugger.rom().invalidate();
- return "loaded " + node.getShortPath() + " OK";
+ stringstream retVal;
+ if(myConsole.cartridge().bankCount() > 1)
+ retVal << DebuggerParser::red("config file for multi-bank ROM not fully supported\n");
+ retVal << "loaded " << node.getShortPath() << " OK";
+ return retVal.str();
+
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartDebug::saveConfigFile()
{
- if(myConsole.cartridge().bankCount() > 1)
- return DebuggerParser::red("config file for multi-bank ROM not yet supported");
-
// While there are two possible locations for loading config files,
// the main 'config' directory is used whenever possible when saving,
// unless the rom-specific file already exists
@@ -977,7 +976,11 @@ string CartDebug::saveConfigFile()
getBankDirectives(out, myBankInfo[b]);
}
- return "saved " + node.getShortPath() + " OK";
+ stringstream retVal;
+ if(myConsole.cartridge().bankCount() > 1)
+ retVal << DebuggerParser::red("config file for multi-bank ROM not fully supported\n");
+ retVal << "saved " << node.getShortPath() << " OK";
+ return retVal.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -1363,7 +1366,7 @@ void CartDebug::getBankDirectives(ostream& buf, BankInfo& info) const
buf << "ORG " << Base::HEX4 << info.offset << endl;
// Now consider each byte
- uInt16 prev = info.offset, addr = prev + 1;
+ uInt32 prev = info.offset, addr = prev + 1;
DisasmType prevType = disasmTypeAbsolute(mySystem.getAccessFlags(prev));
for( ; addr < info.offset + info.size; ++addr)
{
diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx
index 2a310ee00..58837e270 100644
--- a/src/debugger/DebuggerParser.cxx
+++ b/src/debugger/DebuggerParser.cxx
@@ -2878,8 +2878,8 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
{
"save",
- "Save breaks, watches, traps to file xx",
- "Example: save commands.txt",
+ "Save breaks, watches, traps and functions to file xx",
+ "Example: save commands.script",
true,
false,
{ kARG_FILE, kARG_END_ARGS },
@@ -2920,7 +2920,7 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
{
"saveses",
- "Save console session",
+ "Save console session (with default name)",
"Example: saveses\n"
"NOTE: saves to default save location",
false,