better debugger memory logging

This commit is contained in:
Kelvin Sherlock 2013-09-01 15:32:39 -04:00
parent e1ff46a97a
commit d275c389e6

View File

@ -211,7 +211,6 @@ namespace {
}
bool step(bool trace)
{
// return false to break (toolbreak, address break, etc.)
@ -219,9 +218,11 @@ namespace {
uint16_t op;
memBreak = false;
uint32_t prevPC = cpuGetPC();
cpuExecuteInstruction();
uint32_t pc = cpuGetPC();
if (trace) disasm(pc, &op);
else op = Debug::ReadWord(pc);
@ -246,6 +247,7 @@ namespace {
if (memBreak)
{
if (!trace) disasm(pc);
printf("Memory break\n");
memBreak = false;
return false;
@ -296,16 +298,7 @@ namespace {
}
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)
static void LogWrite(int size, uint32_t value)
{
fprintf(stdout, " write %d bytes", size);
switch(size)
@ -326,6 +319,22 @@ namespace {
fprintf(stdout, "\n");
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
{
@ -344,7 +353,8 @@ namespace {
if (!wbrkMap.lookup(address)) return;
printf("Write $%08x\n", address);
printf("Memory Break $%08x - ", address);
LogWrite(size, value);
// todo -- print previous value, old value.
memBreak = true;
@ -353,7 +363,7 @@ namespace {
{
if (!rbrkMap.lookup(address)) return;
printf("Read $%08x\n", address);
printf("Memory Break $%08x - read %d bytes\n", address, size);
memBreak = true;
}