From 709c50e21effe2bce0e0d908c077fdb40acf2b56 Mon Sep 17 00:00:00 2001 From: Martin Perner Date: Mon, 1 Nov 2010 13:17:38 +0100 Subject: [PATCH] sim: added list breakpoints --- 3b_sim/sim.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/3b_sim/sim.cpp b/3b_sim/sim.cpp index 0a6f146..dd0343e 100644 --- a/3b_sim/sim.cpp +++ b/3b_sim/sim.cpp @@ -311,7 +311,7 @@ void setBreak(const vector& in) try { addr = convertStringToNum(in.back()); breakpoints.push_back(addr); - cout << "Breakpoint 0x" << std::hex << setw(8) << setfill('0') << addr << std::hex << " set" << endl; + cout << "Breakpoint 0x" << std::hex << setw(8) << setfill('0') << addr << std::dec << " set" << endl; } catch(bad_cast&) { cerr << "Given parameter is not a valid address" << endl; @@ -322,6 +322,13 @@ void setBreak(const vector& in) } } +void listBreaks(const vector&) +{ + for(auto iter = breakpoints.begin(); iter != breakpoints.end(); ++iter) { + cout << "Breakpoint at 0x" << std::hex << setw(8) << setfill('0') << *iter << std::dec << endl; + } +} + void printStatus(const vector&) { CDat stackp = global_cpu->getStack(); @@ -526,6 +533,7 @@ int main(int argc, char* argv[]) Completers.push_back(CompleterElement("ddata [s] [e]",&printRAM, "Prints RAM. if s is given, only RAM-Addr. s is printed. if s and e are given the RAM-Addrs from s to e are printed. if omitted the first 16 RAM-Addrs are printed.")); Completers.push_back(CompleterElement("dprog [s] [e]",&printPROG, "Prints program. if s is given, only Prog-Addr. s is printed. if s and e are given the Prog-Addrs from s to e are printed. if omitted the first 16 Prog-Addrs are printed.")); Completers.push_back(CompleterElement("break addr",&setBreak, "Sets a breakpoint for address addr.")); + Completers.push_back(CompleterElement("listbreaks",&listBreaks, "Lists all breakpoints.")); Completers.push_back(CompleterElement("run",&execRun, "Runs till next breakpoint or end of program.")); Completers.push_back(CompleterElement("setpc [num]",&setPC, "Sets PC to num. if num is omitted 0 is used.")); Completers.push_back(CompleterElement("status",&printStatus, "Prints status of CPU.")); -- 2.25.1