Posted: Thu May 21, 2020 4:55 am Post subject: DBVM Global debug (some doubts about code)
What this piece of code does? Like what's B0 , L0, G0 , B1 ... etc..
Code:
if (DebuggerState.globalDebug)
{
DebugReg6 dr6=debugger_dr6_getValue();
DebugReg7 dr7=*(DebugReg7 *)&DebuggerState.FakedDebugRegisterState[cpunr()].DR7;
//real dr6 //fake dr7
if ((dr6.B0) && (!(dr7.L0 || dr7.G0))) { DbgPrint("setting RF because of B0\n"); ((PEFLAGS)&stackpointer[si_eflags])->RF=1; return 1; } //break caused by DR0 and not expected by the current process, ignore this bp and continue
if ((dr6.B1) && (!(dr7.L1 || dr7.G1))) { DbgPrint("setting RF because of B1\n"); ((PEFLAGS)&stackpointer[si_eflags])->RF=1; return 1; } // ... DR1 ...
if ((dr6.B2) && (!(dr7.L2 || dr7.G2))) { DbgPrint("setting RF because of B2\n"); ((PEFLAGS)&stackpointer[si_eflags])->RF=1; return 1; } // ... DR2 ...
if ((dr6.B3) && (!(dr7.L3 || dr7.G3))) { DbgPrint("setting RF because of B3\n"); ((PEFLAGS)&stackpointer[si_eflags])->RF=1; return 1; } // ... DR3 ...
}
Why is it needed for globaldebug , instead it's not needed without globaldebug?
Also why did you decide to fake dr7 there and not dr6??
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
Posted: Tue May 26, 2020 1:25 am Post subject:
This code checks if the breakpoint that just got triggered is a breakpoint by the target process or by CE
DR6.B0 is set if the breakpoint is caused by DR0
But if it's set, and the fake (what the target process sees) DR7 didn't have that breakpoint set, ignore it (as it's in the wrong process context)
DR7.L0 and G0 are enabling bits for breakpoints. _________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum