1
0
Fork 0

new logging system

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@987
This commit is contained in:
Peter Veenstra 2003-05-04 19:12:09 +00:00
parent a336b5d7cc
commit c9b747adc4
15 changed files with 45 additions and 33 deletions

View file

@ -67,7 +67,7 @@ void CALLBACK_Idle(void) {
}
static Bitu default_handler(void) {
LOG(LOG_ERROR|LOG_CPU,"Illegal Unhandled Interrupt Called %X",lastint);
LOG(LOG_CPU,LOG_ERROR)("Illegal Unhandled Interrupt Called %X",lastint);
return CBRET_NONE;
};

View file

@ -880,7 +880,7 @@ restart:
case 0xde: /* FPU ESC 6 */
case 0xdf: /* FPU ESC 7 */
{
LOG(LOG_CPU,"FPU used");
LOG(LOG_CPU,LOG_NORMAL)("FPU used");
Bit8u rm=Fetchb();
if (rm<0xc0) GetEAa;
}
@ -956,7 +956,7 @@ restart:
IO_Write(reg_dx+1,reg_ah);
break;
case 0xf0: /* LOCK */
LOG(LOG_CPU,"CPU:LOCK");
LOG(LOG_CPU,LOG_NORMAL)("CPU:LOCK");
break;
case 0xf1: /* Weird call undocumented */
// INTERRUPT(1);

View file

@ -258,7 +258,7 @@ switch(Fetchb()) {
break;
}
case 0x8c:
LOG(LOG_CPU,"CPU:66:8c looped back");
LOG(LOG_CPU,LOG_NORMAL)("CPU:66:8c looped back");
break;
case 0x8d: /* LEA */
{

View file

@ -41,7 +41,7 @@ switch(Fetchb()) {
break;
default:
GetEAa;
LOG(LOG_CPU|LOG_ERROR,"GRP7:Illegal call %2X",(rm>>3) &3);
LOG(LOG_CPU,LOG_ERROR)("GRP7:Illegal call %2X",(rm>>3) &3);
}
}
break;
@ -63,7 +63,7 @@ switch(Fetchb()) {
case 0x23: /* MOV DRx,Rd */
{
GetRM;
LOG(LOG_CPU,"CPU:0F:23 does nothing");
LOG(LOG_CPU,LOG_NORMAL)("CPU:0F:23 does nothing");
}
break;
/* 0x24 MOV Rd,TRx (386) */

View file

@ -395,7 +395,7 @@ rep_again:
break;
default:
IPPoint--;
LOG(LOG_CPU|LOG_ERROR,"Unhandled REP Prefix %X",Fetchb());
LOG(LOG_CPU,LOG_ERROR)("Unhandled REP Prefix %X",Fetchb());
goto normalexit;
}
/* If we end up here it's because the CPU_Cycles counter is 0, so restart instruction */

View file

@ -114,7 +114,7 @@ l_M_Ed:
break;
case M_Efw:
if (inst.rm>=0xC0) {
LOG(LOG_CPU|LOG_ERROR,"MODRM:Illegal M_Efw ");
LOG(LOG_CPU,LOG_ERROR)("MODRM:Illegal M_Efw ");
goto nextopcode;
}
inst.op1.d=LoadMw(inst.rm_eaa);
@ -122,7 +122,7 @@ l_M_Ed:
break;
case M_Efd:
if (inst.rm>=0xc0) {
LOG(LOG_CPU|LOG_ERROR,"MODRM:Illegal M_Efw ");
LOG(LOG_CPU,LOG_ERROR)("MODRM:Illegal M_Efw ");
goto nextopcode;
}
inst.op1.d=LoadMd(inst.rm_eaa);
@ -157,7 +157,7 @@ l_M_Ed:
case 0:
break;
default:
LOG(LOG_CPU|LOG_ERROR,"MODRM:Unhandled load %d entry %x",inst.code.extra,inst.entry);
LOG(LOG_CPU,LOG_ERROR)("MODRM:Unhandled load %d entry %x",inst.code.extra,inst.entry);
break;
}
break;
@ -469,7 +469,7 @@ l_M_Ed:
CPU_CPUID();
goto nextopcode;
default:
LOG(LOG_CPU|LOG_ERROR,"LOAD:Unhandled code %d opcode %X",inst.code.load,inst.entry);
LOG(LOG_CPU,LOG_ERROR)("LOAD:Unhandled code %d opcode %X",inst.code.load,inst.entry);
break;
}

