updates for new logging system
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@695
This commit is contained in:
parent
dff67638e9
commit
f79eaaba75
57 changed files with 405 additions and 416 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2002 - 2003 The DOSBox Team
|
||||
* Copyright (C) 2002-2003 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -292,9 +292,8 @@ bool CBreakpoint::CheckBreakpoint(PhysPt adr)
|
|||
Bit8u value = mem_readb(bp->GetLocation());
|
||||
if (bp->GetValue() != value) {
|
||||
// Yup, memory value changed
|
||||
char buffer[200];
|
||||
sprintf(buffer,"DEBUG: Memory breakpoint: %04X:%04X - %02X -> %02X",bp->GetSegment(),bp->GetOffset(),bp->GetValue(),value);
|
||||
LOG_DEBUG(buffer);
|
||||
|
||||
DEBUG_ShowMsg(0,"DEBUG: Memory breakpoint: %04X:%04X - %02X -> %02X",bp->GetSegment(),bp->GetOffset(),bp->GetValue(),value);
|
||||
bp->SetValue(value);
|
||||
return true;
|
||||
};
|
||||
|
@ -745,9 +744,7 @@ bool ParseCommand(char* str)
|
|||
};
|
||||
name[15] = 0;
|
||||
|
||||
char buffer[128];
|
||||
sprintf(buffer,"DEBUG: Created debug var %s at %04X:%04X",name,seg,ofs);
|
||||
LOG_DEBUG(buffer);
|
||||
DEBUG_ShowMsg(0,"DEBUG: Created debug var %s at %04X:%04X",name,seg,ofs);
|
||||
CDebugVar::InsertVariable(name,PhysMake(seg,ofs));
|
||||
return true;
|
||||
}
|
||||
|
@ -761,8 +758,8 @@ bool ParseCommand(char* str)
|
|||
else { name[i] = 0; break; };
|
||||
};
|
||||
name[12] = 0;
|
||||
if (CDebugVar::SaveVars(name)) LOG_DEBUG("DEBUG: Variable list save (%s) : ok.",name);
|
||||
else LOG_DEBUG("DEBUG: Variable list save (%s) : failure",name);
|
||||
if (CDebugVar::SaveVars(name)) DEBUG_ShowMsg(0,"DEBUG: Variable list save (%s) : ok.",name);
|
||||
else DEBUG_ShowMsg(0,"DEBUG: Variable list save (%s) : failure",name);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -775,8 +772,8 @@ bool ParseCommand(char* str)
|
|||
else { name[i] = 0; break; };
|
||||
};
|
||||
name[12] = 0;
|
||||
if (CDebugVar::LoadVars(name)) LOG_DEBUG("DEBUG: Variable list load (%s) : ok.",name);
|
||||
else LOG_DEBUG("DEBUG: Variable list load (%s) : failure",name);
|
||||
if (CDebugVar::LoadVars(name)) DEBUG_ShowMsg(0,"DEBUG: Variable list load (%s) : ok.",name);
|
||||
else DEBUG_ShowMsg(0,"DEBUG: Variable list load (%s) : failure",name);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -786,7 +783,7 @@ bool ParseCommand(char* str)
|
|||
Bit16u seg = GetHexValue(found,found);found++; // skip ":"
|
||||
Bit32u ofs = GetHexValue(found,found);
|
||||
CBreakpoint::AddBreakpoint(seg,ofs,false);
|
||||
LOG_DEBUG("DEBUG: Set breakpoint at %04X:%04X",seg,ofs);
|
||||
DEBUG_ShowMsg(0,"DEBUG: Set breakpoint at %04X:%04X",seg,ofs);
|
||||
return true;
|
||||
}
|
||||
#if C_HEAVY_DEBUG
|
||||
|
@ -796,7 +793,7 @@ bool ParseCommand(char* str)
|
|||
Bit16u seg = GetHexValue(found,found);found++; // skip ":"
|
||||
Bit32u ofs = GetHexValue(found,found);
|
||||
CBreakpoint::AddMemBreakpoint(seg,ofs);
|
||||
LOG_DEBUG("DEBUG: Set memory breakpoint at %04X:%04X",seg,ofs);
|
||||
DEBUG_ShowMsg(0,"DEBUG: Set memory breakpoint at %04X:%04X",seg,ofs);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
@ -807,10 +804,10 @@ bool ParseCommand(char* str)
|
|||
Bit8u valAH = GetHexValue(found,found);
|
||||
if ((valAH==0x00) && (*found=='*')) {
|
||||
CBreakpoint::AddIntBreakpoint(intNr,BPINT_ALL,false);
|
||||
LOG_DEBUG("DEBUG: Set interrupt breakpoint at INT %02X",intNr);
|
||||
DEBUG_ShowMsg(0,"DEBUG: Set interrupt breakpoint at INT %02X",intNr);
|
||||
} else {
|
||||
CBreakpoint::AddIntBreakpoint(intNr,valAH,false);
|
||||
LOG_DEBUG("DEBUG: Set interrupt breakpoint at INT %02X AH=%02X",intNr,valAH);
|
||||
DEBUG_ShowMsg(0,"DEBUG: Set interrupt breakpoint at INT %02X AH=%02X",intNr,valAH);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -829,7 +826,7 @@ bool ParseCommand(char* str)
|
|||
Bit8u bpNr = GetHexValue(found,found);
|
||||
if ((bpNr==0x00) && (*found=='*')) { // Delete all
|
||||
CBreakpoint::DeleteAll();
|
||||
LOG_DEBUG("DEBUG: Breakpoints deleted.");
|
||||
DEBUG_ShowMsg(0,"DEBUG: Breakpoints deleted.");
|
||||
} else {
|
||||
// delete single breakpoint
|
||||
CBreakpoint::DeleteByIndex(bpNr);
|
||||
|
@ -841,7 +838,7 @@ bool ParseCommand(char* str)
|
|||
found++;
|
||||
Bit16u codeSeg = GetHexValue(found,found); found++;
|
||||
Bit32u codeOfs = GetHexValue(found,found);
|
||||
LOG_DEBUG("DEBUG: Set code overview to %04X:%04X",codeSeg,codeOfs);
|
||||
DEBUG_ShowMsg(0,"DEBUG: Set code overview to %04X:%04X",codeSeg,codeOfs);
|
||||
codeViewData.useCS = codeSeg;
|
||||
codeViewData.useEIP = codeOfs;
|
||||
return true;
|
||||
|
@ -851,22 +848,22 @@ bool ParseCommand(char* str)
|
|||
found++;
|
||||
dataSeg = GetHexValue(found,found); found++;
|
||||
dataOfs = GetHexValue(found,found);
|
||||
LOG_DEBUG("DEBUG: Set data overview to %04X:%04X",dataSeg,dataOfs);
|
||||
DEBUG_ShowMsg(0,"DEBUG: Set data overview to %04X:%04X",dataSeg,dataOfs);
|
||||
return true;
|
||||
}
|
||||
found = strstr(str,"LOG ");
|
||||
if (found) { // Create Cpu log file
|
||||
found+=4;
|
||||
LOG_DEBUG("DEBUG: Starting log");
|
||||
DEBUG_ShowMsg(0,"DEBUG: Starting log");
|
||||
DEBUG_Log_Loop(GetHexValue(found,found));
|
||||
LOG_DEBUG("DEBUG: Logfile LOGCPU.TXT created.");
|
||||
DEBUG_ShowMsg(0,"DEBUG: Logfile LOGCPU.TXT created.");
|
||||
return true;
|
||||
}
|
||||
found = strstr(str,"SR ");
|
||||
if (found) { // Set register value
|
||||
found+=2;
|
||||
if (ChangeRegister(found)) LOG_DEBUG("DEBUG: Set Register success.");
|
||||
else LOG_DEBUG("DEBUG: Set Register failure.");
|
||||
if (ChangeRegister(found)) DEBUG_ShowMsg(0,"DEBUG: Set Register success.");
|
||||
else DEBUG_ShowMsg(0,"DEBUG: Set Register failure.");
|
||||
return true;
|
||||
}
|
||||
found = strstr(str,"SM ");
|
||||
|
@ -883,14 +880,14 @@ bool ParseCommand(char* str)
|
|||
count++;
|
||||
}
|
||||
};
|
||||
LOG_DEBUG("DEBUG: Memory changed.");
|
||||
DEBUG_ShowMsg(0,"DEBUG: Memory changed.");
|
||||
return true;
|
||||
}
|
||||
found = strstr(str,"INTT ");
|
||||
if (found) { // Create Cpu log file
|
||||
found+=4;
|
||||
Bit8u intNr = GetHexValue(found,found);
|
||||
LOG_DEBUG("DEBUG: Tracing INT %02X",intNr);
|
||||
DEBUG_ShowMsg(0,"DEBUG: Tracing INT %02X",intNr);
|
||||
Interrupt(intNr);
|
||||
SetCodeWinStart();
|
||||
return true;
|
||||
|
@ -899,7 +896,7 @@ bool ParseCommand(char* str)
|
|||
if (found) { // Create Cpu log file
|
||||
found+=4;
|
||||
Bit8u intNr = GetHexValue(found,found);
|
||||
LOG_DEBUG("DEBUG: Starting INT %02X",intNr);
|
||||
DEBUG_ShowMsg(0,"DEBUG: Starting INT %02X",intNr);
|
||||
CBreakpoint::AddBreakpoint (SegValue(cs),reg_eip, true);
|
||||
CBreakpoint::ActivateBreakpoints(SegPhys(cs)+reg_eip-1,true);
|
||||
debugging=false;
|
||||
|
@ -913,8 +910,8 @@ bool ParseCommand(char* str)
|
|||
found = strstr(str,"HEAVYLOG");
|
||||
if (found) { // Create Cpu log file
|
||||
logHeavy = !logHeavy;
|
||||
if (logHeavy) LOG_DEBUG("DEBUG: Heavy cpu logging on.");
|
||||
else LOG_DEBUG("DEBUG: Heavy cpu logging off.");
|
||||
if (logHeavy) DEBUG_ShowMsg(0,"DEBUG: Heavy cpu logging on.");
|
||||
else DEBUG_ShowMsg(0,"DEBUG: Heavy cpu logging off.");
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
@ -1109,7 +1106,7 @@ Bit32u DEBUG_CheckKeys(void) {
|
|||
ParseCommand(codeViewData.inputStr);
|
||||
break;
|
||||
case 'T' : DEBUG_RaiseTimerIrq();
|
||||
LOG_DEBUG("Debug: Timer Int started.");
|
||||
DEBUG_ShowMsg(0,"Debug: Timer Int started.");
|
||||
break;
|
||||
case 'V' : showExtend = !showExtend;
|
||||
break;
|
||||
|
@ -1444,7 +1441,7 @@ void SaveMemory(Bit16u seg, Bit16u ofs1, Bit32s num)
|
|||
{
|
||||
FILE* f = fopen("MEMDUMP.TXT","wt");
|
||||
if (!f) {
|
||||
LOG_DEBUG("DEBUG: Memory dump failed.");
|
||||
DEBUG_ShowMsg(0,"DEBUG: Memory dump failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1464,7 +1461,7 @@ void SaveMemory(Bit16u seg, Bit16u ofs1, Bit32s num)
|
|||
fprintf(f,"%s\n",buffer);
|
||||
};
|
||||
fclose(f);
|
||||
LOG_DEBUG("DEBUG: Memory dump success.");
|
||||
DEBUG_ShowMsg(0,"DEBUG: Memory dump success.");
|
||||
};
|
||||
|
||||
// HEAVY DEBUGGING STUFF
|
||||
|
@ -1497,11 +1494,11 @@ void DEBUG_HeavyWriteLogInstruction(void)
|
|||
|
||||
logHeavy = false;
|
||||
|
||||
LOG_DEBUG("DEBUG: Creating cpu log LOGCPU_INT_CD.TXT");
|
||||
DEBUG_ShowMsg(0,"DEBUG: Creating cpu log LOGCPU_INT_CD.TXT");
|
||||
|
||||
FILE* f = fopen("LOGCPU_INT_CD.TXT","wt");
|
||||
if (!f) {
|
||||
LOG_DEBUG("DEBUG: Failed.");
|
||||
DEBUG_ShowMsg(0,"DEBUG: Failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1514,7 +1511,7 @@ void DEBUG_HeavyWriteLogInstruction(void)
|
|||
|
||||
fclose(f);
|
||||
|
||||
LOG_DEBUG("DEBUG: Done.");
|
||||
DEBUG_ShowMsg(0,"DEBUG: Done.");
|
||||
};
|
||||
|
||||
bool DEBUG_HeavyIsBreakpoint(void)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2002 - 2003 The DOSBox Team
|
||||
* Copyright (C) 2002-2003 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,25 +20,43 @@
|
|||
|
||||
#include "dosbox.h"
|
||||
#if C_DEBUG
|
||||
|
||||
#include "setup.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <curses.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "support.h"
|
||||
#include "regs.h"
|
||||
#include "debug.h"
|
||||
#include "debug_inc.h"
|
||||
|
||||
extern int old_cursor_state;
|
||||
void DEBUG_ShowMsg(char * msg) {
|
||||
char buf[1024];
|
||||
strcpy(buf,msg);
|
||||
struct _LogGroup {
|
||||
char * front;
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
waddstr(dbg.win_out,buf);
|
||||
wprintw(dbg.win_out," %d\n",cycle_count);
|
||||
namespace {
|
||||
_LogGroup loggrp[LOG_MAX]={"",true,0};
|
||||
|
||||
FILE* debuglog;
|
||||
};
|
||||
|
||||
extern int old_cursor_state;
|
||||
void DEBUG_ShowMsg(Bit32u entry, char * format,...) {
|
||||
|
||||
if (!(entry & LOG_ERROR) && entry && !loggrp[entry].enabled) return;
|
||||
|
||||
char buf[1024];
|
||||
strcpy(buf,loggrp[entry&127].front);
|
||||
va_list msg;
|
||||
va_start(msg,format);
|
||||
vsprintf(&buf[strlen(buf)],format,msg);
|
||||
va_end(msg);
|
||||
wprintw(dbg.win_out,"%10d: %s\n",cycle_count,buf);
|
||||
wrefresh(dbg.win_out);
|
||||
if(debuglog) fprintf(debuglog,"%10d: %s\n",cycle_count,buf);
|
||||
}
|
||||
|
||||
|
||||
|
@ -114,6 +132,68 @@ static void MakePairs(void) {
|
|||
init_pair(PAIR_BLACK_GREY, COLOR_BLACK /*| FOREGROUND_INTENSITY */, COLOR_WHITE);
|
||||
init_pair(PAIR_GREY_RED, COLOR_WHITE/*| FOREGROUND_INTENSITY */, COLOR_RED);
|
||||
}
|
||||
static void LOG_Destroy(Section* sec) {
|
||||
|
||||
if(debuglog) fclose(debuglog);
|
||||
}
|
||||
|
||||
static void LOG_Init(Section * sec) {
|
||||
Section_prop * sect=static_cast<Section_prop *>(sec);
|
||||
const char * blah=sect->Get_string("logfile");
|
||||
if(blah && (debuglog = fopen(blah,"wt+"))){
|
||||
}else{
|
||||
debuglog=0;
|
||||
}
|
||||
sect->AddDestroyFunction(LOG_Destroy);
|
||||
char buf[1024];
|
||||
for (Bitu i=1;i<LOG_MAX;i++) {
|
||||
strcpy(buf,loggrp[i].front);
|
||||
buf[strlen(buf)-1]=0;
|
||||
loggrp[i].enabled=sect->Get_bool(buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LOG_StartUp(void) {
|
||||
/* Setup logging groups */
|
||||
loggrp[LOG_VGA].front="VGA:";
|
||||
loggrp[LOG_VGAGFX].front="VGAGFX:";
|
||||
loggrp[LOG_VGAMISC].front="VGAMISC:";
|
||||
loggrp[LOG_INT10].front="INT10:";
|
||||
loggrp[LOG_SB].front="SBLASTER:";
|
||||
loggrp[LOG_DMA].front="DMA:";
|
||||
|
||||
loggrp[LOG_FPU].front="FPU:";
|
||||
loggrp[LOG_CPU].front="CPU:";
|
||||
|
||||
loggrp[LOG_FCB].front="FCB:";
|
||||
loggrp[LOG_FILES].front="FILES:";
|
||||
loggrp[LOG_IOCTL].front="IOCTL:";
|
||||
loggrp[LOG_EXEC].front="EXEC";
|
||||
loggrp[LOG_DOSMISC].front="DOSMISC:";
|
||||
|
||||
loggrp[LOG_PIT].front="PIT:";
|
||||
loggrp[LOG_KEYBOARD].front="KEYBOARD:";
|
||||
loggrp[LOG_PIC].front="PIC:";
|
||||
|
||||
loggrp[LOG_MOUSE].front="MOUSE:";
|
||||
loggrp[LOG_BIOS].front="BIOS:";
|
||||
loggrp[LOG_GUI].front="GUI:";
|
||||
loggrp[LOG_MISC].front="MISC:";
|
||||
|
||||
/* Register the log section */
|
||||
Section_prop * sect=control->AddSection_prop("log",LOG_Init);
|
||||
sect->Add_string("logfile","");
|
||||
char buf[1024];
|
||||
for (Bitu i=1;i<LOG_MAX;i++) {
|
||||
strcpy(buf,loggrp[i].front);
|
||||
buf[strlen(buf)-1]=0;
|
||||
lowcase(buf);
|
||||
sect->Add_bool(buf,true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void DBGUI_StartUp(void) {
|
||||
|
@ -133,7 +213,6 @@ void DBGUI_StartUp(void) {
|
|||
MakePairs();
|
||||
MakeSubWindows();
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -37,6 +37,7 @@ struct DBGBlock {
|
|||
WINDOW * win_out; /* Text Output Window */
|
||||
Bit32u active_win; /* Current active window */
|
||||
Bit32u input_y;
|
||||
Bit32u global_mask; /* Current msgmask */
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue