From 91875f1ae93e87d254ee3ed2b24b2079f3e44a91 Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Wed, 21 Aug 2019 10:23:54 +0200 Subject: [PATCH] fixed some breakpoint issues regarding #512 --- src/debugger/Debugger.cxx | 10 ++++++++-- src/debugger/DebuggerParser.cxx | 6 +++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index 19fcf5955..bb2271ceb 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -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(); } diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index 1a29f53fe..c444d12e2 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -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) },