View file

@ -89,4 +89,4 @@ static INLINE Bit32u Pop_32(void) {
} \
}
#endif
#endif

View file

@ -417,7 +417,7 @@ switch (inst.code.op) {
default:
LOG(LOG_ERROR|LOG_CPU,"Group 6 Illegal subfunction %X",inst.rm_index);
LOG(LOG_CPU,LOG_ERROR)("Group 6 Illegal subfunction %X",inst.rm_index);
}
break;
case O_GRP7w:
@ -455,7 +455,7 @@ switch (inst.code.op) {
CPU_LMSW(inst.op1.w);
goto nextopcode;
default:
LOG(LOG_ERROR|LOG_CPU,"Group 7 Illegal subfunction %X",inst.rm_index);
LOG(LOG_CPU,LOG_ERROR)("Group 7 Illegal subfunction %X",inst.rm_index);
}
break;
case O_M_Cd_Rd:
@ -541,6 +541,6 @@ switch (inst.code.op) {
case 0:
break;
default:
LOG(LOG_ERROR|LOG_CPU,"OP:Unhandled code %d entry %X",inst.code.op,inst.entry);
LOG(LOG_CPU,LOG_ERROR)("OP:Unhandled code %d entry %X",inst.code.op,inst.entry);
}

View file

@ -106,5 +106,5 @@ switch (inst.code.save) {
case 0:
break;
default:
LOG(LOG_ERROR|LOG_CPU,"SAVE:Unhandled code %d entry %X",inst.code.save,inst.entry);
LOG(LOG_CPU,LOG_ERROR)("SAVE:Unhandled code %d entry %X",inst.code.save,inst.entry);
}

View file

@ -2,7 +2,7 @@
EAPoint si_base,di_base;
Bitu si_index,di_index;
Bitu add_mask;
Bitu count,count_left;
Bits count,count_left;
Bits add_index;
bool restart=false;
@ -195,7 +195,7 @@
}
break;
default:
LOG(LOG_CPU|LOG_ERROR,"Unhandled string %d entry %X",inst.code.op,inst.entry);
LOG(LOG_CPU,LOG_ERROR)("Unhandled string %d entry %X",inst.code.op,inst.entry);
}
/* Clean up after certain amount of instructions */
reg_esi&=(~add_mask);

View file

