Some updates to the PromptWidget and DebuggerParser.

The descriptions for the debugger commands are more streamlined
and better explained, and are neater when output.

Added 'cls' debugger command, which actually isn't for the debugger
at all, but for the prompt.  This erases all showing text and history.

Removed 'bank' debugger command, since it was already removed from
the RomWidget UI.

Removed 'listwatches' debugger command, since it wasn't implemented
anyway.  Besides, any watches are printed on every command access,
so it was pointless to have another function to do it.

Removed 'poke' debugger command; 'ram' and 'rom' do the same thing.

Fixed bugs in 'function' debugger command; it now correctly adds
functions without crashing.  Related to this, added 'listfunctions'
and 'delfunction' debugger commands for user-defined commands.

Fixed bug in completions for functions; it was including user-defined
functions twice.

Some general code cleanups in DebuggerParser (use ostringstream
instead of constantly creating new strings) and Expression
classes (make some methods const, for safety).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1998 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-04-10 00:52:47 +00:00
parent 10c82a9457
commit b781611925
10 changed files with 428 additions and 398 deletions

View File

@ -69,6 +69,16 @@
given program counter. This is also available in the ROM disassembly
UI.
* Added 'listfunctions' and 'delfunction' debugger commands to
access/remove user-defined functions. Related to this, fixed a bug
in 'function' command that could cause a program crash.
* Added 'cls' debugger command, used to erase the text and history
from the debugger prompt.
* Removed the 'listwatches' and 'poke' debugger commands, as they
were redundant.
* Removed the 'loadlst' debugger command and the ability to use a
DASM .lst file. With the recent disassembler improvements, this
support is no longer feasible.

View File

