FpDebugger (pure): Removed excessive debug-output.

git-svn-id: trunk@45292 -
This commit is contained in:
joost 2014-06-01 19:46:06 +00:00
parent 2692d96325
commit b526979d64
2 changed files with 21 additions and 70 deletions

View File

@ -264,7 +264,7 @@ begin
end;} end;}
deBreakpoint : deBreakpoint :
begin begin
debugln('Reached breakpoint at %s.',[FormatAddress(FCurrentProcess.GetInstructionPointerRegisterValue)]); // Do nothing
end; end;
deInternalContinue, deInternalContinue,
deLoadLibrary: deLoadLibrary:
@ -282,40 +282,34 @@ begin
case FPDEvent of case FPDEvent of
deCreateProcess: deCreateProcess:
begin begin
debugln('Create Process');
continue:=true; continue:=true;
if assigned(OnCreateProcessEvent) then if assigned(OnCreateProcessEvent) then
OnCreateProcessEvent(continue); OnCreateProcessEvent(continue);
end; end;
deBreakpoint: deBreakpoint:
begin begin
debugln('Breakpoint');
continue:=false; continue:=false;
if assigned(OnHitBreakpointEvent) then if assigned(OnHitBreakpointEvent) then
OnHitBreakpointEvent(continue, FCurrentProcess.CurrentBreakpoint); OnHitBreakpointEvent(continue, FCurrentProcess.CurrentBreakpoint);
end; end;
deExitProcess: deExitProcess:
begin begin
debugln('Exit proces');
continue := false; continue := false;
if assigned(OnProcessExitEvent) then if assigned(OnProcessExitEvent) then
OnProcessExitEvent(FExitCode); OnProcessExitEvent(FExitCode);
end; end;
deException: deException:
begin begin
debugln('Exception');
continue:=false; continue:=false;
if assigned(OnExceptionEvent) then if assigned(OnExceptionEvent) then
OnExceptionEvent(continue, FCurrentProcess.ExceptionClass, FCurrentProcess.ExceptionMessage ); OnExceptionEvent(continue, FCurrentProcess.ExceptionClass, FCurrentProcess.ExceptionMessage );
end; end;
deLoadLibrary: deLoadLibrary:
begin begin
debugln('LoadLibrary');
continue:=true; continue:=true;
end; end;
deInternalContinue: deInternalContinue:
begin begin
debugln('Internal');
continue := true; continue := true;
end; end;
else else

View File

@ -454,11 +454,6 @@ end;
function TDbgWinProcess.ResolveDebugEvent(AThread: TDbgThread): TFPDEvent; function TDbgWinProcess.ResolveDebugEvent(AThread: TDbgThread): TFPDEvent;
procedure HandleCreateThread(const AEvent: TDebugEvent);
begin
DebugLn(Format('Start adress: 0x%p', [AEvent.CreateThread.lpStartAddress]));
end;
procedure HandleException(const AEvent: TDebugEvent); procedure HandleException(const AEvent: TDebugEvent);
const const
PARAMCOLS = 12 - SizeOf(Pointer); PARAMCOLS = 12 - SizeOf(Pointer);
@ -471,10 +466,13 @@ function TDbgWinProcess.ResolveDebugEvent(AThread: TDbgThread): TFPDEvent;
ExInfo32: TExceptionDebugInfo32 absolute AEvent.Exception; ExInfo32: TExceptionDebugInfo32 absolute AEvent.Exception;
ExInfo64: TExceptionDebugInfo64 absolute AEvent.Exception; ExInfo64: TExceptionDebugInfo64 absolute AEvent.Exception;
begin begin
// Kept the debug-output as comments, since they provide deeper information
// on how to interprete the exception-information.
{
if AEvent.Exception.dwFirstChance = 0 if AEvent.Exception.dwFirstChance = 0
then DebugLn('Exception: ') then DebugLn('Exception: ')
else DebugLn('First chance exception: '); else DebugLn('First chance exception: ');
}
// in both 32 and 64 case is the exceptioncode the first, so no difference // in both 32 and 64 case is the exceptioncode the first, so no difference
case AEvent.Exception.ExceptionRecord.ExceptionCode of case AEvent.Exception.ExceptionRecord.ExceptionCode of
EXCEPTION_ACCESS_VIOLATION : ExceptionClass:='ACCESS VIOLATION'; EXCEPTION_ACCESS_VIOLATION : ExceptionClass:='ACCESS VIOLATION';
@ -514,6 +512,7 @@ function TDbgWinProcess.ResolveDebugEvent(AThread: TDbgThread): TFPDEvent;
} }
else else
ExceptionClass := 'Unknown exception code $' + IntToHex(ExInfo32.ExceptionRecord.ExceptionCode, 8); ExceptionClass := 'Unknown exception code $' + IntToHex(ExInfo32.ExceptionRecord.ExceptionCode, 8);
{
DebugLn(' ['); DebugLn(' [');
case ExInfo32.ExceptionRecord.ExceptionCode and $C0000000 of case ExInfo32.ExceptionRecord.ExceptionCode and $C0000000 of
STATUS_SEVERITY_SUCCESS : DebugLn('SEVERITY_ERROR'); STATUS_SEVERITY_SUCCESS : DebugLn('SEVERITY_ERROR');
@ -541,11 +540,11 @@ function TDbgWinProcess.ResolveDebugEvent(AThread: TDbgThread): TFPDEvent;
DebugLn(' Facility: $', IntToHex((ExInfo32.ExceptionRecord.ExceptionCode and $0FFF0000) shr 16, 3)); DebugLn(' Facility: $', IntToHex((ExInfo32.ExceptionRecord.ExceptionCode and $0FFF0000) shr 16, 3));
end; end;
DebugLn(' Code: $', IntToHex((ExInfo32.ExceptionRecord.ExceptionCode and $0000FFFF), 4)); DebugLn(' Code: $', IntToHex((ExInfo32.ExceptionRecord.ExceptionCode and $0000FFFF), 4));
}
end; end;
ExceptionClass:='External: '+ExceptionClass; ExceptionClass:='External: '+ExceptionClass;
DebugLn(ExceptionClass);
ExceptionMessage:=''; ExceptionMessage:='';
{
if GMode = dm32 if GMode = dm32
then Info0 := PtrUInt(ExInfo32.ExceptionRecord.ExceptionAddress) then Info0 := PtrUInt(ExInfo32.ExceptionRecord.ExceptionAddress)
else Info0 := PtrUInt(ExInfo64.ExceptionRecord.ExceptionAddress); else Info0 := PtrUInt(ExInfo64.ExceptionRecord.ExceptionAddress);
@ -559,7 +558,7 @@ function TDbgWinProcess.ResolveDebugEvent(AThread: TDbgThread): TFPDEvent;
if GMode = dm32 if GMode = dm32
then DebugLn(' ParamCount:', IntToStr(ExInfo32.ExceptionRecord.NumberParameters)) then DebugLn(' ParamCount:', IntToStr(ExInfo32.ExceptionRecord.NumberParameters))
else DebugLn(' ParamCount:', IntToStr(ExInfo64.ExceptionRecord.NumberParameters)); else DebugLn(' ParamCount:', IntToStr(ExInfo64.ExceptionRecord.NumberParameters));
}
case AEvent.Exception.ExceptionRecord.ExceptionCode of case AEvent.Exception.ExceptionRecord.ExceptionCode of
EXCEPTION_ACCESS_VIOLATION: begin EXCEPTION_ACCESS_VIOLATION: begin
if GMode = dm32 if GMode = dm32
@ -580,7 +579,7 @@ function TDbgWinProcess.ResolveDebugEvent(AThread: TDbgThread): TFPDEvent;
end; end;
end; end;
end; end;
{
DebugLn(' Info: '); DebugLn(' Info: ');
for n := 0 to EXCEPTION_MAXIMUM_PARAMETERS - 1 do for n := 0 to EXCEPTION_MAXIMUM_PARAMETERS - 1 do
begin begin
@ -595,25 +594,7 @@ function TDbgWinProcess.ResolveDebugEvent(AThread: TDbgThread): TFPDEvent;
end; end;
end; end;
DebugLn(''); DebugLn('');
end; }
procedure HandleCreateProcess(const AEvent: TDebugEvent);
var
S: String;
begin
DebugLn(Format('hFile: 0x%x', [AEvent.CreateProcessInfo.hFile]));
DebugLn(Format('hProcess: 0x%x', [AEvent.CreateProcessInfo.hProcess]));
DebugLn(Format('hThread: 0x%x', [AEvent.CreateProcessInfo.hThread]));
DebugLn('Base adress: ', FormatAddress(AEvent.CreateProcessInfo.lpBaseOfImage));
DebugLn(Format('Debugsize: %d', [AEvent.CreateProcessInfo.nDebugInfoSize]));
DebugLn(Format('Debugoffset: %d', [AEvent.CreateProcessInfo.dwDebugInfoFileOffset]));
StartProcess(AEvent.dwThreadId, AEvent.CreateProcessInfo);
end;
procedure HandleExitThread(const AEvent: TDebugEvent);
begin
DebugLn('Exitcode: ' + IntToStr(AEvent.ExitThread.dwExitCode));
end; end;
procedure DumpEvent(const AEvent: String); procedure DumpEvent(const AEvent: String);
@ -702,14 +683,6 @@ function TDbgWinProcess.ResolveDebugEvent(AThread: TDbgThread): TFPDEvent;
{$POP} {$POP}
end; end;
procedure HandleLoadDll(const AEvent: TDebugEvent);
var
Proc: TDbgProcess;
Lib: TDbgLibrary;
begin
DebugLn('Base adress: ', FormatAddress(AEvent.LoadDll.lpBaseOfDll));
end;
procedure HandleOutputDebug(const AEvent: TDebugEvent); procedure HandleOutputDebug(const AEvent: TDebugEvent);
var var
S: String; S: String;
@ -728,17 +701,6 @@ function TDbgWinProcess.ResolveDebugEvent(AThread: TDbgThread): TFPDEvent;
DebugLn('[', IntToStr(AEvent.dwProcessId), ':', IntToSTr(AEvent.dwThreadId), '] ', S); DebugLn('[', IntToStr(AEvent.dwProcessId), ':', IntToSTr(AEvent.dwThreadId), '] ', S);
end; end;
procedure HandleRipEvent(const AEvent: TDebugEvent);
begin
DebugLn('Error: ', IntToStr(AEvent.RipInfo.dwError));
DebugLn('Type: ', IntToStr(AEvent.RipInfo.dwType));
end;
procedure HandleUnloadDll(const AEvent: TDebugEvent);
begin
DebugLn('Base adress: ', FormatAddress(AEvent.UnloadDll.lpBaseOfDll));
end;
begin begin
if HandleDebugEvent(MDebugEvent) if HandleDebugEvent(MDebugEvent)
then result := deBreakpoint then result := deBreakpoint
@ -755,7 +717,7 @@ begin
case MDebugEvent.dwDebugEventCode of case MDebugEvent.dwDebugEventCode of
EXCEPTION_DEBUG_EVENT: begin EXCEPTION_DEBUG_EVENT: begin
DumpEvent('EXCEPTION_DEBUG_EVENT'); //DumpEvent('EXCEPTION_DEBUG_EVENT');
case MDebugEvent.Exception.ExceptionRecord.ExceptionCode of case MDebugEvent.Exception.ExceptionRecord.ExceptionCode of
EXCEPTION_BREAKPOINT: begin EXCEPTION_BREAKPOINT: begin
if DoBreak(TDbgPtr(MDebugEvent.Exception.ExceptionRecord.ExceptionAddress), MDebugEvent.dwThreadId) if DoBreak(TDbgPtr(MDebugEvent.Exception.ExceptionRecord.ExceptionAddress), MDebugEvent.dwThreadId)
@ -824,43 +786,38 @@ begin
end; end;
end; end;
CREATE_THREAD_DEBUG_EVENT: begin CREATE_THREAD_DEBUG_EVENT: begin
DumpEvent('CREATE_THREAD_DEBUG_EVENT'); //DumpEvent('CREATE_THREAD_DEBUG_EVENT');
HandleCreateThread(MDebugEvent);
result := deInternalContinue; result := deInternalContinue;
end; end;
CREATE_PROCESS_DEBUG_EVENT: begin CREATE_PROCESS_DEBUG_EVENT: begin
DumpEvent('CREATE_PROCESS_DEBUG_EVENT'); //DumpEvent('CREATE_PROCESS_DEBUG_EVENT');
HandleCreateProcess(MDebugEvent); StartProcess(MDebugEvent.dwThreadId, MDebugEvent.CreateProcessInfo);
result := deCreateProcess; result := deCreateProcess;
end; end;
EXIT_THREAD_DEBUG_EVENT: begin EXIT_THREAD_DEBUG_EVENT: begin
DumpEvent('EXIT_THREAD_DEBUG_EVENT'); //DumpEvent('EXIT_THREAD_DEBUG_EVENT');
HandleExitThread(MDebugEvent);
result := deInternalContinue; result := deInternalContinue;
end; end;
EXIT_PROCESS_DEBUG_EVENT: begin EXIT_PROCESS_DEBUG_EVENT: begin
DumpEvent('EXIT_PROCESS_DEBUG_EVENT'); //DumpEvent('EXIT_PROCESS_DEBUG_EVENT');
SetExitCode(MDebugEvent.ExitProcess.dwExitCode); SetExitCode(MDebugEvent.ExitProcess.dwExitCode);
result := deExitProcess; result := deExitProcess;
end; end;
LOAD_DLL_DEBUG_EVENT: begin LOAD_DLL_DEBUG_EVENT: begin
DumpEvent('LOAD_DLL_DEBUG_EVENT'); //DumpEvent('LOAD_DLL_DEBUG_EVENT');
HandleLoadDll(MDebugEvent);
result := deLoadLibrary; result := deLoadLibrary;
end; end;
UNLOAD_DLL_DEBUG_EVENT: begin UNLOAD_DLL_DEBUG_EVENT: begin
DumpEvent('UNLOAD_DLL_DEBUG_EVENT'); //DumpEvent('UNLOAD_DLL_DEBUG_EVENT');
HandleUnloadDll(MDebugEvent);
result := deInternalContinue; result := deInternalContinue;
end; end;
OUTPUT_DEBUG_STRING_EVENT: begin OUTPUT_DEBUG_STRING_EVENT: begin
DumpEvent('OUTPUT_DEBUG_STRING_EVENT'); //DumpEvent('OUTPUT_DEBUG_STRING_EVENT');
HandleOutputDebug(MDebugEvent); HandleOutputDebug(MDebugEvent);
result := deInternalContinue; result := deInternalContinue;
end; end;
RIP_EVENT: begin RIP_EVENT: begin
DumpEvent('RIP_EVENT'); //DumpEvent('RIP_EVENT');
HandleRipEvent(MDebugEvent);
result := deInternalContinue; result := deInternalContinue;
end end
else begin else begin