@ -121,12 +121,12 @@ bool Interrupt(Bitu num) {
#if C_DEBUG
switch (num) {
case 0x00:
LOG(LOG_CPU,"Divide Error");
LOG(LOG_CPU,LOG_NORMAL)("Divide Error");
break;
case 0x06:
break;
case 0x07:
LOG(LOG_FPU,"Co Processor Exception");
LOG(LOG_FPU,LOG_NORMAL)("Co Processor Exception");
break;
case 0x08:
case 0x09:
@ -148,7 +148,7 @@ bool Interrupt(Bitu num) {
break;
case 0xcd:
#if C_HEAVY_DEBUG
LOG(LOG_CPU|LOG_ERROR,"Call to interrupt 0xCD this is BAD");
LOG(LOG_CPU,LOG_ERROR)("Call to interrupt 0xCD this is BAD");
DEBUG_HeavyWriteLogInstruction();
#endif
E_Exit("Call to interrupt 0xCD this is BAD");
@ -156,7 +156,7 @@ bool Interrupt(Bitu num) {
if (DEBUG_Breakpoint()) return true;
break;
case 0x05:
LOG(LOG_CPU,"CPU:Out Of Bounds interrupt");
LOG(LOG_CPU,LOG_NORMAL)("CPU:Out Of Bounds interrupt");
break;
default:
// LOG_WARN("Call to unsupported INT %02X call %02X",num,reg_ah);
@ -539,7 +539,7 @@ bool CPU_SET_CRX(Bitu cr,Bitu value) {
return CPU_CheckState();
}
default:
LOG(LOG_CPU|LOG_ERROR,"Unhandled MOV CR%d,%X",cr,value);
LOG(LOG_CPU,LOG_ERROR)("Unhandled MOV CR%d,%X",cr,value);
break;
}
return false;
@ -550,7 +550,7 @@ Bitu CPU_GET_CRX(Bitu cr) {
case 0:
return cpu.cr0;
default:
LOG(LOG_CPU|LOG_ERROR,"Unhandled MOV XXX, CR%d",cr);
LOG(LOG_CPU,LOG_ERROR)("Unhandled MOV XXX, CR%d",cr);
break;
}
return 0;
@ -762,7 +762,7 @@ void CPU_CPUID(void) {
reg_edx=0; /* Nothing either */
break;
default:
LOG(LOG_CPU|LOG_ERROR,"Unhandled CPUID Function %x",reg_eax);
LOG(LOG_CPU,LOG_ERROR)("Unhandled CPUID Function %x",reg_eax);
break;
}

View file

@ -134,7 +134,7 @@ Bitu get_CF(void) {
case t_DIV:
return false; /* Unkown */
default:
LOG(LOG_ERROR|LOG_CPU,"get_CF Unknown %d",flags.type);
LOG(LOG_CPU,LOG_ERROR)("get_CF Unknown %d",flags.type);
}
return 0;
}
@ -229,7 +229,7 @@ again:
case t_MUL:
return false; /* Unkown */
default:
LOG(LOG_ERROR|LOG_CPU,"get_AF Unknown %d",flags.type);
LOG(LOG_CPU,LOG_ERROR)("get_AF Unknown %d",flags.type);
}
return 0;
}
@ -314,7 +314,7 @@ again:
case t_MUL:
return false; /* Unkown */
default:
LOG(LOG_ERROR|LOG_CPU,"get_ZF Unknown %d",flags.type);
LOG(LOG_CPU,LOG_ERROR)("get_ZF Unknown %d",flags.type);
}
return false;
}
@ -398,7 +398,7 @@ again:
case t_MUL:
return false; /* Unkown */
default:
LOG(LOG_ERROR|LOG_CPU,"get_SF Unkown %d",flags.type);
LOG(LOG_CPU,LOG_ERROR)("get_SF Unkown %d",flags.type);
}
return false;
@ -539,7 +539,7 @@ again:
case t_DIV:
return false; /* Unkown */
default:
LOG(LOG_ERROR|LOG_CPU,"get_OF Unkown %d",flags.type);
LOG(LOG_CPU,LOG_ERROR)("get_OF Unkown %d",flags.type);
}
return false;
}
@ -800,7 +800,7 @@ Bitu get_Flags(void) {
SET_FLAG(FLAG_CF,false); /* Unkown */
break;
default:
LOG(LOG_ERROR|LOG_CPU,"Unhandled flag type %d",flags.type);
LOG(LOG_CPU,LOG_ERROR)("Unhandled flag type %d",flags.type);
return 0;
}
flags.word=new_flags;

View file

@ -83,7 +83,7 @@ decode_start:
if (prefix.count) {
PrefixReset;
//DEBUG_HeavyWriteLogInstruction();
LOG(LOG_CPU,"Prefix for non prefixed instruction");
LOG(LOG_CPU,LOG_NORMAL)("Prefix for non prefixed instruction");
}
CPU_Cycles--;
}

View file

@ -53,6 +53,8 @@ char* AnalyzeInstruction(char* inst, bool saveSelector);
void SaveMemory(Bit16u seg, Bit16u ofs1, Bit32s num);
class DEBUG;
extern void DEBUG_ShowMsg(Bit32u entry, char* format, ...);
DEBUG* pDebugcom = 0;
bool exitLoop = false;
bool logHeavy = false;

View file

@ -44,6 +44,9 @@ namespace {
};
extern int old_cursor_state;
void DEBUG_ShowMsg(Bit32u entry, char * format,...) {
if (!(entry & LOG_ERROR) && entry && !loggrp[entry].enabled) return;
@ -58,7 +61,14 @@ void DEBUG_ShowMsg(Bit32u entry, char * format,...) {
wrefresh(dbg.win_out);
if(debuglog) fprintf(debuglog,"%10d: %s\n",cycle_count,buf);
}
void LOG::operator() (char* format, ...){
char buf[1024];
va_list msg;
va_start(msg,format);
vsprintf(buf,format,msg);
va_end(msg);
DEBUG_ShowMsg(this->d_type|this->d_severity,buf);
}
static void Draw_RegisterLayout(void) {