1
0
Fork 0

Debugger is activated via callback now

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1168
This commit is contained in:
Ulf Wohlers 2003-07-27 20:20:40 +00:00
parent 09ed20abec
commit a1fe43c151
7 changed files with 39 additions and 24 deletions

View file

@ -25,6 +25,7 @@ void DEBUG_CheckExecuteBreakpoint(Bit16u seg, Bit32u off);
bool DEBUG_ExitLoop(void);
extern Bitu cycle_count;
extern Bitu debugCallback;
#ifdef C_HEAVY_DEBUG
bool DEBUG_HeavyIsBreakpoint(void);

View file

@ -798,8 +798,9 @@ restart:
#if C_DEBUG
SAVEIP;
if (DEBUG_Breakpoint()) {
LOADIP;
LEAVECORE;
return -1;
return debugCallback;
}
LOADIP;
#endif
@ -811,8 +812,9 @@ restart:
#if C_DEBUG
SAVEIP;
if (DEBUG_IntBreakpoint(num)) {
LOADIP;
LEAVECORE;
return -1;
return debugCallback;
}
#endif
EXCEPTION(num);

View file

@ -55,7 +55,6 @@ static EAPoint IPPoint;
#include "core_full/ea_lookup.h"
#include "instructions.h"
static INLINE void DecodeModRM(void) {
inst.rm=Fetchb();
inst.rm_index=(inst.rm >> 3) & 7;
@ -89,7 +88,7 @@ Bits Full_DeCode(void) {
SaveIP();
if (DEBUG_HeavyIsBreakpoint()) {
LEAVECORE;
return 1;
return debugCallback;
};
#endif
#endif

View file

@ -341,8 +341,8 @@ switch (inst.code.op) {
case O_INT:
LEAVECORE;
#if C_DEBUG
if (((inst.entry & 0xFF)==0xcc) && DEBUG_Breakpoint()) return -1;
else if (DEBUG_IntBreakpoint(inst.op1.b)) return -1;
if (((inst.entry & 0xFF)==0xcc) && DEBUG_Breakpoint()) return debugCallback;
else if (DEBUG_IntBreakpoint(inst.op1.b)) return debugCallback;
#endif
Interrupt(inst.op1.b);
LoadIP();

View file

@ -84,7 +84,7 @@ decode_start:
cycle_count++;
#if C_HEAVY_DEBUG
LEAVECORE;
if (DEBUG_HeavyIsBreakpoint()) return 1;
if (DEBUG_HeavyIsBreakpoint()) return debugCallback;
#endif
#endif
core_16.ip_start=core_16.ip_lookup;

View file

@ -512,8 +512,8 @@ bool DEBUG_Breakpoint(void)
// Found. Breakpoint is valid
reg_eip -= 1;
CBreakpoint::ActivateBreakpoints(where,false); // Deactivate all breakpoints
exitLoop = true;
DEBUG_Enable();
// exitLoop = true;
// DEBUG_Enable();
return true;
};
@ -526,8 +526,8 @@ bool DEBUG_IntBreakpoint(Bit8u intNum)
// Found. Breakpoint is valid
reg_eip -= 2;
CBreakpoint::ActivateBreakpoints(where,false); // Deactivate all breakpoints
exitLoop = true;
DEBUG_Enable();
// exitLoop = true;
// DEBUG_Enable();
return true;
};
@ -628,8 +628,8 @@ static void DrawRegisters(void) {
oldflags=flags.word;
if (cpu.pmode) mvwprintw(dbg.win_reg,0,76,"Prot");
else mvwprintw(dbg.win_reg,0,76,"Real");
if (cpu.pmode) mvwprintw(dbg.win_reg,0,76,"Prot");
else mvwprintw(dbg.win_reg,0,76,"Real");
// Selector info, if available
if ((cpu.pmode) && curSelectorName[0]) {
@ -1272,6 +1272,7 @@ Bit32u DEBUG_CheckKeys(void) {
skipFirstInstruction = true; // for heavy debugger
CPU_Cycles = 1;
Bitu ret=(*cpudecoder)();
if (ret>0) ret=(*CallBack_Handlers[ret])();
SetCodeWinStart();
CBreakpoint::ignoreOnce = 0;
}
@ -1280,15 +1281,11 @@ Bit32u DEBUG_CheckKeys(void) {
skipFirstInstruction = true; // for heavy debugger
CPU_Cycles = 1;
ret = (*cpudecoder)();
if (ret>0) ret=(*CallBack_Handlers[ret])();
SetCodeWinStart();
CBreakpoint::ignoreOnce = 0;
break;
// default:
// // FIXME : Is this correct ?
// if (key<0x200) ret=(*cpudecoder)(1);
// break;
};
}
DEBUG_DrawScreen();
}
return ret;
@ -1308,7 +1305,6 @@ Bitu DEBUG_Loop(void) {
DOSBOX_SetNormalLoop();
return 0;
}
return DEBUG_CheckKeys();
}
@ -1371,7 +1367,8 @@ static bool DEBUG_Log_Loop(int count) {
CPU_Cycles = 1;
ret=(*cpudecoder)();
if (ret>0) ret=(*CallBack_Handlers[ret])();
count--;
if (count==0) break;
@ -1446,6 +1443,13 @@ void DEBUG_CheckExecuteBreakpoint(Bit16u seg, Bit32u off)
};
};
Bitu DEBUG_EnableDebugger(void)
{
exitLoop = true;
DEBUG_Enable();
return 0;
};
static void DEBUG_ProgramStart(Program * * make) {
*make=new DEBUG;
}
@ -1481,6 +1485,8 @@ static void DEBUG_ShutDown(Section * sec)
#endif
};
Bitu debugCallback;
void DEBUG_Init(Section* sec) {
MSG_Add("DEBUG_CONFIGFILE_HELP","Nothing to setup yet!\n");
@ -1492,6 +1498,9 @@ void DEBUG_Init(Section* sec) {
memset((void*)&codeViewData,0,sizeof(codeViewData));
/* setup debug.com */
PROGRAMS_MakeFile("DEBUG.COM",DEBUG_ProgramStart);
/* Setup callback */
debugCallback=CALLBACK_Allocate();
CALLBACK_Setup(debugCallback,DEBUG_EnableDebugger,CB_RETF);
/* shutdown function */
sec->AddDestroyFunction(&DEBUG_ShutDown);
}
@ -1602,7 +1611,7 @@ void SaveMemory(Bit16u seg, Bit16u ofs1, Bit32s num)
#if C_HEAVY_DEBUG
const Bit32u LOGCPUMAX = 200;
const Bit32u LOGCPUMAX = 20000;
static Bit16u logCpuCS [LOGCPUMAX];
static Bit32u logCpuEIP[LOGCPUMAX];
@ -1681,8 +1690,8 @@ bool DEBUG_HeavyIsBreakpoint(void)
PhysPt where = SegPhys(cs)+reg_eip;
if (CBreakpoint::CheckBreakpoint(SegValue(cs),reg_eip)) {
exitLoop = true;
DEBUG_Enable();
// exitLoop = true;
// DEBUG_Enable();
return true;
}
return false;

View file

@ -111,6 +111,9 @@ static Bitu Normal_Loop(void) {
if (ret>0) {
Bitu blah=(*CallBack_Handlers[ret])();
if (blah) return blah;
#if C_DEBUG
if (DEBUG_ExitLoop()) return 0;
#endif
}
} else {
if (RemainTicks>0) {
@ -260,6 +263,7 @@ void DOSBOX_Init(void) {
secprop->Add_bool("ems",true);
secprop->AddInitFunction(&DPMI_Init);
secprop->Add_bool("dpmi",true);
#if C_MODEM
secprop=control->AddSection_prop("modem",&MODEM_Init);
secprop->Add_bool("enabled",true);