diff --git a/stella/src/debugger/DebuggerParser.cxx b/stella/src/debugger/DebuggerParser.cxx index 34e2f4727..1a8cd2440 100644 --- a/stella/src/debugger/DebuggerParser.cxx +++ b/stella/src/debugger/DebuggerParser.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: DebuggerParser.cxx,v 1.62 2005-07-17 02:26:49 urchlay Exp $ +// $Id: DebuggerParser.cxx,v 1.63 2005-07-17 15:50:34 urchlay Exp $ //============================================================================ #include "bspf.hxx" @@ -60,7 +60,7 @@ Command DebuggerParser::commands[] = { { "breakif", - "Set/clear breakpoint on condition", + "Set breakpoint on condition", true, { kARG_WORD, kARG_END_ARGS }, &DebuggerParser::executeBreakif @@ -122,6 +122,14 @@ Command DebuggerParser::commands[] = { &DebuggerParser::executeDefine }, + { + "delbreakif", + "Delete conditional break created with breakif", + true, + { kARG_WORD, kARG_END_ARGS }, + &DebuggerParser::executeDelbreakif + }, + { "delwatch", "Delete watch", @@ -674,7 +682,7 @@ bool DebuggerParser::subStringMatch(const string& needle, const string& haystack string DebuggerParser::listBreaks() { char buf[255]; int count = 0; - string ret; + string ret = ""; for(unsigned int i=0; i<0x10000; i++) { if(debugger->breakPoints->isSet(i)) { @@ -683,10 +691,30 @@ string DebuggerParser::listBreaks() { if(! (++count % 8) ) ret += "\n"; } } + /* if(count) return ret; else return "no breakpoints set"; + */ + if(count) + ret = "breaks:\n" + ret; + + StringList conds = debugger->cpuDebug().m6502().getCondBreakNames(); + if(conds.size() > 0) { + ret += "\nbreakifs:\n"; + for(unsigned int i=0; ivalueToString(i); + ret += ": "; + ret += conds[i]; + if(i != (conds.size() - 1)) ret += "\n"; + } + } + + if(ret == "") + return "no breakpoints set"; + else + return ret; } string DebuggerParser::listTraps() { @@ -1155,6 +1183,11 @@ void DebuggerParser::executeDefine() { commandResult = "label " + argStrings[0] + " defined as " + debugger->valueToString(args[1]); } +// "delbreakif" +void DebuggerParser::executeDelbreakif() { + debugger->cpuDebug().m6502().delCondBreak(args[0]); +} + // "delwatch" void DebuggerParser::executeDelwatch() { commandResult = delWatch(args[0]); diff --git a/stella/src/debugger/DebuggerParser.hxx b/stella/src/debugger/DebuggerParser.hxx index fd4e6e467..842e81978 100644 --- a/stella/src/debugger/DebuggerParser.hxx +++ b/stella/src/debugger/DebuggerParser.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: DebuggerParser.hxx,v 1.33 2005-07-17 02:26:49 urchlay Exp $ +// $Id: DebuggerParser.hxx,v 1.34 2005-07-17 15:50:36 urchlay Exp $ //============================================================================ #ifndef DEBUGGER_PARSER_HXX @@ -103,6 +103,7 @@ class DebuggerParser void executeColortest(); void executeD(); void executeDefine(); + void executeDelbreakif(); void executeDelwatch(); void executeDisasm(); void executeDump(); diff --git a/stella/src/emucore/m6502/src/M6502.cxx b/stella/src/emucore/m6502/src/M6502.cxx index 6178e6fda..c8d117d82 100644 --- a/stella/src/emucore/m6502/src/M6502.cxx +++ b/stella/src/emucore/m6502/src/M6502.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: M6502.cxx,v 1.9 2005-07-17 02:26:50 urchlay Exp $ +// $Id: M6502.cxx,v 1.10 2005-07-17 15:50:37 urchlay Exp $ //============================================================================ #include "M6502.hxx" @@ -110,10 +110,12 @@ void M6502::addCondBreak(Expression *e, string name) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void M6502::delCondBreak(int brk) +void M6502::delCondBreak(unsigned int brk) { - myBreakConds.remove_at(brk); - myBreakCondNames.remove_at(brk); + if(brk < myBreakConds.size()) { + myBreakConds.remove_at(brk); + myBreakCondNames.remove_at(brk); + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -123,10 +125,16 @@ void M6502::clearCondBreaks() myBreakCondNames.clear(); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +const StringList M6502::getCondBreakNames() +{ + return myBreakCondNames; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int M6502::evalCondBreaks() { - for(int i=0; ievaluate()) { string name = myBreakCondNames[i]; // TODO: use this diff --git a/stella/src/emucore/m6502/src/M6502.hxx b/stella/src/emucore/m6502/src/M6502.hxx index 4957a9eb3..f3b8dc012 100644 --- a/stella/src/emucore/m6502/src/M6502.hxx +++ b/stella/src/emucore/m6502/src/M6502.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: M6502.hxx,v 1.9 2005-07-17 02:26:50 urchlay Exp $ +// $Id: M6502.hxx,v 1.10 2005-07-17 15:50:37 urchlay Exp $ //============================================================================ #ifndef M6502_HXX @@ -41,7 +41,7 @@ typedef GUI::Array ExpressionList; has a 64K addressing space. @author Bradford W. Mott - @version $Id: M6502.hxx,v 1.9 2005-07-17 02:26:50 urchlay Exp $ + @version $Id: M6502.hxx,v 1.10 2005-07-17 15:50:37 urchlay Exp $ */ class M6502 { @@ -188,8 +188,9 @@ class M6502 int totalInstructionCount() { return myTotalInstructionCount; } void addCondBreak(Expression *e, string name); - void delCondBreak(int brk); + void delCondBreak(unsigned int brk); void clearCondBreaks(); + const StringList getCondBreakNames(); int evalCondBreaks(); protected: