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

View File

@ -454,11 +454,6 @@ end;
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);
const
PARAMCOLS = 12 - SizeOf(Pointer);
@ -471,10 +466,13 @@ function TDbgWinProcess.ResolveDebugEvent(AThread: TDbgThread): TFPDEvent;
ExInfo32: TExceptionDebugInfo32 absolute AEvent.Exception;
ExInfo64: TExceptionDebugInfo64 absolute AEvent.Exception;
begin
// Kept the debug-output as comments, since they provide deeper information
// on how to interprete the exception-information.
{
if AEvent.Exception.dwFirstChance = 0
then DebugLn('Exception: ')
else DebugLn('First chance exception: ');
}
// in both 32 and 64 case is the exceptioncode the first, so no difference
case AEvent.Exception.ExceptionRecord.ExceptionCode of
EXCEPTION_ACCESS_VIOLATION : ExceptionClass:='ACCESS VIOLATION';
@ -514,6 +512,7 @@ function TDbgWinProcess.ResolveDebugEvent(AThread: TDbgThread): TFPDEvent;
}
else
ExceptionClass := 'Unknown exception code $' + IntToHex(ExInfo32.ExceptionRecord.ExceptionCode, 8);
{
DebugLn(' [');
case ExInfo32.ExceptionRecord.ExceptionCode and $C0000000 of
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));
end;
DebugLn(' Code: $', IntToHex((ExInfo32.ExceptionRecord.ExceptionCode and $0000FFFF), 4));
}
end;
ExceptionClass:='External: '+ExceptionClass;
DebugLn(ExceptionClass);
ExceptionMessage:='';
{
if GMode = dm32
then Info0 := PtrUInt(ExInfo32.ExceptionRecord.ExceptionAddress)
else Info0 := PtrUInt(ExInfo64.ExceptionRecord.ExceptionAddress);
@ -559,7 +558,7 @@ function TDbgWinProcess.ResolveDebugEvent(AThread: TDbgThread): TFPDEvent;
if GMode = dm32
then DebugLn(' ParamCount:', IntToStr(ExInfo32.ExceptionRecord.NumberParameters))
else DebugLn(' ParamCount:', IntToStr(ExInfo64.ExceptionRecord.NumberParameters));
}
case AEvent.Exception.ExceptionRecord.ExceptionCode of
EXCEPTION_ACCESS_VIOLATION: begin
if GMode = dm32
@ -580,7 +579,7 @@ function TDbgWinProcess.ResolveDebugEvent(AThread: TDbgThread): TFPDEvent;
end;
end;
end;
{
DebugLn(' Info: ');
for n := 0 to EXCEPTION_MAXIMUM_PARAMETERS - 1 do
begin
@ -595,25 +594,7 @@ function TDbgWinProcess.ResolveDebugEvent(AThread: TDbgThread): TFPDEvent;
end;
end;
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;
procedure DumpEvent(const AEvent: String);
@ -702,14 +683,6 @@ function TDbgWinProcess.ResolveDebugEvent(AThread: TDbgThread): TFPDEvent;
{$POP}
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);
var
S: String;
@ -728,17 +701,6 @@ function TDbgWinProcess.ResolveDebugEvent(AThread: TDbgThread): TFPDEvent;
DebugLn('[', IntToStr(AEvent.dwProcessId), ':', IntToSTr(AEvent.dwThreadId), '] ', S);
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
if HandleDebugEvent(MDebugEvent)
then result := deBreakpoint
@ -755,7 +717,7 @@ begin
case MDebugEvent.dwDebugEventCode of
EXCEPTION_DEBUG_EVENT: begin
DumpEvent('EXCEPTION_DEBUG_EVENT');
//DumpEvent('EXCEPTION_DEBUG_EVENT');
case MDebugEvent.Exception.ExceptionRecord.ExceptionCode of
EXCEPTION_BREAKPOINT: begin
if DoBreak(TDbgPtr(MDebugEvent.Exception.ExceptionRecord.ExceptionAddress), MDebugEvent.dwThreadId)
@ -824,43 +786,38 @@ begin
end;
end;
CREATE_THREAD_DEBUG_EVENT: begin
DumpEvent('CREATE_THREAD_DEBUG_EVENT');
HandleCreateThread(MDebugEvent);
//DumpEvent('CREATE_THREAD_DEBUG_EVENT');
result := deInternalContinue;
end;
CREATE_PROCESS_DEBUG_EVENT: begin
DumpEvent('CREATE_PROCESS_DEBUG_EVENT');
HandleCreateProcess(MDebugEvent);
//DumpEvent('CREATE_PROCESS_DEBUG_EVENT');
StartProcess(MDebugEvent.dwThreadId, MDebugEvent.CreateProcessInfo);
result := deCreateProcess;
end;
EXIT_THREAD_DEBUG_EVENT: begin
DumpEvent('EXIT_THREAD_DEBUG_EVENT');
HandleExitThread(MDebugEvent);
//DumpEvent('EXIT_THREAD_DEBUG_EVENT');
result := deInternalContinue;
end;
EXIT_PROCESS_DEBUG_EVENT: begin
DumpEvent('EXIT_PROCESS_DEBUG_EVENT');
//DumpEvent('EXIT_PROCESS_DEBUG_EVENT');
SetExitCode(MDebugEvent.ExitProcess.dwExitCode);
result := deExitProcess;
end;
LOAD_DLL_DEBUG_EVENT: begin
DumpEvent('LOAD_DLL_DEBUG_EVENT');
HandleLoadDll(MDebugEvent);
//DumpEvent('LOAD_DLL_DEBUG_EVENT');
result := deLoadLibrary;
end;
UNLOAD_DLL_DEBUG_EVENT: begin
DumpEvent('UNLOAD_DLL_DEBUG_EVENT');
HandleUnloadDll(MDebugEvent);
//DumpEvent('UNLOAD_DLL_DEBUG_EVENT');
result := deInternalContinue;
end;
OUTPUT_DEBUG_STRING_EVENT: begin
DumpEvent('OUTPUT_DEBUG_STRING_EVENT');
//DumpEvent('OUTPUT_DEBUG_STRING_EVENT');
HandleOutputDebug(MDebugEvent);
result := deInternalContinue;
end;
RIP_EVENT: begin
DumpEvent('RIP_EVENT');
HandleRipEvent(MDebugEvent);
//DumpEvent('RIP_EVENT');
result := deInternalContinue;
end
else begin