Conditional breaks now show up in "listbreaks", and you can delete one

with "delbreakif".


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@666 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
urchlay 2005-07-17 15:50:37 +00:00
parent 14d08d4302
commit 660bd1765c
4 changed files with 55 additions and 12 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: 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; i<conds.size(); i++) {
ret += debugger->valueToString(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]);

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.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();

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: 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,11 +110,13 @@ void M6502::addCondBreak(Expression *e, string name)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void M6502::delCondBreak(int brk)
void M6502::delCondBreak(unsigned int brk)
{
if(brk < myBreakConds.size()) {
myBreakConds.remove_at(brk);
myBreakCondNames.remove_at(brk);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void M6502::clearCondBreaks()
@ -123,10 +125,16 @@ void M6502::clearCondBreaks()
myBreakCondNames.clear();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const StringList M6502::getCondBreakNames()
{
return myBreakCondNames;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int M6502::evalCondBreaks()
{
for(int i=0; i<myBreakConds.size(); i++) {
for(unsigned int i=0; i<myBreakConds.size(); i++) {
Expression *e = myBreakConds[i];
if(e->evaluate()) {
string name = myBreakCondNames[i]; // TODO: use this

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: 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<Expression*> 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: