From 26ba7e79e10d517c5c8d9956391cb927ee68d576 Mon Sep 17 00:00:00 2001 From: zeromus Date: Mon, 24 Jul 2006 04:58:44 +0000 Subject: [PATCH] more debugging cleanups [[Split portion of a mixed commit.]] --- debug.cpp | 6 +++--- debug.h | 10 ++++++++-- driver.h | 7 ++++++- drivers/win/cdlogger.cpp | 2 +- drivers/win/debugger.cpp | 2 +- drivers/win/main.cpp | 2 +- drivers/win/tracer.cpp | 6 ++++-- tracer.h => drivers/win/tracer.h | 0 8 files changed, 24 insertions(+), 11 deletions(-) rename tracer.h => drivers/win/tracer.h (100%) diff --git a/debug.cpp b/debug.cpp index e0cda61e..d54f84ba 100644 --- a/debug.cpp +++ b/debug.cpp @@ -79,9 +79,8 @@ char *cdlogfilename; //char loadedcdfile[MAX_PATH]; static int indirectnext; +//records whether loggingCD is enabled int debug_loggingCD; -//void FCEUI_SetLoggingCD(int val) { debug_loggingCD = val; } -//int FCEUI_GetLoggingCD(int val) { return debug_loggingCD = val; } //called by the cpu to perform logging if CDLogging is enabled void LogCDVectors(int which){ @@ -412,6 +411,7 @@ void breakpoint() { } //bbit edited: this is the end of the inserted code +int debug_tracing; void DebugCycle() { if (numWPs | step | stepout | watchpoint[64].flags | badopbreak) @@ -419,5 +419,5 @@ void DebugCycle() { if(debug_loggingCD) LogCDData(); //mbg 6/30/06 - this was commented out when i got here. i dont understand it anyway //if(logging || (hMemView && (EditingMode == 2))) LogInstruction(); - //if(logging) LogInstruction(); + FCEUD_TraceInstruction(); } diff --git a/debug.h b/debug.h index 4e322d66..3a7fe458 100644 --- a/debug.h +++ b/debug.h @@ -65,7 +65,6 @@ uint8 GetPPUMem(uint8 A); void LogCDVectors(int which); void LogCDData(); extern volatile int codecount, datacount, undefinedcount; -extern volatile int loggingcodedata; extern unsigned char *cdloggerdata; extern int debug_loggingCD; @@ -73,6 +72,13 @@ static INLINE void FCEUI_SetLoggingCD(int val) { debug_loggingCD = val; } static INLINE int FCEUI_GetLoggingCD() { return debug_loggingCD; } //------- +//-------tracing +//we're letting the win32 driver handle this ittself for now +//extern int debug_tracing; +//static INLINE void FCEUI_SetTracing(int val) { debug_tracing = val; } +//static INLINE int FCEUI_GetTracing() { return debug_tracing; } +//--------- + //--------debugger extern int iaPC; extern uint32 iapoffset; //mbg merge 7/18/06 changed from int @@ -84,4 +90,4 @@ extern uint8 *vnapage[4],*VPage[8]; extern uint8 PPU[4],PALRAM[0x20],SPRAM[0x100],VRAMBuffer,PPUGenLatch,XOffset; extern uint32 RefreshAddr; -#endif \ No newline at end of file +#endif diff --git a/driver.h b/driver.h index ed6c9b48..9970d45d 100644 --- a/driver.h +++ b/driver.h @@ -311,10 +311,15 @@ int FCEUD_ShowStatusIcon(void); void FCEUD_ToggleStatusIcon(void); void FCEUD_HideMenuToggle(void); -//new merge-era driver routines here +//new merge-era driver routines here: + //signals that the cpu core hit a breakpoint //this function should not return until the core is ready for the next cycle void FCEUD_DebugBreakpoint(); +//the driver should log the current instruction, if it wants +//(we should move the code in the win driver that does this to the shared area) +void FCEUD_TraceInstruction(); + #endif /* __DRIVER_H_ */ diff --git a/drivers/win/cdlogger.cpp b/drivers/win/cdlogger.cpp index 2d6258e9..3004b9fa 100644 --- a/drivers/win/cdlogger.cpp +++ b/drivers/win/cdlogger.cpp @@ -24,7 +24,7 @@ #include "..\..\x6502.h" #include "..\..\debug.h" #include "debugger.h" -#include "..\..\tracer.h" +#include "tracer.h" #include "cdlogger.h" #define INESPRIV diff --git a/drivers/win/debugger.cpp b/drivers/win/debugger.cpp index 0aaff1bb..66734002 100644 --- a/drivers/win/debugger.cpp +++ b/drivers/win/debugger.cpp @@ -26,7 +26,7 @@ #include "..\..\nsf.h" #include "..\..\cart.h" #include "..\..\ines.h" -#include "..\..\tracer.h" +#include "tracer.h" #include "..\..\memview.h" #include "cheat.h" #include diff --git a/drivers/win/main.cpp b/drivers/win/main.cpp index 73dd76e9..143b645b 100644 --- a/drivers/win/main.cpp +++ b/drivers/win/main.cpp @@ -49,7 +49,7 @@ #include "..\..\ppuview.h" #include "..\..\ntview.h" #include "..\..\memview.h" -#include "..\..\tracer.h" +#include "tracer.h" #include "cdlogger.h" //----- diff --git a/drivers/win/tracer.cpp b/drivers/win/tracer.cpp index a592ed43..e1fd91e2 100644 --- a/drivers/win/tracer.cpp +++ b/drivers/win/tracer.cpp @@ -25,7 +25,7 @@ #include "..\..\cart.h" //mbg merge 7/19/06 moved after fceu.h #include "cdlogger.h" #include "..\..\file.h" -#include "..\..\tracer.h" +#include "tracer.h" #include "..\..\memview.h" //#define LOG_SKIP_UNMAPPED 4 @@ -277,7 +277,9 @@ done: }*/ //todo: really speed this up -void LogInstruction(){ +void FCEUD_TraceInstruction(){ + if(!logging) return; + char address[7], data[11], disassembly[28], axystate[16], procstatus[12]; char str[96]; int addr=X.PC; diff --git a/tracer.h b/drivers/win/tracer.h similarity index 100% rename from tracer.h rename to drivers/win/tracer.h