breakpoints
This commit is contained in:
parent
9d367e02ae
commit
9c7632fb1c
3 changed files with 26 additions and 0 deletions
15
cpu.cpp
15
cpu.cpp
|
@ -30,6 +30,21 @@ void cpu::emulation_start()
|
||||||
running_since = get_ms();
|
running_since = get_ms();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cpu::check_breakpoint()
|
||||||
|
{
|
||||||
|
return breakpoints.find(getPC()) != breakpoints.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cpu::set_breakpoint(const uint16_t addr)
|
||||||
|
{
|
||||||
|
breakpoints.insert(addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cpu::remove_breakpoint(const uint16_t addr)
|
||||||
|
{
|
||||||
|
breakpoints.erase(addr);
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t cpu::get_instructions_executed_count()
|
uint64_t cpu::get_instructions_executed_count()
|
||||||
{
|
{
|
||||||
// this may wreck havoc as it is not protected by a mutex
|
// this may wreck havoc as it is not protected by a mutex
|
||||||
|
|
6
cpu.h
6
cpu.h
|
@ -28,6 +28,8 @@ private:
|
||||||
// level, vector
|
// level, vector
|
||||||
std::map<uint8_t, std::set<uint8_t> > queued_interrupts;
|
std::map<uint8_t, std::set<uint8_t> > queued_interrupts;
|
||||||
|
|
||||||
|
std::set<uint16_t> breakpoints;
|
||||||
|
|
||||||
bus *const b { nullptr };
|
bus *const b { nullptr };
|
||||||
|
|
||||||
uint32_t *const event { nullptr };
|
uint32_t *const event { nullptr };
|
||||||
|
@ -62,6 +64,10 @@ public:
|
||||||
explicit cpu(bus *const b, uint32_t *const event);
|
explicit cpu(bus *const b, uint32_t *const event);
|
||||||
~cpu();
|
~cpu();
|
||||||
|
|
||||||
|
bool check_breakpoint();
|
||||||
|
void set_breakpoint(const uint16_t addr);
|
||||||
|
void remove_breakpoint(const uint16_t addr);
|
||||||
|
|
||||||
void disassemble(void) const;
|
void disassemble(void) const;
|
||||||
std::map<std::string, std::vector<std::string> > disassemble(const uint16_t addr) const;
|
std::map<std::string, std::vector<std::string> > disassemble(const uint16_t addr) const;
|
||||||
|
|
||||||
|
|
5
main.cpp
5
main.cpp
|
@ -273,8 +273,13 @@ int main(int argc, char *argv[])
|
||||||
if (tracing)
|
if (tracing)
|
||||||
c->disassemble();
|
c->disassemble();
|
||||||
|
|
||||||
|
if (c->check_breakpoint())
|
||||||
|
break;
|
||||||
|
|
||||||
c->step();
|
c->step();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: some menu
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
while(!event && !terminate)
|
while(!event && !terminate)
|
||||||
|
|
Loading…
Add table
Reference in a new issue