static void InitThreadDebugThread( struct TDebugThread *obj, struct TCreateThreadEvent *event ) { obj->ThreadID = event->Thread; obj->FsLinear = event->FsLinear; obj->Eip = event->StartEip; obj->Cs = event->StartCs; InitDebugThread( obj ); ReadThreadState( obj ); }
static void SetException( struct TDebugThread *obj, struct TExceptionEvent *event ) { Tss tss; int i; obj->FHasBreak = FALSE; obj->FHasTrace = FALSE; obj->FHasException = FALSE; switch( event->Code ) { case 0x80000003: obj->FHasBreak = TRUE; break; case 0x80000004: obj->FHasTrace = TRUE; break; case 0xC0000005: obj->FaultText = "Access violation"; obj->FHasException = TRUE; break; case 0xC0000017: obj->FaultText = "No memory"; obj->FHasException = TRUE; break; case 0xC000001D: obj->FaultText = "Illegal instruction"; obj->FHasException = TRUE; break; case 0xC0000025: obj->FaultText = "Noncontinuable exception"; obj->FHasException = TRUE; break; case 0xC000008C: obj->FaultText = "Array bounds exceeded"; obj->FHasException = TRUE; break; case 0xC0000094: obj->FaultText = "Integer divide by zero"; obj->FHasException = TRUE; break; case 0xC0000095: obj->FaultText = "Integer overflow"; obj->FHasException = TRUE; break; case 0xC0000096: obj->FaultText = "Priviliged instruction"; obj->FHasException = TRUE; break; case 0xC00000FD: obj->FaultText = "Stack overflow"; obj->FHasException = TRUE; break; case 0xC000013A: obj->FaultText = "Control-C exit"; obj->FHasException = TRUE; break; case 0xC000008D: obj->FaultText = "Float denormal operand"; obj->FHasException = TRUE; break; case 0xC000008E: obj->FaultText = "Float divide by zero"; obj->FHasException = TRUE; break; case 0xC000008F: obj->FaultText = "Float inexact result"; obj->FHasException = TRUE; break; case 0xC0000090: obj->FaultText = "Float invalid operation"; obj->FHasException = TRUE; break; case 0xC0000091: obj->FaultText = "Float overflow"; obj->FHasException = TRUE; break; case 0xC0000092: obj->FaultText = "Float stack check"; obj->FHasException = TRUE; break; case 0xC0000093: obj->FaultText = "Float underflow"; obj->FHasException = TRUE; break; default: obj->FaultText = "Protection fault"; obj->FHasException = TRUE; break; } obj->Cs = event->Cs; obj->Eip = event->Eip; ReadThreadState( obj ); RdosGetThreadTss( obj->ThreadID, &tss ); obj->Esp0 = tss.esp0; obj->Ess0 = tss.ess0; obj->Esp1 = tss.esp1; obj->Ess1 = tss.ess1; obj->Esp2 = tss.esp2; obj->Ess2 = tss.ess2; obj->Cr3 = tss.cr3; obj->Eflags = tss.eflags; obj->Eax = tss.eax; obj->Ecx = tss.ecx; obj->Edx = tss.edx; obj->Ebx = tss.ebx; obj->Esp = tss.esp; obj->Ebp = tss.ebp; obj->Esi = tss.esi; obj->Edi = tss.edi; obj->Es = tss.es; obj->Ss = tss.ss; obj->Ds = tss.ds; obj->Fs = tss.fs; obj->Gs = tss.gs; obj->Ldt = tss.ldt; for( i = 0; i < 4; i++ ) obj->Dr[i] = tss.dr[i]; obj->Dr7 = tss.dr7; obj->MathControl = tss.MathControl; obj->MathStatus = tss.MathStatus; obj->MathTag = tss.MathTag; obj->MathEip = tss.MathEip; obj->MathCs = tss.MathCs; obj->MathOp[0] = tss.MathOp[0]; obj->MathOp[1] = tss.MathOp[1]; obj->MathDataOffs = tss.MathDataOffs; obj->MathDataSel = tss.MathDataSel; for( i = 0; i < 8; i++ ) obj->St[i] = tss.st[i]; obj->FDebug = TRUE; }
static void SetKernelException( struct TDebugThread *obj, struct TKernelExceptionEvent *event ) { Tss tss; int i; obj->FHasBreak = FALSE; obj->FHasTrace = FALSE; obj->FHasException = FALSE; ReadThreadState( obj ); RdosGetThreadTss( obj->ThreadID, &tss ); switch ( event->Vector ) { case 0: obj->FaultText = "Integer divide by zero"; obj->FHasException = TRUE; break; case 1: obj->FaultText = "Hardware breakpoint"; obj->FHasTrace = TRUE; break; case 3: obj->FaultText = "Software breakpoint"; obj->FHasException = TRUE; break; case 4: obj->FaultText = "Integer overflow"; obj->FHasException = TRUE; break; case 5: obj->FaultText = "Array bounds exceeded"; obj->FHasException = TRUE; break; case 6: obj->FaultText = "Illegal instruction"; obj->FHasException = TRUE; break; case 7: obj->FaultText = "Float invalid operation"; obj->FHasException = TRUE; break; case 10: obj->FaultText = "Invalid TSS"; obj->FHasException = TRUE; break; case 11: obj->FaultText = "Segment not present"; obj->FHasException = TRUE; break; case 12: obj->FaultText = "Stack overflow"; obj->FHasException = TRUE; break; default: obj->FaultText = "Protection fault"; obj->FHasException = TRUE; break; } obj->Cs = tss.cs; obj->Eip = tss.eip; obj->Cr3 = tss.cr3; obj->Eflags = tss.eflags; obj->Eax = tss.eax; obj->Ecx = tss.ecx; obj->Edx = tss.edx; obj->Ebx = tss.ebx; obj->Esp = tss.esp; obj->Ebp = tss.ebp; obj->Esi = tss.esi; obj->Edi = tss.edi; obj->Es = tss.es; obj->Ss = tss.ss; obj->Ds = tss.ds; obj->Fs = tss.fs; obj->Gs = tss.gs; obj->Ldt = tss.ldt; for (i = 0; i < 4; i++) obj->Dr[i] = tss.dr[i]; obj->Dr7 = tss.dr7; obj->MathControl = tss.MathControl; obj->MathStatus = tss.MathStatus; obj->MathTag = tss.MathTag; obj->MathEip = tss.MathEip; obj->MathCs = tss.MathCs; obj->MathDataOffs = tss.MathDataOffs; obj->MathDataSel = tss.MathDataSel; for (i = 0; i < 8; i++) obj->St[i] = tss.st[i]; obj->FDebug = TRUE; }