Added "runto" command. It takes a string argument, runs one 6502

instruction at a time, and before each instruction it disassembles the
next instruction. If the disassembly result contains the string arg,
stop executing and return.

This let us say things like "runto STA" to run until the next STA
instruction, or "runto LABEL", or whatever else. It does *not* use the
breakpoint nor trap mechanisms.

Unfortunately, as written, Debugger::disassemble is *slow*... "runto"
takes about 40-50 seconds to execute one frames' worth of 6502
instructions on an Athlon 1200. Also, as written, it's uninterruptible:
while it's slowly doing its thing, the SDL main loop isn't running,
so you can't even close the Stella window to get out...

Also, it would be nice to be able to tell "runto" which field you want
to search (address label, instruction name, operand). Splitting it out
this way could also make it faster: instead of doing a full disassemble
and searching it, we could have "runto LABEL" evaluate the label and
just stop when the PC equals the target (would be almost as fast as
just using a breakpoint). We may create separate commands for this:
"runtoaddr", "runtoinstr"...?

Being able to say "run until the next RTS instruction" is a lot more
expressive than having to disassemble until you find the RTS, set a
breakpoint after it, then "run", then remove the breakpoint...


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@632 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
urchlay 2005-07-11 18:56:27 +00:00
parent f5321fcfa4
commit 9bce69cd2b
2 changed files with 29 additions and 2 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DebuggerParser.cxx,v 1.49 2005-07-08 14:36:17 stephena Exp $
// $Id: DebuggerParser.cxx,v 1.50 2005-07-11 18:56:26 urchlay Exp $
//============================================================================
#include "bspf.hxx"
@ -267,6 +267,14 @@ Command DebuggerParser::commands[] = {
&DebuggerParser::executeRun
},
{
"runto",
"Run until first occurrence of string in disassembly",
false,
{ kARG_LABEL, kARG_END_ARGS },
&DebuggerParser::executeRunTo
},
{
"s",
"Set Stack Pointer to value xx",
@ -1202,6 +1210,24 @@ void DebuggerParser::executeRun() {
commandResult = "exiting debugger";
}
// "runto"
void DebuggerParser::executeRunTo() {
bool done = false;
int cycles = 0, count = 0;
do {
cycles += debugger->step();
if(++count % 100 == 0)
debugger->prompt()->putchar('.');
string next = debugger->disassemble(debugger->cpuDebug().pc(), 1);
done = (next.find(argStrings[0]) != string::npos);
} while(!done);
commandResult = "executed ";
commandResult += debugger->valueToString(cycles);
commandResult += " cycles";
}
// "s"
void DebuggerParser::executeS() {
debugger->cpuDebug().setSP(args[0]);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DebuggerParser.hxx,v 1.27 2005-07-03 08:15:31 urchlay Exp $
// $Id: DebuggerParser.hxx,v 1.28 2005-07-11 18:56:27 urchlay Exp $
//============================================================================
#ifndef DEBUGGER_PARSER_HXX
@ -122,6 +122,7 @@ class DebuggerParser
void executeRiot();
void executeRom();
void executeRun();
void executeRunTo();
void executeS();
void executeSaveses();
void executeSavestate();