diff --git a/Emulator/Base/Dumpable.h b/Emulator/Base/Dumpable.h index 6b74e4154..39f0d8bb2 100644 --- a/Emulator/Base/Dumpable.h +++ b/Emulator/Base/Dumpable.h @@ -48,6 +48,7 @@ enum class Category Status, SwTraps, Tod, + Trace, Vectors, Volumes, Watchpoints diff --git a/Emulator/Components/Amiga.cpp b/Emulator/Components/Amiga.cpp index 95046c87f..7fed6d288 100644 --- a/Emulator/Components/Amiga.cpp +++ b/Emulator/Components/Amiga.cpp @@ -647,6 +647,17 @@ Amiga::_dump(Category category, std::ostream& os) const os << ((fc & 0b001) ? '1' : '0'); os << std::endl; } + + if (category == Category::Trace) { + + os << "\n"; + cpu.dumpLogBuffer(os, 8); + os << "\n"; + dump(Category::Current, os); + os << "\n"; + cpu.disassembleRange(os, cpu.getPC0(), 8); + os << "\n"; + } } void diff --git a/Emulator/Components/CPU/CPU.cpp b/Emulator/Components/CPU/CPU.cpp index 889e1b21c..abe99a99d 100644 --- a/Emulator/Components/CPU/CPU.cpp +++ b/Emulator/Components/CPU/CPU.cpp @@ -638,18 +638,18 @@ CPU::resyncOverclockedCpu() } const char * -CPU::disassembleRecordedInstr(isize i, isize *len) +CPU::disassembleRecordedInstr(isize i, isize *len) const { return disassembleInstr(debugger.logEntryAbs((int)i).pc0, len); } const char * -CPU::disassembleRecordedWords(isize i, isize len) +CPU::disassembleRecordedWords(isize i, isize len) const { return disassembleWords(debugger.logEntryAbs((int)i).pc0, len); } const char * -CPU::disassembleRecordedFlags(isize i) +CPU::disassembleRecordedFlags(isize i) const { static char result[18]; @@ -658,7 +658,7 @@ CPU::disassembleRecordedFlags(isize i) } const char * -CPU::disassembleRecordedPC(isize i) +CPU::disassembleRecordedPC(isize i) const { static char result[16]; @@ -667,7 +667,7 @@ CPU::disassembleRecordedPC(isize i) } const char * -CPU::disassembleAddr(u32 addr) +CPU::disassembleAddr(u32 addr) const { static char result[16]; @@ -676,7 +676,7 @@ CPU::disassembleAddr(u32 addr) } const char * -CPU::disassembleWord(u16 value) +CPU::disassembleWord(u16 value) const { static char result[16]; @@ -685,7 +685,7 @@ CPU::disassembleWord(u16 value) } const char * -CPU::disassembleInstr(u32 addr, isize *len) +CPU::disassembleInstr(u32 addr, isize *len) const { static char result[128]; @@ -696,7 +696,7 @@ CPU::disassembleInstr(u32 addr, isize *len) } const char * -CPU::disassembleWords(u32 addr, isize len) +CPU::disassembleWords(u32 addr, isize len) const { static char result[64]; @@ -705,25 +705,25 @@ CPU::disassembleWords(u32 addr, isize len) } const char * -CPU::disassembleInstr(isize *len) +CPU::disassembleInstr(isize *len) const { return disassembleInstr(reg.pc0, len); } const char * -CPU::disassembleWords(isize len) +CPU::disassembleWords(isize len) const { return disassembleWords(reg.pc0, len); } const char * -CPU::disassemblePC() +CPU::disassemblePC() const { return disassembleAddr(reg.pc0); } void -CPU::dumpLogBuffer(std::ostream& os, isize count) +CPU::dumpLogBuffer(std::ostream& os, isize count) const { isize numBytes = 0; isize num = debugger.loggedInstructions(); @@ -749,19 +749,19 @@ CPU::dumpLogBuffer(std::ostream& os, isize count) } void -CPU::dumpLogBuffer(std::ostream& os) +CPU::dumpLogBuffer(std::ostream& os) const { dumpLogBuffer(os, debugger.loggedInstructions()); } void -CPU::disassembleRange(std::ostream& os, u32 addr, isize count) +CPU::disassembleRange(std::ostream& os, u32 addr, isize count) const { disassembleRange(os, std::pair(addr, UINT32_MAX), count); } void -CPU::disassembleRange(std::ostream& os, std::pair range, isize max) +CPU::disassembleRange(std::ostream& os, std::pair range, isize max) const { u32 addr = range.first; isize numBytes = 0; diff --git a/Emulator/Components/CPU/CPU.h b/Emulator/Components/CPU/CPU.h index 66b21c673..d6cb4afa6 100644 --- a/Emulator/Components/CPU/CPU.h +++ b/Emulator/Components/CPU/CPU.h @@ -253,29 +253,29 @@ class CPU : public moira::Moira, public Inspectable // // Disassembles a recorded instruction from the log buffer - const char *disassembleRecordedInstr(isize i, isize *len); - const char *disassembleRecordedWords(isize i, isize len); - const char *disassembleRecordedFlags(isize i); - const char *disassembleRecordedPC(isize i); + const char *disassembleRecordedInstr(isize i, isize *len) const; + const char *disassembleRecordedWords(isize i, isize len) const; + const char *disassembleRecordedFlags(isize i) const; + const char *disassembleRecordedPC(isize i) const; // Disassembles the instruction at the specified address - const char *disassembleWord(u16 value); - const char *disassembleAddr(u32 addr); - const char *disassembleInstr(u32 addr, isize *len); - const char *disassembleWords(u32 addr, isize len); + const char *disassembleWord(u16 value) const; + const char *disassembleAddr(u32 addr) const; + const char *disassembleInstr(u32 addr, isize *len) const; + const char *disassembleWords(u32 addr, isize len) const; // Disassembles the currently executed instruction - const char *disassembleInstr(isize *len); - const char *disassembleWords(isize len); - const char *disassemblePC(); + const char *disassembleInstr(isize *len) const; + const char *disassembleWords(isize len) const; + const char *disassemblePC() const; // Dumps a portion of the log buffer - void dumpLogBuffer(std::ostream& os, isize count); - void dumpLogBuffer(std::ostream& os); + void dumpLogBuffer(std::ostream& os, isize count) const; + void dumpLogBuffer(std::ostream& os) const; // Disassembles a memory range - void disassembleRange(std::ostream& os, u32 addr, isize count); - void disassembleRange(std::ostream& os, std::pair range, isize max = 255); + void disassembleRange(std::ostream& os, u32 addr, isize count) const; + void disassembleRange(std::ostream& os, std::pair range, isize max = 255) const; // diff --git a/Emulator/Misc/RetroShell/Console.cpp b/Emulator/Misc/RetroShell/Console.cpp index 991db6fd5..04e6d9736 100644 --- a/Emulator/Misc/RetroShell/Console.cpp +++ b/Emulator/Misc/RetroShell/Console.cpp @@ -173,36 +173,7 @@ Console::lastLineIsEmpty() void Console::printState() { - /* - std::stringstream ss; - - ss << "\n"; - cpu.dumpLogBuffer(ss, 8); - ss << "\n"; - amiga.dump(Category::Current, ss); - ss << "\n"; - cpu.disassembleRange(ss, cpu.getPC0(), 8); - ss << "\n"; - - *this << ss; - */ - *this << stateString(); -} - -string -Console::stateString() const -{ - std::stringstream ss; - - ss << "\n"; - cpu.dumpLogBuffer(ss, 8); - ss << "\n"; - amiga.dump(Category::Current, ss); - ss << "\n"; - cpu.disassembleRange(ss, cpu.getPC0(), 8); - ss << "\n"; - - return ss.str(); + dump(amiga, Category::Trace); } void diff --git a/Emulator/Misc/RetroShell/Console.h b/Emulator/Misc/RetroShell/Console.h index ab04f55e4..ea654c3f4 100644 --- a/Emulator/Misc/RetroShell/Console.h +++ b/Emulator/Misc/RetroShell/Console.h @@ -195,11 +195,6 @@ class Console : public SubComponent { // Prints a state summary (used by the debug shell) void printState(); - -public: - - // Experimental - string stateString() const; // diff --git a/Emulator/VAmiga.cpp b/Emulator/VAmiga.cpp index 98da63ffb..30262ecfb 100644 --- a/Emulator/VAmiga.cpp +++ b/Emulator/VAmiga.cpp @@ -1967,11 +1967,4 @@ AmigaAPI::setAutoInspectionMask(u64 mask) amiga->setAutoInspectionMask(mask); } -string -AmigaAPI::stateString() -{ - return amiga->retroShell.debugger.stateString(); -} - - } diff --git a/Emulator/VAmiga.h b/Emulator/VAmiga.h index bc66e31a0..ace2c56a2 100644 --- a/Emulator/VAmiga.h +++ b/Emulator/VAmiga.h @@ -119,9 +119,6 @@ struct AmigaAPI : public API { * @param mask A bit mask indicating the components under inspection */ void setAutoInspectionMask(u64 mask); - - // Experimental - string stateString(); /// @} }; diff --git a/Proxy/EmulatorProxy.mm b/Proxy/EmulatorProxy.mm index ddee9c80f..bc57e31c2 100644 --- a/Proxy/EmulatorProxy.mm +++ b/Proxy/EmulatorProxy.mm @@ -2150,7 +2150,9 @@ - (void)loadSnapshot:(MediaFileProxy *)proxy exception:(ExceptionWrapper *)ex - (NSString *)stateString { - return @([self amiga]->stateString().c_str()); + std::stringstream ss; + [self amiga]->amiga->dump(Category::Trace, ss); + return @(ss.str().c_str()); } @end diff --git a/vAmiga.xcodeproj/xcuserdata/hoff.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/vAmiga.xcodeproj/xcuserdata/hoff.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index f02d5b0df..24a01b64c 100644 --- a/vAmiga.xcodeproj/xcuserdata/hoff.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/vAmiga.xcodeproj/xcuserdata/hoff.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -223,8 +223,8 @@ filePath = "Emulator/Components/Amiga.cpp" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "816" - endingLineNumber = "816" + startingLineNumber = "827" + endingLineNumber = "827" landmarkName = "Amiga::update(queue)" landmarkType = "7">