fixed some breakpoint issues regarding #512

This commit is contained in:
Thomas Jentzsch 2019-08-21 10:23:54 +02:00
parent 69d807a85b
commit 7ee9573646
2 changed files with 11 additions and 5 deletions

View File

@ -385,9 +385,15 @@ string Debugger::getCondition(uInt16 addr, Int8 bank)
condition << "((pc&1fff) == " << Base::HEX4 << (addr & 0x1fff) << ")";
if(bank != ANY_BANK && myCartDebug->bankCount() > 1)
condition << " && (_bank == #" << int(bank) << ")";
condition << " && (_bank == " << Base::HEX1 << int(bank) << ")";
YaccParser::parse(condition.str());
// parse and validate condition expression
int res = YaccParser::parse(condition.str());
if(res != 0)
{
cerr << "Invalid condition: " << condition.str() << " (" << res << ")" << endl;
return "";
}
return condition.str();
}

View File

@ -738,7 +738,7 @@ void DebuggerParser::executeBreak()
else
{
bank = args[1];
if(bank >= debugger.cartDebug().bankCount())
if(bank < 0 || bank >= debugger.cartDebug().bankCount())
{
commandResult << red("invalid bank");
return;
@ -753,7 +753,7 @@ void DebuggerParser::executeBreak()
else
commandResult << "cleared";
commandResult << " breakpoint at " << Base::toString(addr) << " in bank " << int(bank);
commandResult << " breakpoint at $" << Base::toString(addr) << " in bank $" << Base::HEX1 << int(bank);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -2265,7 +2265,7 @@ DebuggerParser::Command DebuggerParser::commands[NumCommands] = {
"Example: break, break f000, break f000 0",
false,
true,
{ Parameters::ARG_WORD, Parameters::ARG_BYTE, Parameters::ARG_END_ARGS },
{ Parameters::ARG_WORD, Parameters::ARG_MULTI_BYTE },
std::mem_fn(&DebuggerParser::executeBreak)
},