mirror of
https://github.com/ksherlock/mpw.git
synced 2025-02-17 19:30:25 +00:00
better debugger memory logging
This commit is contained in:
parent
e1ff46a97a
commit
d275c389e6
@ -211,7 +211,6 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool step(bool trace)
|
bool step(bool trace)
|
||||||
{
|
{
|
||||||
// return false to break (toolbreak, address break, etc.)
|
// return false to break (toolbreak, address break, etc.)
|
||||||
@ -219,9 +218,11 @@ namespace {
|
|||||||
uint16_t op;
|
uint16_t op;
|
||||||
memBreak = false;
|
memBreak = false;
|
||||||
|
|
||||||
|
uint32_t prevPC = cpuGetPC();
|
||||||
cpuExecuteInstruction();
|
cpuExecuteInstruction();
|
||||||
|
|
||||||
uint32_t pc = cpuGetPC();
|
uint32_t pc = cpuGetPC();
|
||||||
|
|
||||||
if (trace) disasm(pc, &op);
|
if (trace) disasm(pc, &op);
|
||||||
else op = Debug::ReadWord(pc);
|
else op = Debug::ReadWord(pc);
|
||||||
|
|
||||||
@ -246,6 +247,7 @@ namespace {
|
|||||||
|
|
||||||
if (memBreak)
|
if (memBreak)
|
||||||
{
|
{
|
||||||
|
if (!trace) disasm(pc);
|
||||||
printf("Memory break\n");
|
printf("Memory break\n");
|
||||||
memBreak = false;
|
memBreak = false;
|
||||||
return false;
|
return false;
|
||||||
@ -296,16 +298,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MemoryLogger(uint32_t address, int size, int readWrite, uint32_t value)
|
static void LogWrite(int size, uint32_t value)
|
||||||
{
|
|
||||||
|
|
||||||
if (address < kGlobalSize && Flags.traceGlobals)
|
|
||||||
{
|
|
||||||
const char *name = GlobalName(address);
|
|
||||||
if (!name) name = "unknown";
|
|
||||||
|
|
||||||
fprintf(stdout, "%-20s %08x - ", name, address);
|
|
||||||
if (readWrite)
|
|
||||||
{
|
{
|
||||||
fprintf(stdout, " write %d bytes", size);
|
fprintf(stdout, " write %d bytes", size);
|
||||||
switch(size)
|
switch(size)
|
||||||
@ -326,6 +319,22 @@ namespace {
|
|||||||
fprintf(stdout, "\n");
|
fprintf(stdout, "\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MemoryLogger(uint32_t address, int size, int readWrite, uint32_t value)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (address < kGlobalSize && Flags.traceGlobals)
|
||||||
|
{
|
||||||
|
const char *name = GlobalName(address);
|
||||||
|
if (!name) name = "unknown";
|
||||||
|
|
||||||
|
fprintf(stdout, "%-20s %08x - ", name, address);
|
||||||
|
if (readWrite)
|
||||||
|
{
|
||||||
|
LogWrite(size, value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -344,7 +353,8 @@ namespace {
|
|||||||
|
|
||||||
if (!wbrkMap.lookup(address)) return;
|
if (!wbrkMap.lookup(address)) return;
|
||||||
|
|
||||||
printf("Write $%08x\n", address);
|
printf("Memory Break $%08x - ", address);
|
||||||
|
LogWrite(size, value);
|
||||||
// todo -- print previous value, old value.
|
// todo -- print previous value, old value.
|
||||||
|
|
||||||
memBreak = true;
|
memBreak = true;
|
||||||
@ -353,7 +363,7 @@ namespace {
|
|||||||
{
|
{
|
||||||
if (!rbrkMap.lookup(address)) return;
|
if (!rbrkMap.lookup(address)) return;
|
||||||
|
|
||||||
printf("Read $%08x\n", address);
|
printf("Memory Break $%08x - read %d bytes\n", address, size);
|
||||||
|
|
||||||
memBreak = true;
|
memBreak = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user