diff --git a/stella/src/debugger/Debugger.cxx b/stella/src/debugger/Debugger.cxx index 4980d7709..588465fea 100644 --- a/stella/src/debugger/Debugger.cxx +++ b/stella/src/debugger/Debugger.cxx @@ -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.61 2005-07-14 00:54:27 stephena Exp $ +// $Id: Debugger.cxx,v 1.62 2005-07-14 11:28:37 stephena Exp $ //============================================================================ #include "bspf.hxx" @@ -37,6 +37,8 @@ #include "Debugger.hxx" +Debugger* Debugger::myStaticDebugger; + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Debugger::Debugger(OSystem* osystem) : DialogContainer(osystem), @@ -57,6 +59,12 @@ Debugger::Debugger(OSystem* osystem) breakPoints = new PackedBitArray(0x10000); readTraps = new PackedBitArray(0x10000); writeTraps = new PackedBitArray(0x10000); + + // Allow access to this object from any class + // Technically this violates pure OO programming, but since I know + // there will only be ever one instance of debugger in Stella, + // I don't care :) + myStaticDebugger = this; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -153,6 +161,10 @@ void Debugger::setConsole(Console* console) delete myTiaDebug; myTiaDebug = new TIADebug(this, myConsole); + // Let the parser know about the new subsystems (so YaccParser can use them) +// FIXME +// myParser->updateDebugger(this, myConsole); + autoLoadSymbols(myOSystem->romFile()); saveOldState(); diff --git a/stella/src/debugger/Debugger.hxx b/stella/src/debugger/Debugger.hxx index c033fcdda..901c3e29d 100644 --- a/stella/src/debugger/Debugger.hxx +++ b/stella/src/debugger/Debugger.hxx @@ -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.49 2005-07-14 00:54:28 stephena Exp $ +// $Id: Debugger.hxx,v 1.50 2005-07-14 11:28:37 stephena Exp $ //============================================================================ #ifndef DEBUGGER_HXX @@ -52,7 +52,7 @@ enum { for all debugging operations in Stella (parser, 6502 debugger, etc). @author Stephen Anthony - @version $Id: Debugger.hxx,v 1.49 2005-07-14 00:54:28 stephena Exp $ + @version $Id: Debugger.hxx,v 1.50 2005-07-14 11:28:37 stephena Exp $ */ class Debugger : public DialogContainer { @@ -206,6 +206,16 @@ class Debugger : public DialogContainer return to_bin(dec, 16, buf); } + /** + This is used when we want the debugger from a class that can't + receive the debugger object in any other way. + + It's basically a hack to prevent the need to pass debugger objects + everywhere, but I feel it's better to place it here then in + YaccParser (which technically isn't related to it at all). + */ + static Debugger& debugger() { return *myStaticDebugger; } + private: /** Save state of each debugger subsystem @@ -281,6 +291,8 @@ class Debugger : public DialogContainer PackedBitArray *readTraps; PackedBitArray *writeTraps; PromptWidget *myPrompt; + + static Debugger* myStaticDebugger; }; #endif diff --git a/stella/src/debugger/DebuggerParser.cxx b/stella/src/debugger/DebuggerParser.cxx index 445a5e6dc..667cf4044 100644 --- a/stella/src/debugger/DebuggerParser.cxx +++ b/stella/src/debugger/DebuggerParser.cxx @@ -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.53 2005-07-14 00:54:28 stephena Exp $ +// $Id: DebuggerParser.cxx,v 1.54 2005-07-14 11:28:37 stephena Exp $ //============================================================================ #include "bspf.hxx" +#include "Console.hxx" #include "Debugger.hxx" #include "CpuDebug.hxx" #include "DebuggerParser.hxx" diff --git a/stella/src/debugger/DebuggerParser.hxx b/stella/src/debugger/DebuggerParser.hxx index 00e9fc43e..09ec2b4fe 100644 --- a/stella/src/debugger/DebuggerParser.hxx +++ b/stella/src/debugger/DebuggerParser.hxx @@ -13,12 +13,13 @@ // 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.29 2005-07-14 00:54:28 stephena Exp $ +// $Id: DebuggerParser.hxx,v 1.30 2005-07-14 11:28:37 stephena Exp $ //============================================================================ #ifndef DEBUGGER_PARSER_HXX #define DEBUGGER_PARSER_HXX +class Console; class Debugger; struct Command; diff --git a/stella/src/debugger/EquateExpression.cxx b/stella/src/debugger/EquateExpression.cxx new file mode 100644 index 000000000..9e6453bab --- /dev/null +++ b/stella/src/debugger/EquateExpression.cxx @@ -0,0 +1,27 @@ +//============================================================================ +// +// SSSS tt lll lll +// SS SS tt ll ll +// SS tttttt eeee ll ll aaaa +// SSSS tt ee ee ll ll aa +// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" +// SS SS tt ee ll ll aa aa +// SSSS ttt eeeee llll llll aaaaa +// +// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team +// +// See the file "license" for information on usage and redistribution of +// this file, and for a DISCLAIMER OF ALL WARRANTIES. +// +// $Id: EquateExpression.cxx,v 1.1 2005-07-14 11:28:37 stephena Exp $ +//============================================================================ + +#include "Expression.hxx" +#include "EquateExpression.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +EquateExpression::EquateExpression(const string& label) + : Expression(0, 0), + myLabel(label) +{ +} diff --git a/stella/src/debugger/EquateExpression.hxx b/stella/src/debugger/EquateExpression.hxx new file mode 100644 index 000000000..c412e8f5f --- /dev/null +++ b/stella/src/debugger/EquateExpression.hxx @@ -0,0 +1,41 @@ +//============================================================================ +// +// SSSS tt lll lll +// SS SS tt ll ll +// SS tttttt eeee ll ll aaaa +// SSSS tt ee ee ll ll aa +// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" +// SS SS tt ee ll ll aa aa +// SSSS ttt eeeee llll llll aaaaa +// +// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team +// +// See the file "license" for information on usage and redistribution of +// this file, and for a DISCLAIMER OF ALL WARRANTIES. +// +// $Id: EquateExpression.hxx,v 1.1 2005-07-14 11:28:38 stephena Exp $ +//============================================================================ + +#ifndef EQUATE_EXPRESSION_HXX +#define EQUATE_EXPRESSION_HXX + +#include "Expression.hxx" +#include "Debugger.hxx" + +#include "bspf.hxx" + +/** + @author Stephen Anthony + @version $Id: EquateExpression.hxx,v 1.1 2005-07-14 11:28:38 stephena Exp $ +*/ +class EquateExpression : public Expression +{ + public: + EquateExpression(const string& label); + int evaluate() { return Debugger::debugger().equates()->getAddress(myLabel); } + + private: + string myLabel; +}; + +#endif diff --git a/stella/src/debugger/module.mk b/stella/src/debugger/module.mk index 81b39e9ed..c1da5a776 100644 --- a/stella/src/debugger/module.mk +++ b/stella/src/debugger/module.mk @@ -6,6 +6,7 @@ MODULE_OBJS := \ src/debugger/EquateList.o \ src/debugger/Expression.o \ src/debugger/ConstExpression.o \ + src/debugger/EquateExpression.o \ src/debugger/NotEqualsExpression.o \ src/debugger/EqualsExpression.o \ src/debugger/PlusExpression.o \ diff --git a/stella/src/yacc/YaccParser.hxx b/stella/src/yacc/YaccParser.hxx index d7a84e489..dfaa13787 100644 --- a/stella/src/yacc/YaccParser.hxx +++ b/stella/src/yacc/YaccParser.hxx @@ -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: YaccParser.hxx,v 1.3 2005-07-13 02:54:13 urchlay Exp $ +// $Id: YaccParser.hxx,v 1.4 2005-07-14 11:28:38 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -22,6 +22,9 @@ #ifndef PARSER_HXX #define PARSER_HXX +class Debugger; +class System; + #include "Expression.hxx" //#ifdef __cplusplus