Skip to content

Commit

Permalink
Tracking icon is now clickable (#854)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkwhoffmann committed Jan 1, 2025
1 parent e69c08f commit e7ce8af
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 78 deletions.
1 change: 1 addition & 0 deletions Emulator/Base/Dumpable.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ enum class Category
Status,
SwTraps,
Tod,
Trace,
Vectors,
Volumes,
Watchpoints
Expand Down
11 changes: 11 additions & 0 deletions Emulator/Components/Amiga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 15 additions & 15 deletions Emulator/Components/CPU/CPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand All @@ -658,7 +658,7 @@ CPU::disassembleRecordedFlags(isize i)
}

const char *
CPU::disassembleRecordedPC(isize i)
CPU::disassembleRecordedPC(isize i) const
{
static char result[16];

Expand All @@ -667,7 +667,7 @@ CPU::disassembleRecordedPC(isize i)
}

const char *
CPU::disassembleAddr(u32 addr)
CPU::disassembleAddr(u32 addr) const
{
static char result[16];

Expand All @@ -676,7 +676,7 @@ CPU::disassembleAddr(u32 addr)
}

const char *
CPU::disassembleWord(u16 value)
CPU::disassembleWord(u16 value) const
{
static char result[16];

Expand All @@ -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];

Expand All @@ -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];

Expand All @@ -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();
Expand All @@ -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<u32, u32>(addr, UINT32_MAX), count);
}

void
CPU::disassembleRange(std::ostream& os, std::pair<u32, u32> range, isize max)
CPU::disassembleRange(std::ostream& os, std::pair<u32, u32> range, isize max) const
{
u32 addr = range.first;
isize numBytes = 0;
Expand Down
30 changes: 15 additions & 15 deletions Emulator/Components/CPU/CPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,29 +253,29 @@ class CPU : public moira::Moira, public Inspectable<CPUInfo>
//

// 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<u32, u32> range, isize max = 255);
void disassembleRange(std::ostream& os, u32 addr, isize count) const;
void disassembleRange(std::ostream& os, std::pair<u32, u32> range, isize max = 255) const;


//
Expand Down
31 changes: 1 addition & 30 deletions Emulator/Misc/RetroShell/Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions Emulator/Misc/RetroShell/Console.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,6 @@ class Console : public SubComponent {

// Prints a state summary (used by the debug shell)
void printState();

public:

// Experimental
string stateString() const;


//
Expand Down
7 changes: 0 additions & 7 deletions Emulator/VAmiga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1967,11 +1967,4 @@ AmigaAPI::setAutoInspectionMask(u64 mask)
amiga->setAutoInspectionMask(mask);
}

string
AmigaAPI::stateString()
{
return amiga->retroShell.debugger.stateString();
}


}
3 changes: 0 additions & 3 deletions Emulator/VAmiga.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

/// @}
};
Expand Down
4 changes: 3 additions & 1 deletion Proxy/EmulatorProxy.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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">
</BreakpointContent>
Expand Down

0 comments on commit e7ce8af

Please sign in to comment.