identical breakifs conditions toggle each other

renamed command in TIA display context menu "Toggle..."
added messages for TIA display context menu
This commit is contained in:
thrust26 2017-11-20 16:13:48 +01:00
parent 01d3a29f66
commit c996460bbe
2 changed files with 24 additions and 13 deletions

View File

@ -735,9 +735,9 @@ void DebuggerParser::executeBreak()
debugger.rom().invalidate(); debugger.rom().invalidate();
if(debugger.breakPoint(bp)) if(debugger.breakPoint(bp))
commandResult << "Set"; commandResult << "set";
else else
commandResult << "Cleared"; commandResult << "cleared";
commandResult << " breakpoint at " << Base::toString(bp); commandResult << " breakpoint at " << Base::toString(bp);
} }
@ -749,9 +749,18 @@ void DebuggerParser::executeBreakif()
int res = YaccParser::parse(argStrings[0].c_str()); int res = YaccParser::parse(argStrings[0].c_str());
if(res == 0) if(res == 0)
{ {
string condition = argStrings[0];
for(uInt32 i = 0; i < debugger.m6502().getCondBreakNames().size(); i++)
{
if(condition == debugger.m6502().getCondBreakNames()[i])
{
executeDelbreakif();
return;
}
}
uInt32 ret = debugger.m6502().addCondBreak( uInt32 ret = debugger.m6502().addCondBreak(
YaccParser::getResult(), argStrings[0] ); YaccParser::getResult(), argStrings[0] );
commandResult << "Added breakif " << Base::toString(ret); commandResult << "added breakif " << Base::toString(ret);
} }
else else
commandResult << red("invalid expression"); commandResult << red("invalid expression");
@ -783,7 +792,7 @@ void DebuggerParser::executeCheat()
{ {
const string& cheat = argStrings[arg]; const string& cheat = argStrings[arg];
if(debugger.myOSystem.cheat().add("DBG", cheat)) if(debugger.myOSystem.cheat().add("DBG", cheat))
commandResult << "Cheat code " << cheat << " enabled" << endl; commandResult << "cheat code " << cheat << " enabled" << endl;
else else
commandResult << red("invalid cheat code ") << cheat << endl; commandResult << red("invalid cheat code ") << cheat << endl;
} }
@ -1089,7 +1098,7 @@ void DebuggerParser::executeFunction()
if(res == 0) if(res == 0)
{ {
debugger.addFunction(argStrings[0], argStrings[1], YaccParser::getResult()); debugger.addFunction(argStrings[0], argStrings[1], YaccParser::getResult());
commandResult << "Added function " << argStrings[0] << " -> " << argStrings[1]; commandResult << "added function " << argStrings[0] << " -> " << argStrings[1];
} }
else else
commandResult << red("invalid expression"); commandResult << red("invalid expression");
@ -1569,7 +1578,7 @@ void DebuggerParser::executeSaveses()
if(debugger.prompt().saveBuffer(file)) if(debugger.prompt().saveBuffer(file))
commandResult << "saved " + file.getShortPath() + " OK"; commandResult << "saved " + file.getShortPath() + " OK";
else else
commandResult << "Unable to save session"; commandResult << "unable to save session";
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1598,7 +1607,7 @@ void DebuggerParser::executeSavestateif()
{ {
uInt32 ret = debugger.m6502().addCondSaveState( uInt32 ret = debugger.m6502().addCondSaveState(
YaccParser::getResult(), argStrings[0]); YaccParser::getResult(), argStrings[0]);
commandResult << "Added savestateif " << Base::toString(ret); commandResult << "added savestateif " << Base::toString(ret);
} }
else else
commandResult << red("invalid expression"); commandResult << red("invalid expression");
@ -1758,7 +1767,7 @@ void DebuggerParser::executeTraps(bool read, bool write, const string& command,
add = false; add = false;
// @sa666666: please check this: // @sa666666: please check this:
Vec::removeAt(myTraps, i); Vec::removeAt(myTraps, i);
commandResult << "Removed trap " << Base::toString(i); commandResult << "removed trap " << Base::toString(i);
break; break;
} }
commandResult << "Internal error! Duplicate trap removal failed!"; commandResult << "Internal error! Duplicate trap removal failed!";
@ -1769,7 +1778,7 @@ void DebuggerParser::executeTraps(bool read, bool write, const string& command,
{ {
uInt32 ret = debugger.m6502().addCondTrap( uInt32 ret = debugger.m6502().addCondTrap(
YaccParser::getResult(), hasCond ? argStrings[0] : ""); YaccParser::getResult(), hasCond ? argStrings[0] : "");
commandResult << "Added trap " << Base::toString(ret); commandResult << "added trap " << Base::toString(ret);
// @sa666666: please check this: // @sa666666: please check this:
myTraps.emplace_back(new Trap{ read, write, begin, end, condition }); myTraps.emplace_back(new Trap{ read, write, begin, end, condition });

View File

@ -45,7 +45,7 @@ TiaOutputWidget::TiaOutputWidget(GuiObject* boss, const GUI::Font& font,
// Create context menu for commands // Create context menu for commands
VariantList l; VariantList l;
VarList::push_back(l, "Fill to scanline", "scanline"); VarList::push_back(l, "Fill to scanline", "scanline");
VarList::push_back(l, "Set breakpoint", "bp"); VarList::push_back(l, "Toggle breakpoint", "bp");
VarList::push_back(l, "Set zoom position", "zoom"); VarList::push_back(l, "Set zoom position", "zoom");
VarList::push_back(l, "Save snapshot", "snap"); VarList::push_back(l, "Save snapshot", "snap");
myMenu = make_unique<ContextMenu>(this, font, l); myMenu = make_unique<ContextMenu>(this, font, l);
@ -71,7 +71,7 @@ void TiaOutputWidget::saveSnapshot()
FBSurface& s = dialog().surface(); FBSurface& s = dialog().surface();
GUI::Rect rect(_x, _y, _x + width*2, _y + height); GUI::Rect rect(_x, _y, _x + width*2, _y + height);
string message = "Snapshot saved"; string message = "snapshot saved";
try try
{ {
instance().png().saveImage(sspath.str(), s, rect); instance().png().saveImage(sspath.str(), s, rect);
@ -117,7 +117,8 @@ void TiaOutputWidget::handleCommand(CommandSender* sender, int cmd, int data, in
if(lines > 0) if(lines > 0)
{ {
command << "scanline #" << lines; command << "scanline #" << lines;
instance().debugger().parser().run(command.str()); string message = instance().debugger().parser().run(command.str());
instance().frameBuffer().showMessage(message);
} }
} }
else if(rmb == "bp") else if(rmb == "bp")
@ -125,7 +126,8 @@ void TiaOutputWidget::handleCommand(CommandSender* sender, int cmd, int data, in
ostringstream command; ostringstream command;
int scanline = myClickY + ystart; int scanline = myClickY + ystart;
command << "breakif _scan==#" << scanline; command << "breakif _scan==#" << scanline;
instance().debugger().parser().run(command.str()); string message = instance().debugger().parser().run(command.str());
instance().frameBuffer().showMessage(message);
} }
else if(rmb == "zoom") else if(rmb == "zoom")
{ {