@ -571,63 +571,61 @@ can also get rid of all traps at once with the "cleartraps" command.</p>
<pre>
a - Set Accumulator to value xx
bank - Show # of banks (with no args), Switch to bank (with 1 arg)
base - Set default base (hex, dec, or bin)
break - Set/clear breakpoint at address (default: current pc)
breakif - Set breakpoint on condition
c - Carry Flag: set (to 0 or 1), or toggle (no arg)
cheat - Use a cheat code (see Stella manual for cheat types)
break - Set/clear breakpoint at address xx (default=PC)
breakif - Set breakpoint on condition xx
c - Carry Flag: set (0 or 1), or toggle (no arg)
cheat - Use a cheat code (see manual for cheat types)
clearbreaks - Clear all breakpoints
cleartraps - Clear all traps
clearwatches - Clear all watches
colortest - Color Test
d - Decimal Flag: set (to 0 or 1), or toggle (no arg)
define - Define label
delbreakif - Delete conditional break created with breakif
delwatch - Delete watch
disasm - Disassemble from address (default=pc)
dump - Dump 128 bytes of memory at address
exec - Execute script file
cls - Clear prompt area of text and erase history
colortest - Show value xx as TIA color
d - Decimal Flag: set (0 or 1), or toggle (no arg)
define - Define label xx for address yy
delbreakif - Delete conditional breakif xx
delfunction - Delete function with label xx
delwatch - Delete watch xx
disasm - Disassemble address xx [yy lines] (default=PC)
dump - Dump 128 bytes of memory at address xx
exec - Execute script file xx
frame - Advance emulation by xx frames (default=1)
function - Define expression as a function for later use
function - Define function name xx for expression yy
help - This cruft
+ list - List source (if loaded with loadlist)
listbreaks - List breakpoints
listfunctions - List user-defined functions
listtraps - List traps
listwatches - List watches
+ loadlist - Load DASM listing file
loadstate - Load emulator state (0-9)
loadsym - Load symbol file
n - Negative Flag: set (to 0 or 1), or toggle (no arg)
pc - Set Program Counter to address
poke - Set address to value. Can give multiple values (for address+1, etc)
print - Evaluate and print expression in hex/dec/binary
ram - Show RAM contents (no args), or set address xx to value yy
reset - Reset 6507 to init vector (does not reset TIA, RIOT)
rewind - Rewind state to last step/trace/scanline/frame advance
loadstate - Load emulator state xx (0-9)
loadsym - Load symbol file named xx
n - Negative Flag: set (0 or 1), or toggle (no arg)
pc - Set Program Counter to address xx
print - Evaluate/print expression xx in hex/dec/binary
ram - Show ZP RAM, or set address xx to yy1 [yy2 ...]
reset - Reset 6507 to init vector (excluding TIA/RIOT)
rewind - Rewind state to last step/trace/scanline/frame
riot - Show RIOT timer/input status
rom - Change ROM contents
rom - Set ROM address xx to yy1 [yy2 ...]
run - Exit debugger, return to emulator
+ runto - Run until first occurrence of string in disassembly
runto - Run until string xx in disassembly
runtopc - Run until PC is set to value xx
s - Set Stack Pointer to value xx
save - Save breaks, watches, traps as a .stella script file
saverom - Save (possibly patched) ROM to file
saveses - Save console session to file
savestate - Save emulator state (valid args 0-9)
savesym - Save symbols to file
save - Save breaks, watches, traps to file xx
saverom - Save (possibly patched) ROM to file xx
saveses - Save console session to file xx
savestate - Save emulator state xx (valid args 0-9)
scanline - Advance emulation by xx scanlines (default=1)
step - Single step CPU (optionally, with count)
+ tia - Show TIA state (NOT FINISHED YET)
trace - Single step CPU (optionally, with count), subroutines count as one instruction
trap - Trap read and write accesses to address
trapread - Trap read accesses to address
trapwrite - Trap write accesses to address
undef - Undefine label (if defined)
v - Overflow Flag: set (to 0 or 1), or toggle (no arg)
watch - Print contents of address before every prompt
step - Single step CPU [with count xx]
tia - Show TIA state (NOT FINISHED YET)
trace - Single step CPU over subroutines [with count xx]
trap - Trap read and write accesses to address xx
trapread - Trap read accesses to address xx
trapwrite - Trap write accesses to address xx
undef - Undefine label xx (if defined)
v - Overflow Flag: set (0 or 1), or toggle (no arg)
watch - Print contents of address xx before every prompt
x - Set X Register to value xx
y - Set Y Register to value xx
z - Zero Flag: set (to 0 or 1), or toggle (no arg)
z - Zero Flag: set (0 or 1), or toggle (no arg)
</pre>
<!-- <p>Commands marked with a * are unimplemented.</p> -->

View File

