Skip to content

Commit b991a04

Browse files
committed
make break and trace more robust when encountering a ignored module it can't figure out the end state (quit the trace instead of breaking the whole debugger)
1 parent 918229c commit b991a04

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

Cheat Engine/debugeventhandler.pas

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -964,11 +964,29 @@ procedure TDebugThreadHandler.handleTrace;
964964
if ignored then
965965
begin
966966
TDebuggerthread(debuggerthread).execlocation:=375;
967-
tracewindow.returnfromignore:=true;
967+
x:=0;
968968
ReadProcessMemory(processhandle, pointer(context^.{$ifdef cpu64}rsp{$else}esp{$endif}), @r, sizeof(processhandler.pointersize), x);
969-
b:=TDebuggerthread(debuggerthread).SetOnExecuteBreakpoint(r , false, ThreadId);
970-
b.OneTimeOnly:=true;
971-
TDebuggerthread(debuggerthread).execlocation:=376;
969+
if x=processhandler.pointersize then
970+
begin
971+
tracewindow.returnfromignore:=true;
972+
try
973+
b:=TDebuggerthread(debuggerthread).SetOnExecuteBreakpoint(r , false, ThreadId);
974+
b.OneTimeOnly:=true;
975+
TDebuggerthread(debuggerthread).execlocation:=376;
976+
except
977+
OutputDebugString('Trace step out set breakpoint error');
978+
isTracing:=false;
979+
TDebuggerthread(debuggerthread).Synchronize(TDebuggerthread(debuggerthread), tracewindow.Finish);
980+
end;
981+
end
982+
else
983+
begin
984+
//error reading
985+
OutputDebugString('Trace read stack error');
986+
isTracing:=false;
987+
TDebuggerthread(debuggerthread).Synchronize(TDebuggerthread(debuggerthread), tracewindow.Finish);
988+
end;
989+
972990
ContinueFromBreakpoint(nil, co_run);
973991
end
974992
else

0 commit comments

Comments
 (0)