sim: added list breakpoints
authorMartin Perner <martin@perner.cc>
Mon, 1 Nov 2010 12:17:38 +0000 (13:17 +0100)
committerMartin Perner <martin@perner.cc>
Mon, 1 Nov 2010 13:52:22 +0000 (14:52 +0100)
3b_sim/sim.cpp

index 0a6f14613ba573f1dc38391044b013e89644e475..dd0343eef4a2d1c8389313b8c5b074b837a968d1 100644 (file)
@@ -311,7 +311,7 @@ void setBreak(const vector<string>& 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<string>& in)
        }
 }
 
+void listBreaks(const vector<string>&)
+{
+       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<string>&)
 {
        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."));