@ -670,35 +670,38 @@ GUI::Rect Debugger::getTabBounds() const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::addFunction(const string& name, const string& definition,
bool Debugger::addFunction(const string& name, const string& definition,
Expression* exp, bool builtin)
{
functions.insert(make_pair(name, exp));
if(!builtin)
functionDefs.insert(make_pair(name, definition));
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::delFunction(const string& name)
bool Debugger::delFunction(const string& name)
{
FunctionMap::iterator iter = functions.find(name);
if(iter == functions.end())
return;
return false;
functions.erase(name);
delete iter->second;
FunctionDefMap::iterator def_iter = functionDefs.find(name);
if(def_iter == functionDefs.end())
return;
return false;
functionDefs.erase(name);
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expression* Debugger::getFunction(const string& name)
const Expression* Debugger::getFunction(const string& name) const
{
FunctionMap::iterator iter = functions.find(name);
FunctionMap::const_iterator iter = functions.find(name);
if(iter == functions.end())
return 0;
else
@ -706,11 +709,11 @@ Expression* Debugger::getFunction(const string& name)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Debugger::getFunctionDef(const string& name)
const string& Debugger::getFunctionDef(const string& name) const
{
FunctionDefMap::iterator iter = functionDefs.find(name);
FunctionDefMap::const_iterator iter = functionDefs.find(name);
if(iter == functionDefs.end())
return "";
return EmptyString;
else
return iter->second;
}
@ -722,7 +725,7 @@ const FunctionDefMap Debugger::getFunctionDefMap() const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string Debugger::builtinHelp() const
string Debugger::builtinHelp() const
{
ostringstream buf;
uInt16 len, c_maxlen = 0, i_maxlen = 0;
@ -751,20 +754,10 @@ const string Debugger::builtinHelp() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::getCompletions(const char* in, StringList& list) const
{
// First check built-in functions
FunctionMap::const_iterator iter1;
for(iter1 = functions.begin(); iter1 != functions.end(); ++iter1)
FunctionMap::const_iterator iter;
for(iter = functions.begin(); iter != functions.end(); ++iter)
{
const char* l = iter1->first.c_str();
if(BSPF_strncasecmp(l, in, strlen(in)) == 0)
list.push_back(l);
}
// Now consider user-defined functions
FunctionDefMap::const_iterator iter2;
for(iter2 = functionDefs.begin(); iter2 != functionDefs.end(); ++iter2)
{
const char* l = iter2->first.c_str();
const char* l = iter->first.c_str();
if(BSPF_strncasecmp(l, in, strlen(in)) == 0)
list.push_back(l);
}

View File

@ -120,14 +120,14 @@ class Debugger : public DialogContainer
*/
void quit();
void addFunction(const string& name, const string& def,
bool addFunction(const string& name, const string& def,
Expression* exp, bool builtin = false);
void delFunction(const string& name);
Expression* getFunction(const string& name);
bool delFunction(const string& name);
const Expression* getFunction(const string& name) const;
string getFunctionDef(const string& name);
const string& getFunctionDef(const string& name) const;
const FunctionDefMap getFunctionDefMap() const;
const string builtinHelp() const;
string builtinHelp() const;
/**
Methods used by the command parser for tab-completion

View File

@ -36,7 +36,8 @@ class BinAndExpression : public Expression
{
public:
BinAndExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { return myLHS->evaluate() & myRHS->evaluate(); }
uInt16 evaluate() const
{ return myLHS->evaluate() & myRHS->evaluate(); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -44,7 +45,8 @@ class BinNotExpression : public Expression
{
public:
BinNotExpression(Expression* left) : Expression(left, 0) {}
uInt16 evaluate() { return ~(myLHS->evaluate()); }
uInt16 evaluate() const
{ return ~(myLHS->evaluate()); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -52,7 +54,8 @@ class BinOrExpression : public Expression
{
public:
BinOrExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { return myLHS->evaluate() | myRHS->evaluate(); }
uInt16 evaluate() const
{ return myLHS->evaluate() | myRHS->evaluate(); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -60,7 +63,8 @@ class BinXorExpression : public Expression
{
public:
BinXorExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { return myLHS->evaluate() ^ myRHS->evaluate(); }
uInt16 evaluate() const
{ return myLHS->evaluate() ^ myRHS->evaluate(); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -68,7 +72,8 @@ class ByteDerefExpression : public Expression
{
public:
ByteDerefExpression(Expression* left): Expression(left, 0) {}
uInt16 evaluate() { return Debugger::debugger().peek(myLHS->evaluate()); }
uInt16 evaluate() const
{ return Debugger::debugger().peek(myLHS->evaluate()); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -76,7 +81,8 @@ class ByteDerefOffsetExpression : public Expression
{
public:
ByteDerefOffsetExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { return Debugger::debugger().peek(myLHS->evaluate() + myRHS->evaluate()); }
uInt16 evaluate() const
{ return Debugger::debugger().peek(myLHS->evaluate() + myRHS->evaluate()); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -84,7 +90,8 @@ class ConstExpression : public Expression
{
public:
ConstExpression(const int value) : Expression(0, 0), myValue(value) {}
uInt16 evaluate() { return myValue; }
uInt16 evaluate() const
{ return myValue; }
private:
int myValue;
@ -95,7 +102,8 @@ class CpuMethodExpression : public Expression
{
public:
CpuMethodExpression(CPUDEBUG_INT_METHOD method) : Expression(0, 0), myMethod(method) {}
uInt16 evaluate() { return CALL_CPUDEBUG_METHOD(myMethod); }
uInt16 evaluate() const
{ return CALL_CPUDEBUG_METHOD(myMethod); }
private:
CPUDEBUG_INT_METHOD myMethod;
@ -106,9 +114,9 @@ class DivExpression : public Expression
{
public:
DivExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { int denom = myRHS->evaluate();
return denom == 0 ? 0 : myLHS->evaluate() / denom;
}
uInt16 evaluate() const
{ int denom = myRHS->evaluate();
return denom == 0 ? 0 : myLHS->evaluate() / denom; }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -116,7 +124,8 @@ class EqualsExpression : public Expression
{
public:
EqualsExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { return myLHS->evaluate() == myRHS->evaluate(); }
uInt16 evaluate() const
{ return myLHS->evaluate() == myRHS->evaluate(); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -124,7 +133,8 @@ class EquateExpression : public Expression
{
public:
EquateExpression(const string& label) : Expression(0, 0), myLabel(label) {}
uInt16 evaluate() { return Debugger::debugger().cartDebug().getAddress(myLabel); }
uInt16 evaluate() const
{ return Debugger::debugger().cartDebug().getAddress(myLabel); }
private:
string myLabel;
@ -135,10 +145,11 @@ class FunctionExpression : public Expression
{
public:
FunctionExpression(const string& label) : Expression(0, 0), myLabel(label) {}
uInt16 evaluate() {
Expression* exp = Debugger::debugger().getFunction(myLabel);
if(exp) return exp->evaluate();
else return 0;
uInt16 evaluate() const
{
const Expression* exp = Debugger::debugger().getFunction(myLabel);
if(exp) return exp->evaluate();
else return 0;
}
private:
@ -150,7 +161,8 @@ class GreaterEqualsExpression : public Expression
{
public:
GreaterEqualsExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { return myLHS->evaluate() >= myRHS->evaluate(); }
uInt16 evaluate() const
{ return myLHS->evaluate() >= myRHS->evaluate(); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -158,7 +170,8 @@ class GreaterExpression : public Expression
{
public:
GreaterExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { return myLHS->evaluate() > myRHS->evaluate(); }
uInt16 evaluate() const
{ return myLHS->evaluate() > myRHS->evaluate(); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -166,7 +179,8 @@ class HiByteExpression : public Expression
{
public:
HiByteExpression(Expression* left) : Expression(left, 0) {}
uInt16 evaluate() { return 0xff & (myLHS->evaluate() >> 8); }
uInt16 evaluate() const
{ return 0xff & (myLHS->evaluate() >> 8); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -174,7 +188,8 @@ class LessEqualsExpression : public Expression
{
public:
LessEqualsExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { return myLHS->evaluate() <= myRHS->evaluate(); }
uInt16 evaluate() const
{ return myLHS->evaluate() <= myRHS->evaluate(); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -182,7 +197,8 @@ class LessExpression : public Expression
{
public:
LessExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { return myLHS->evaluate() < myRHS->evaluate(); }
uInt16 evaluate() const
{ return myLHS->evaluate() < myRHS->evaluate(); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -190,7 +206,8 @@ class LoByteExpression : public Expression
{
public:
LoByteExpression(Expression* left) : Expression(left, 0) {}
uInt16 evaluate() { return 0xff & myLHS->evaluate(); }
uInt16 evaluate() const
{ return 0xff & myLHS->evaluate(); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -198,7 +215,8 @@ class LogAndExpression : public Expression
{
public:
LogAndExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { return myLHS->evaluate() && myRHS->evaluate(); }
uInt16 evaluate() const
{ return myLHS->evaluate() && myRHS->evaluate(); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -206,7 +224,8 @@ class LogNotExpression : public Expression
{
public:
LogNotExpression(Expression* left) : Expression(left, 0) {}
uInt16 evaluate() { return !(myLHS->evaluate()); }
uInt16 evaluate() const
{ return !(myLHS->evaluate()); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -214,7 +233,8 @@ class LogOrExpression : public Expression
{
public:
LogOrExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { return myLHS->evaluate() || myRHS->evaluate(); }
uInt16 evaluate() const
{ return myLHS->evaluate() || myRHS->evaluate(); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -222,7 +242,8 @@ class MinusExpression : public Expression
{
public:
MinusExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { return myLHS->evaluate() - myRHS->evaluate(); }
uInt16 evaluate() const
{ return myLHS->evaluate() - myRHS->evaluate(); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -230,9 +251,9 @@ class ModExpression : public Expression
{
public:
ModExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { int rhs = myRHS->evaluate();
return rhs == 0 ? 0 : myLHS->evaluate() % rhs;
}
uInt16 evaluate() const
{ int rhs = myRHS->evaluate();
return rhs == 0 ? 0 : myLHS->evaluate() % rhs; }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -240,7 +261,8 @@ class MultExpression : public Expression
{
public:
MultExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { return myLHS->evaluate() * myRHS->evaluate(); }
uInt16 evaluate() const
{ return myLHS->evaluate() * myRHS->evaluate(); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -248,7 +270,8 @@ class NotEqualsExpression : public Expression
{
public:
NotEqualsExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { return myLHS->evaluate() != myRHS->evaluate(); }
uInt16 evaluate() const
{ return myLHS->evaluate() != myRHS->evaluate(); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -256,7 +279,8 @@ class PlusExpression : public Expression
{
public:
PlusExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { return myLHS->evaluate() + myRHS->evaluate(); }
uInt16 evaluate() const
{ return myLHS->evaluate() + myRHS->evaluate(); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -264,7 +288,8 @@ class CartMethodExpression : public Expression
{
public:
CartMethodExpression(CARTDEBUG_INT_METHOD method) : Expression(0, 0), myMethod(method) {}
uInt16 evaluate() { return CALL_CARTDEBUG_METHOD(myMethod); }
uInt16 evaluate() const
{ return CALL_CARTDEBUG_METHOD(myMethod); }
private:
CARTDEBUG_INT_METHOD myMethod;
@ -275,7 +300,8 @@ class ShiftLeftExpression : public Expression
{
public:
ShiftLeftExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { return myLHS->evaluate() << myRHS->evaluate(); }
uInt16 evaluate() const
{ return myLHS->evaluate() << myRHS->evaluate(); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -283,7 +309,8 @@ class ShiftRightExpression : public Expression
{
public:
ShiftRightExpression(Expression* left, Expression* right) : Expression(left, right) {}
uInt16 evaluate() { return myLHS->evaluate() >> myRHS->evaluate(); }
uInt16 evaluate() const
{ return myLHS->evaluate() >> myRHS->evaluate(); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -291,7 +318,8 @@ class TiaMethodExpression : public Expression
{
public:
TiaMethodExpression(TIADEBUG_INT_METHOD method) : Expression(0, 0), myMethod(method) {}
uInt16 evaluate() { return CALL_TIADEBUG_METHOD(myMethod); }
uInt16 evaluate() const
{ return CALL_TIADEBUG_METHOD(myMethod); }
private:
TIADEBUG_INT_METHOD myMethod;
@ -302,7 +330,8 @@ class UnaryMinusExpression : public Expression
{
public:
UnaryMinusExpression(Expression* left) : Expression(left, 0) {}
uInt16 evaluate() { return -(myLHS->evaluate()); }
uInt16 evaluate() const
{ return -(myLHS->evaluate()); }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -310,7 +339,8 @@ class WordDerefExpression : public Expression
{
public:
WordDerefExpression(Expression* left) : Expression(left, 0) {}
uInt16 evaluate() { return Debugger::debugger().dpeek(myLHS->evaluate()); }
uInt16 evaluate() const
{ return Debugger::debugger().dpeek(myLHS->evaluate()); }
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,8 @@
#ifndef DEBUGGER_PARSER_HXX
#define DEBUGGER_PARSER_HXX
#include <sstream>
class Debugger;
struct Command;
@ -119,7 +121,7 @@ class DebuggerParser
Debugger* debugger;
// The results of the currently running command
string commandResult;
ostringstream commandResult;
// Arguments in 'int' and 'string' format for the currently running command
IntArray args;
@ -131,7 +133,6 @@ class DebuggerParser
// List of available command methods
void executeA();
void executeBank();
void executeBase();
void executeBreak();
void executeBreakif();
@ -140,10 +141,12 @@ class DebuggerParser
void executeClearbreaks();
void executeCleartraps();
void executeClearwatches();
void executeCls();
void executeColortest();
void executeD();
void executeDefine();
void executeDelbreakif();
void executeDelfunction();
void executeDelwatch();
void executeDisasm();
void executeDump();
@ -152,14 +155,14 @@ class DebuggerParser
void executeFunction();
void executeHelp();
void executeListbreaks();
void executeListfunctions();
void executeListtraps();
void executeListwatches();
void executeLoadstate();
void executeLoadsym();
void executeN();
void executePc();
void executePrint();
void executeRam(); // also implements 'poke' command
void executeRam();
void executeReset();
void executeRewind();
void executeRiot();

View File

@ -40,7 +40,7 @@ class Expression
Expression(Expression* lhs, Expression* rhs);
virtual ~Expression();
virtual uInt16 evaluate() = 0;
virtual uInt16 evaluate() const = 0;
protected:
Expression* myLHS;

View File

@ -59,14 +59,8 @@ PromptWidget::PromptWidget(GuiObject* boss, const GUI::Font& font,
// Calculate depending values
_lineWidth = (_w - kScrollBarWidth - 2) / _kConsoleCharWidth;
_linesPerPage = (_h - 2) / _kConsoleLineHeight;
memset(_buffer, 0, kBufferSize * sizeof(int));
_linesInBuffer = kBufferSize / _lineWidth;
_currentPos = 0;
_scrollLine = _linesPerPage - 1;
_firstLineInBuffer = 0;
// Add scrollbar
_scrollBar = new ScrollBarWidget(boss, font, _x + _w, _y, kScrollBarWidth, _h);
_scrollBar->setTarget(this);
@ -74,14 +68,7 @@ PromptWidget::PromptWidget(GuiObject* boss, const GUI::Font& font,
// Init colors
_inverse = false;
// Init History
_historyIndex = 0;
_historyLine = 0;
_historySize = 0;
for (int i = 0; i < kHistorySize; i++)
_history[i][0] = '\0';
_promptStartPos = _promptEndPos = -1;
clearScreen();
addFocusWidget(this);
}
@ -908,3 +895,23 @@ string PromptWidget::getCompletionPrefix(const StringList& completions, string p
return prefix;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PromptWidget::clearScreen()
{
// Initialize start position and history
_currentPos = 0;
_scrollLine = _linesPerPage - 1;
_firstLineInBuffer = 0;
_promptStartPos = _promptEndPos = -1;
memset(_buffer, 0, kBufferSize * sizeof(int));
_historyIndex = 0;
_historyLine = 0;
_historySize = 0;
for (int i = 0; i < kHistorySize; i++)
_history[i][0] = '\0';
if(!_firstTime)
updateScrollBuffer();
}

View File

@ -46,6 +46,9 @@ class PromptWidget : public Widget, public CommandSender
void printPrompt();
bool saveBuffer(string& filename);
// Clear screen and erase all history
void clearScreen();
protected:
inline int &buffer(int idx) { return _buffer[idx % kBufferSize]; }