mirror of https://github.com/stella-emu/stella.git
Added EquateExpression, which returns a value for a given label/equate.
Added a static Debugger::debugger() method, which is sort of a hack, but is very useful when some class needs access to the debugger and we don't want to pass the debugger object through dozens of c'tors. Besides, there's only ever one instantiation of the debugger anyway. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@640 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
d5e7de306e
commit
9771ddcedc
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
|
@ -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
|
|
@ -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 \
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue