Added -debug command line option to make Stella start in the debugger.

Added -debugheight command line option. The height may not be set to
anything below 383 (which is the default).

Attempted to implement a "height" command in the prompt, but either I'm
doing something wrong (most likely), or the debugger can't be resized
after it's started.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@531 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
urchlay 2005-06-19 16:53:57 +00:00
parent 2afcf0cd4f
commit 7051819948
5 changed files with 58 additions and 9 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: mainSDL.cxx,v 1.46 2005-06-17 14:42:48 stephena Exp $
// $Id: mainSDL.cxx,v 1.47 2005-06-19 16:53:57 urchlay Exp $
//============================================================================
#include <fstream>
@ -178,7 +178,11 @@ int main(int argc, char* argv[])
if(argc == 1 || !FilesystemNode::fileExists(romfile))
theOSystem->createLauncher();
else
{
theOSystem->createConsole(romfile);
if(theOSystem->settings().getBool("debug"))
handler.enterDebugMode();
}
// Start the main loop, and don't exit until the user issues a QUIT command
theOSystem->mainLoop();

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.cxx,v 1.18 2005-06-19 08:29:39 urchlay Exp $
// $Id: Debugger.cxx,v 1.19 2005-06-19 16:53:57 urchlay Exp $
//============================================================================
#include "bspf.hxx"
@ -59,10 +59,14 @@ Debugger::~Debugger()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::initialize()
{
int userHeight = myOSystem->settings().getInt("debugheight");
if(userHeight < kDebuggerHeight)
userHeight = kDebuggerHeight;
int x = 0,
y = myConsole->mediaSource().height(),
w = kDebuggerWidth,
h = kDebuggerHeight - y;
h = userHeight - y;
delete myBaseDialog;
DebuggerDialog *dd = new DebuggerDialog(myOSystem, this, x, y, w, h);
@ -73,8 +77,12 @@ void Debugger::initialize()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::initializeVideo()
{
int userHeight = myOSystem->settings().getInt("debugheight");
if(userHeight < kDebuggerHeight)
userHeight = kDebuggerHeight;
string title = string("Stella version ") + STELLA_VERSION + ": Debugger mode";
myOSystem->frameBuffer().initialize(title, kDebuggerWidth, kDebuggerHeight, false);
myOSystem->frameBuffer().initialize(title, kDebuggerWidth, userHeight, false);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -473,3 +481,21 @@ int Debugger::peek(int addr) {
int Debugger::dpeek(int addr) {
return mySystem->peek(addr) | (mySystem->peek(addr+1) << 8);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Debugger::setHeight(int height) {
if(height == 0)
height = kDebuggerHeight;
if(height < kDebuggerHeight)
return false;
myOSystem->settings().setInt("debugheight", height);
/*
// FIXME: this segfaults
quit();
initialize();
initializeVideo();
*/
return 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: Debugger.hxx,v 1.16 2005-06-19 08:29:39 urchlay Exp $
// $Id: Debugger.hxx,v 1.17 2005-06-19 16:53:57 urchlay Exp $
//============================================================================
#ifndef DEBUGGER_HXX
@ -49,7 +49,7 @@ enum {
for all debugging operations in Stella (parser, 6502 debugger, etc).
@author Stephen Anthony
@version $Id: Debugger.hxx,v 1.16 2005-06-19 08:29:39 urchlay Exp $
@version $Id: Debugger.hxx,v 1.17 2005-06-19 16:53:57 urchlay Exp $
*/
class Debugger : public DialogContainer
{
@ -130,6 +130,7 @@ class Debugger : public DialogContainer
void toggleBreakPoint(int bp);
bool breakPoint(int bp);
string disassemble(int start, int lines);
bool setHeight(int height);
public:
/**

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.16 2005-06-19 08:37:29 urchlay Exp $
// $Id: DebuggerParser.cxx,v 1.17 2005-06-19 16:53:57 urchlay Exp $
//============================================================================
#include "bspf.hxx"
@ -449,7 +449,18 @@ string DebuggerParser::run(const string& command) {
return "OK";
} else if(subStringMatch(verb, "clearbreaks")) {
debugger->clearAllBreakPoints();
return "cleared all breakpoints";
} else if(subStringMatch(verb, "height")) {
if(argCount != 1)
return "one argument required";
return "This command is not yet supported. Start Stella with the -debugheight option instead.";
/*
if(debugger->setHeight(args[0]))
//return "Stella will use the new height next time it starts.";
return "OK";
else
return "bad height (use 0 for default, min height #383)";
*/
} else if(subStringMatch(verb, "print")) {
if(argCount < 1)
return "one or more arguments required";
@ -498,6 +509,7 @@ string DebuggerParser::run(const string& command) {
"disasm - Disassemble (from current PC)\n"
"disasm xx - Disassemble (from address xx)\n"
"frame - Advance to next TIA frame, then break\n"
"height xx - Set height of debugger window in pixels\n"
"listbreaks - List all breakpoints\n"
"loadsym f - Load DASM symbols from file f\n"
"n - Toggle Negative Flag\n"

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: Settings.cxx,v 1.49 2005-06-17 14:42:49 stephena Exp $
// $Id: Settings.cxx,v 1.50 2005-06-19 16:53:57 urchlay Exp $
//============================================================================
#include <cassert>
@ -50,6 +50,7 @@ Settings::Settings(OSystem* osystem)
set("grabmouse", "false");
set("center", "true");
set("palette", "standard");
set("debugheight", "383");
set("sound", "true");
set("fragsize", "512");
@ -146,6 +147,11 @@ bool Settings::loadCommandLine(int argc, char** argv)
set(key, "true", false); // this confusing line means set 'listrominfo'
return true; // to true, but don't save to the settings file
}
else if(key == "debug") // this doesn't make Stella exit
{
set(key, "true", false); // don't save this to the config file either
return true;
}
if(++i >= argc)
{