Fixed issue with 'runto' debugger command sometimes not exiting. It can

now only run for 10000 disassembled instructions, and then it will exit.
Related to this, removed the hack that let the 'runto' command
continuously run while updating the debugger, since it was buggy and didn't
really work anyway.  So if 'runto' doesn't find what it needs in 10000
instructions, you'll need to run it again.  Perhaps for a future release,
the number of instructions can be user-defined.

Made 'gl_vsync' not be the default for Unix/Linux systems, since very few
systems support it though SDL yet.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1222 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-12-18 14:01:58 +00:00
parent 43d942c015
commit f53d93446b
8 changed files with 27 additions and 82 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: Debugger.hxx,v 1.85 2006-12-08 16:48:59 stephena Exp $
// $Id: Debugger.hxx,v 1.86 2006-12-18 14:01:57 stephena Exp $
//============================================================================
#ifndef DEBUGGER_HXX
@ -69,7 +69,7 @@ typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)();
for all debugging operations in Stella (parser, 6502 debugger, etc).
@author Stephen Anthony
@version $Id: Debugger.hxx,v 1.85 2006-12-08 16:48:59 stephena Exp $
@version $Id: Debugger.hxx,v 1.86 2006-12-18 14:01:57 stephena Exp $
*/
class Debugger : public DialogContainer
{
@ -159,12 +159,6 @@ class Debugger : public DialogContainer
*/
const string run(const string& command);
/**
Indicate if the debugger is currently running a command
(it shouldn't be exited in this case)
*/
bool isBlocked() { return myParser->commandRunning(); }
/**
Give the contents of the CPU registers and disassembly of
next instruction.

View File

@ -13,10 +13,11 @@
// 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.94 2006-12-15 16:42:54 stephena Exp $
// $Id: DebuggerParser.cxx,v 1.95 2006-12-18 14:01:57 stephena Exp $
//============================================================================
#include <fstream>
#include <sstream>
#include "bspf.hxx"
#include "Dialog.hxx"
@ -40,9 +41,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DebuggerParser::DebuggerParser(Debugger* d)
: debugger(d),
myRunningFlag(false),
myCancelFlag(false)
: debugger(d)
{
defaultBase = kBASE_16;
}
@ -101,16 +100,13 @@ string DebuggerParser::run(const string& command)
cerr << "Expression count: " << refCount << endl;
#endif
commandResult = "";
myCancelFlag = false;
for(int i = 0; i < kNumCommands; ++i)
{
if(verb == commands[i].cmdString)
{
myRunningFlag = true;
if(validateArgs(i))
CALL_METHOD(commands[i].executor);
myRunningFlag = false;
if(commands[i].refreshRequired)
debugger->myBaseDialog->loadConfig();
@ -123,13 +119,6 @@ string DebuggerParser::run(const string& command)
return commandResult;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerParser::cancel()
{
// Indicate to any blocking commands that it's time to quit
myCancelFlag = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string DebuggerParser::exec(const string& file, bool verbose)
{
@ -1174,29 +1163,25 @@ void DebuggerParser::executeRun()
// "runto"
void DebuggerParser::executeRunTo()
{
ostringstream buf;
bool done = false;
int cycles = 0, count = 0;
do {
if(myCancelFlag) break;
cycles += debugger->step();
// This command can potentially block forever
// We should yield to the system, and check for cancellation
if(++count % 10000 == 0)
{
debugger->prompt()->putchar('.');
debugger->getOSystem()->run();
}
string next = debugger->disassemble(debugger->cpuDebug().pc(), 1);
done = (next.find(argStrings[0]) != string::npos);
} while(!done);
++count;
} while(!done && count < 10000);
commandResult = "executed ";
commandResult += debugger->valueToString(cycles);
commandResult += " cycles";
if(done)
buf << "found " << argStrings[0] << " in " << debugger->valueToString(cycles)
<< " cycles";
else
buf << argStrings[0] << " not found in " << debugger->valueToString(count)
<< " disassembled instructions";
commandResult = buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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.46 2006-12-08 16:49:00 stephena Exp $
// $Id: DebuggerParser.hxx,v 1.47 2006-12-18 14:01:58 stephena Exp $
//============================================================================
#ifndef DEBUGGER_PARSER_HXX
@ -42,12 +42,6 @@ class DebuggerParser
/** Run the given command, and return the result */
string run(const string& command);
/** Indicate if a command is currently running */
bool commandRunning() { return myRunningFlag; }
/** Cancel the currently running command, if any */
void cancel();
/** Execute parser commands given in 'file' */
string exec(const string& file, bool verbose = true);
@ -129,12 +123,6 @@ class DebuggerParser
// The results of the currently running command
string commandResult;
// Indicates whether a command is currently running, or a cancel
// event has been received
// Commands which expect to block for long periods of time should
// occasionally check the myCancelFlag
bool myRunningFlag, myCancelFlag;
// Arguments in 'int' and 'string' format for the currently running command
IntArray args;
StringList argStrings;

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: PromptWidget.cxx,v 1.13 2006-12-15 16:42:55 stephena Exp $
// $Id: PromptWidget.cxx,v 1.14 2006-12-18 14:01:58 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -521,10 +521,6 @@ void PromptWidget::specialKeys(int keycode)
_currentPos = _promptStartPos;
handled = true;
break;
case 'c':
instance()->debugger().parser()->cancel();
handled = true;
break;
case 'd':
killChar(+1);
handled = true;

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: EventHandler.cxx,v 1.187 2006-12-15 16:42:57 stephena Exp $
// $Id: EventHandler.cxx,v 1.188 2006-12-18 14:01:58 stephena Exp $
//============================================================================
#include <sstream>
@ -2280,10 +2280,6 @@ void EventHandler::leaveDebugMode()
if(myState != S_DEBUGGER)
return;
// If for any reason a command is currently running, we can't exit the debugger
if(myOSystem->debugger().isBlocked())
return;
// Make sure debugger quits in a consistent state
myOSystem->debugger().setQuitState();

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: OSystem.cxx,v 1.80 2006-12-15 16:42:58 stephena Exp $
// $Id: OSystem.cxx,v 1.81 2006-12-18 14:01:58 stephena Exp $
//============================================================================
#include <cassert>
@ -524,13 +524,6 @@ bool OSystem::openROM(const string& rom, string& md5, uInt8** image, int* size)
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::run() const
{
myEventHandler->poll(0);
myFrameBuffer->update();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::setDefaultJoymap()
{

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: OSystem.hxx,v 1.46 2006-12-15 16:42:58 stephena Exp $
// $Id: OSystem.hxx,v 1.47 2006-12-18 14:01:58 stephena Exp $
//============================================================================
#ifndef OSYSTEM_HXX
@ -45,7 +45,7 @@ class VideoDialog;
other objects belong.
@author Stephen Anthony
@version $Id: OSystem.hxx,v 1.46 2006-12-15 16:42:58 stephena Exp $
@version $Id: OSystem.hxx,v 1.47 2006-12-18 14:01:58 stephena Exp $
*/
class OSystem
{
@ -271,16 +271,6 @@ class OSystem
*/
bool openROM(const string& rom, string& md5, uInt8** image, int* size);
/**
Runs through one iteration of the OSystem loop, which consists of
checking for events, rendering the framebuffer, etc.
This method isn't meant to be used from mainLoop(), but instead is
used as a sort of 'yield' function, whereby other parts of the code
may block for a time, and we need to check for cancellation (used
to emulate a poor man's threading system).
*/
void run() const;
public:
//////////////////////////////////////////////////////////////////////
// The following methods are system-specific and must be implemented

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: SettingsUNIX.cxx,v 1.19 2006-12-18 12:53:33 stephena Exp $
// $Id: SettingsUNIX.cxx,v 1.20 2006-12-18 14:01:58 stephena Exp $
//============================================================================
#include "bspf.hxx"
@ -27,7 +27,10 @@ SettingsUNIX::SettingsUNIX(OSystem* osystem)
// This argument is only valid for Linux/UNIX, and will eventually be removed
setInternal("accurate", "false");
setInternal("gl_lib", "libGL.so");
setInternal("gl_vsync", "false"); // Most Linux GL implementations don't support this yet
// Most Linux GL implementations don't support this yet
setInternal("gl_vsync", "false");
// For whatever reason, this is very efficient in Linux
setInternal("dirtyrects", "true");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -