Set debug file locations to DEFAULT_DIR

This commit is contained in:
OV2 2010-10-02 00:49:23 +02:00
parent 851839cdea
commit 918a376010
4 changed files with 11 additions and 13 deletions

View File

@ -3642,7 +3642,7 @@ static void Op42 (void)
S9xMessage(S9X_DEBUG, S9X_DEBUG_OUTPUT, buf);
if (trace != NULL)
fclose(trace);
trace = fopen("WDMtrace.log", "ab");
ENSURE_TRACE_OPEN(trace,"WDMtrace.log","ab")
}
break;

View File

@ -1532,8 +1532,7 @@ static void debug_process_command (char *Line)
if (SA1.Flags & TRACE_FLAG)
{
printf("SA1 CPU instruction tracing enabled.\n");
if (trace2 == NULL)
trace2 = fopen("trace_sa1.log", "wb");
ENSURE_TRACE_OPEN(trace2,"trace_sa1.log","wb")
}
else
{
@ -1549,8 +1548,7 @@ static void debug_process_command (char *Line)
if (CPU.Flags & TRACE_FLAG)
{
printf("CPU instruction tracing enabled.\n");
if (trace == NULL)
trace = fopen("trace.log", "wb");
ENSURE_TRACE_OPEN(trace,"trace.log","wb")
}
else
{
@ -2580,8 +2578,7 @@ void S9xTrace (void)
{
char msg[512];
if (trace == NULL)
trace = fopen("trace.log", "a");
ENSURE_TRACE_OPEN(trace,"trace.log","a")
debug_cpu_op_print(msg, Registers.PB, Registers.PCw);
fprintf(trace, "%s\n", msg);
@ -2591,8 +2588,7 @@ void S9xSA1Trace (void)
{
char msg[512];
if (trace2 == NULL)
trace2 = fopen("trace_sa1.log", "a");
ENSURE_TRACE_OPEN(trace2,"trace_sa1.log","a")
debug_sa1_op_print(msg, SA1Registers.PB, SA1Registers.PCw);
fprintf(trace2, "%s\n", msg);

View File

@ -187,6 +187,9 @@ struct SBreakPoint
uint16 Address;
};
#define ENSURE_TRACE_OPEN(fp,file,mode) \
if(!fp) {std::string fn=S9xGetDirectory(DEFAULT_DIR);fn+=SLASH_STR file;fp=fopen(fn.c_str(),mode);}
extern struct SBreakPoint S9xBreakpoint[6];
void S9xDoDebug (void);

View File

@ -193,6 +193,7 @@
#endif
#ifdef DEBUGGER
#include "debug.h"
extern FILE *trace;
#endif
@ -493,8 +494,7 @@ void S9xLoadConfigFiles (char **argv, int argc)
if (conf.GetBool("DEBUG::Trace", false))
{
if (!trace)
trace = fopen("trace.log", "wb");
ENSURE_TRACE_OPEN(trace,"trace.log","wb")
CPU.Flags |= TRACE_FLAG;
}
#endif
@ -845,8 +845,7 @@ char * S9xParseArgs (char **argv, int argc)
else
if (!strcasecmp(argv[i], "-trace"))
{
if (!trace)
trace = fopen("trace.log", "wb");
ENSURE_TRACE_OPEN(trace,"trace.log","wb")
CPU.Flags |= TRACE_FLAG;
}
else