FpDebug: debugln

git-svn-id: trunk@62406 -
This commit is contained in:
martin 2019-12-16 23:22:53 +00:00
parent 4640c96ffc
commit 98aa637a42
6 changed files with 25 additions and 26 deletions

View File

@ -1507,7 +1507,6 @@ begin
while (not Result) and (sz > 1) do begin while (not Result) and (sz > 1) do begin
sz := sz div 2; sz := sz div 2;
Result := ReadData(AAdress, sz, (@AData + Offs)^); Result := ReadData(AAdress, sz, (@AData + Offs)^);
debugln(['>>>>>>>>> PART READ MEM ', Offs, ' : ', sz, ' ',Result, ' ', APartSize]);
end; end;
if not Result then if not Result then
break; break;
@ -2160,7 +2159,6 @@ begin
Result := ( (FPausedAtRemovedBreakPointState = rbFound) and Result := ( (FPausedAtRemovedBreakPointState = rbFound) and
(FPausedAtRemovedBreakPointAddress = t) ) or (FPausedAtRemovedBreakPointAddress = t) ) or
( (t <> 0) and Process.HasInsertedBreakInstructionAtLocation(t - 1) ); ( (t <> 0) and Process.HasInsertedBreakInstructionAtLocation(t - 1) );
debugln(['####### CHECK ',result, ' for id ', ID, ' stored ', FPausedAtRemovedBreakPointState=rbFound, ' ',FPausedAtRemovedBreakPointAddress=t, ' ',dbghex(t), ' ', dbghex(FPausedAtRemovedBreakPointAddress)]);
end; end;
procedure TDbgThread.CheckAndResetInstructionPointerAfterBreakpoint; procedure TDbgThread.CheckAndResetInstructionPointerAfterBreakpoint;

View File

@ -1268,9 +1268,7 @@ begin
// TODO: only valid, as long as context is valid, because if context is freed, then self is lost too // TODO: only valid, as long as context is valid, because if context is freed, then self is lost too
ADbgValue := SelfParam.MemberByName[AName]; ADbgValue := SelfParam.MemberByName[AName];
assert(ADbgValue <> nil, 'FindSymbol: SelfParam.MemberByName[AName]'); assert(ADbgValue <> nil, 'FindSymbol: SelfParam.MemberByName[AName]');
end end;
else debugln(['TDbgDwarfInfoAddressContext.FindSymbol XXXXXXXXXXXXX no self']);
;
if ADbgValue = nil then begin // Todo: abort the searh /SetError if ADbgValue = nil then begin // Todo: abort the searh /SetError
ADbgValue := SymbolToValue(TFpSymbolDwarf.CreateSubClass(AName, InfoEntry)); ADbgValue := SymbolToValue(TFpSymbolDwarf.CreateSubClass(AName, InfoEntry));
end; end;
@ -3308,13 +3306,13 @@ begin
// DW_AT_data_member_location in members [ block or const] // DW_AT_data_member_location in members [ block or const]
// DW_AT_location [block or reference] todo: const // DW_AT_location [block or reference] todo: const
if not InformationEntry.ReadValue(AnAttribData, Val) then begin if not InformationEntry.ReadValue(AnAttribData, Val) then begin
DebugLn(['LocationFromAttrData: failed to read DW_AT_location']); DebugLn([FPDBG_DWARF_VERBOSE, 'LocationFromAttrData: failed to read DW_AT_location']);
SetLastError(AValueObj, CreateError(fpErrAnyError)); SetLastError(AValueObj, CreateError(fpErrAnyError));
exit; exit;
end; end;
if Length(Val) = 0 then begin if Length(Val) = 0 then begin
DebugLn('LocationFromAttrData: Warning DW_AT_location empty'); DebugLn(FPDBG_DWARF_VERBOSE, 'LocationFromAttrData: Warning DW_AT_location empty');
SetLastError(AValueObj, CreateError(fpErrAnyError)); SetLastError(AValueObj, CreateError(fpErrAnyError));
//exit; //exit;
end; end;
@ -3331,7 +3329,7 @@ begin
Result := IsValidLoc(AnAddress); Result := IsValidLoc(AnAddress);
if IsTargetAddr(AnAddress) and AnAdjustAddress then if IsTargetAddr(AnAddress) and AnAdjustAddress then
AnAddress.Address :=CompilationUnit.MapAddressToNewValue(AnAddress.Address); AnAddress.Address :=CompilationUnit.MapAddressToNewValue(AnAddress.Address);
debugln(not Result, ['TDbgDwarfIdentifier.LocationFromAttrDataFAILED']); // TODO debugln(FPDBG_DWARF_VERBOSE and (not Result), ['TDbgDwarfIdentifier.LocationFromAttrDataFAILED']); // TODO
LocationParser.Free; LocationParser.Free;
end; end;
@ -3359,7 +3357,7 @@ begin
if not Result then if not Result then
AnAddress := InvalidLoc; AnAddress := InvalidLoc;
if not Result then if not Result then
DebugLn(['LocationFromTag: failed to read DW_AT_..._location / ASucessOnMissingTag=', dbgs(ASucessOnMissingTag)]); DebugLn([FPDBG_DWARF_VERBOSE, 'LocationFromTag: failed to read DW_AT_..._location / ASucessOnMissingTag=', dbgs(ASucessOnMissingTag)]);
exit; exit;
end; end;
@ -4613,8 +4611,8 @@ end;
function TFpSymbolDwarfDataMember.GetValueAddress(AValueObj: TFpValueDwarf; out function TFpSymbolDwarfDataMember.GetValueAddress(AValueObj: TFpValueDwarf; out
AnAddress: TFpDbgMemLocation): Boolean; AnAddress: TFpDbgMemLocation): Boolean;
begin begin
if AValueObj = nil then debugln(['TFpSymbolDwarfDataMember.InitLocationParser: NO VAl Obj !!!!!!!!!!!!!!!']) if AValueObj = nil then debugln([FPDBG_DWARF_VERBOSE, 'TFpSymbolDwarfDataMember.InitLocationParser: NO VAl Obj !!!!!!!!!!!!!!!'])
else if AValueObj.StructureValue = nil then debugln(['TFpSymbolDwarfDataMember.InitLocationParser: NO STRUCT Obj !!!!!!!!!!!!!!!']); else if AValueObj.StructureValue = nil then debugln(FPDBG_DWARF_VERBOSE, ['TFpSymbolDwarfDataMember.InitLocationParser: NO STRUCT Obj !!!!!!!!!!!!!!!']);
if (AValueObj = nil) or (AValueObj.StructureValue = nil) or (AValueObj.FParentTypeSymbol = nil) if (AValueObj = nil) or (AValueObj.StructureValue = nil) or (AValueObj.FParentTypeSymbol = nil)
then begin then begin
@ -5035,13 +5033,11 @@ procedure TFpSymbolDwarfTypeArray.ResetValueBounds;
var var
i: Integer; i: Integer;
begin begin
debuglnEnter(['TFpSymbolDwarfTypeArray.ResetValueBounds ' , Self.ClassName, dbgs(self)]); try
inherited ResetValueBounds; inherited ResetValueBounds;
if FMembers <> nil then if FMembers <> nil then
for i := 0 to FMembers.Count - 1 do for i := 0 to FMembers.Count - 1 do
if TObject(FMembers[i]) is TFpSymbolDwarfType then if TObject(FMembers[i]) is TFpSymbolDwarfType then
TFpSymbolDwarfType(FMembers[i]).ResetValueBounds; TFpSymbolDwarfType(FMembers[i]).ResetValueBounds;
finally debuglnExit(['TFpSymbolDwarfTypeArray.ResetValueBounds ' ]); end;
end; end;
{ TDbgDwarfSymbol } { TDbgDwarfSymbol }

View File

@ -215,6 +215,9 @@ type
implementation implementation
var
FPDBG_DWARF_VERBOSE: PLazLoggerLogGroup;
{ TFpDwarfFreePascalSymbolClassMap } { TFpDwarfFreePascalSymbolClassMap }
function TFpDwarfFreePascalSymbolClassMap.CanHandleCompUnit( function TFpDwarfFreePascalSymbolClassMap.CanHandleCompUnit(
@ -455,7 +458,7 @@ begin
ParentFpVal := ParentFpSym.Value; ParentFpVal := ParentFpSym.Value;
ApplyContext(ParentFpVal); ApplyContext(ParentFpVal);
if not (svfOrdinal in ParentFpVal.FieldFlags) then begin if not (svfOrdinal in ParentFpVal.FieldFlags) then begin
DebugLn('no ordinal for parentfp'); DebugLn(FPDBG_DWARF_VERBOSE, 'no ordinal for parentfp');
ParentFpSym.ReleaseReference; ParentFpSym.ReleaseReference;
ParentFpVal.ReleaseReference; ParentFpVal.ReleaseReference;
FOuterNotFound := True; FOuterNotFound := True;
@ -465,9 +468,8 @@ begin
par_fp := ParentFpVal.AsCardinal; par_fp := ParentFpVal.AsCardinal;
ParentFpVal.ReleaseReference; ParentFpVal.ReleaseReference;
ParentFpSym.ReleaseReference; ParentFpSym.ReleaseReference;
DebugLn(['par_fp=',par_fp]);
if par_fp = 0 then begin if par_fp = 0 then begin
DebugLn('no ordinal for parentfp'); DebugLn(FPDBG_DWARF_VERBOSE, 'no ordinal for parentfp');
FOuterNotFound := True; FOuterNotFound := True;
exit; exit;
end; end;
@ -1188,5 +1190,7 @@ initialization
DwarfSymbolClassMapList.AddMap(TFpDwarfFreePascalSymbolClassMapDwarf2); DwarfSymbolClassMapList.AddMap(TFpDwarfFreePascalSymbolClassMapDwarf2);
DwarfSymbolClassMapList.AddMap(TFpDwarfFreePascalSymbolClassMapDwarf3); DwarfSymbolClassMapList.AddMap(TFpDwarfFreePascalSymbolClassMapDwarf3);
FPDBG_DWARF_VERBOSE := DebugLogger.FindOrRegisterLogGroup('FPDBG_DWARF_VERBOSE' {$IFDEF FPDBG_DWARF_VERBOSE} , True {$ENDIF} );
end. end.

View File

@ -102,7 +102,7 @@
unit FpDbgWinClasses; unit FpDbgWinClasses;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
{$DEFINE DebuglnWinDebugEvents} {off $DEFINE DebuglnWinDebugEvents}
interface interface
@ -1512,7 +1512,7 @@ begin
Dr2 := DWORD(TFpIntelWatchPointData(AWatchPointData).Dr03[2]); Dr2 := DWORD(TFpIntelWatchPointData(AWatchPointData).Dr03[2]);
Dr3 := DWORD(TFpIntelWatchPointData(AWatchPointData).Dr03[3]); Dr3 := DWORD(TFpIntelWatchPointData(AWatchPointData).Dr03[3]);
Dr7 := (Dr7 and $0000FF00) or DWORD(TFpIntelWatchPointData(AWatchPointData).Dr7); Dr7 := (Dr7 and $0000FF00) or DWORD(TFpIntelWatchPointData(AWatchPointData).Dr7);
DebugLn('### WATCH ADDED dr0 %x dr1 %x dr2 %x dr3 %x dr7 %x', [ dr0,dr1,dr2,dr3, dr7]); DebugLn(DBG_VERBOSE, '### WATCH ADDED dr0 %x dr1 %x dr2 %x dr3 %x dr7 %x', [ dr0,dr1,dr2,dr3, dr7]);
end; end;
end end
else begin else begin
@ -1523,7 +1523,7 @@ DebugLn('### WATCH ADDED dr0 %x dr1 %x dr2 %x dr3 %x dr7 %x', [ dr0,dr1
Dr2 := TFpIntelWatchPointData(AWatchPointData).Dr03[2]; Dr2 := TFpIntelWatchPointData(AWatchPointData).Dr03[2];
Dr3 := TFpIntelWatchPointData(AWatchPointData).Dr03[3]; Dr3 := TFpIntelWatchPointData(AWatchPointData).Dr03[3];
Dr7 := (Dr7 and $0000FF00) or TFpIntelWatchPointData(AWatchPointData).Dr7; Dr7 := (Dr7 and $0000FF00) or TFpIntelWatchPointData(AWatchPointData).Dr7;
DebugLn('### WATCH ADDED dr0 %x dr1 %x dr2 %x dr3 %x dr7 %x', [ dr0,dr1,dr2,dr3, dr7]); DebugLn(DBG_VERBOSE, '### WATCH ADDED dr0 %x dr1 %x dr2 %x dr3 %x dr7 %x', [ dr0,dr1,dr2,dr3, dr7]);
end; end;
{$ifdef cpux86_64} {$ifdef cpux86_64}
end; end;

View File

@ -418,7 +418,7 @@ function dbgs(const AReadDataType: TFpDbgMemReadDataType): String; overload;
implementation implementation
var var
DBG_VERBOSE: PLazLoggerLogGroup; FPDBG_VERBOSE_MEM: PLazLoggerLogGroup;
function NilLoc: TFpDbgMemLocation; function NilLoc: TFpDbgMemLocation;
begin begin
@ -1125,7 +1125,7 @@ var
SourceReadSize, SourceFullSize: QWord; SourceReadSize, SourceFullSize: QWord;
begin begin
Result := False; Result := False;
DebugLn(DBG_VERBOSE, ['$ReadMem: ', dbgs(AReadDataType),' ', dbgs(ASourceLocation), ' ', dbgs(ASourceSize), ' Dest ', ADestSize]); DebugLn(FPDBG_VERBOSE_MEM, ['$ReadMem: ', dbgs(AReadDataType),' ', dbgs(ASourceLocation), ' ', dbgs(ASourceSize), ' Dest ', ADestSize]);
if (ASourceLocation.MType in [mlfInvalid, mlfUninitialized]) or if (ASourceLocation.MType in [mlfInvalid, mlfUninitialized]) or
(ASourceSize <= 0) (ASourceSize <= 0)
then begin then begin
@ -1460,6 +1460,6 @@ begin
end; end;
initialization initialization
DBG_VERBOSE := DebugLogger.FindOrRegisterLogGroup('DBG_VERBOSE' {$IFDEF DBG_VERBOSE} , True {$ENDIF} ); FPDBG_VERBOSE_MEM := DebugLogger.FindOrRegisterLogGroup('FPDBG_VERBOSE_MEM' {$IFDEF FPDBG_VERBOSE_MEM} , True {$ENDIF} );
end. end.

View File

@ -458,7 +458,7 @@ uses
FpDbgDisasX86; FpDbgDisasX86;
var var
DBG_BREAKPOINTS, FPDBG_COMMANDS: PLazLoggerLogGroup; DBG_VERBOSE, DBG_BREAKPOINTS, FPDBG_COMMANDS: PLazLoggerLogGroup;
type type
@ -2793,7 +2793,7 @@ end;
procedure TFpDebugDebugger.StartDebugLoop; procedure TFpDebugDebugger.StartDebugLoop;
begin begin
{$ifdef DBG_FPDEBUG_VERBOSE} {$ifdef DBG_FPDEBUG_VERBOSE}
DebugLn('StartDebugLoop'); DebugLn(DBG_VERBOSE, 'StartDebugLoop');
{$endif DBG_FPDEBUG_VERBOSE} {$endif DBG_FPDEBUG_VERBOSE}
RTLeventSetEvent(FFpDebugThread.StartDebugLoopEvent); RTLeventSetEvent(FFpDebugThread.StartDebugLoopEvent);
end; end;
@ -2805,7 +2805,7 @@ begin
LockRelease; LockRelease;
try try
{$ifdef DBG_FPDEBUG_VERBOSE} {$ifdef DBG_FPDEBUG_VERBOSE}
DebugLn('DebugLoopFinished'); DebugLn(DBG_VERBOSE, 'DebugLoopFinished');
{$endif DBG_FPDEBUG_VERBOSE} {$endif DBG_FPDEBUG_VERBOSE}
(* Need to ensure CurrentThreadId is correct, (* Need to ensure CurrentThreadId is correct,
@ -2838,7 +2838,7 @@ end;
procedure TFpDebugDebugger.DoRelease; procedure TFpDebugDebugger.DoRelease;
begin begin
DebugLn(['++++ dorelase ', Dbgs(ptrint(FDbgController)), dbgs(state)]); DebugLn(DBG_VERBOSE, ['++++ dorelase ', Dbgs(ptrint(FDbgController)), dbgs(state)]);
// SetState(dsDestroying); // SetState(dsDestroying);
if (State <> dsDestroying) and //assigned(FFpDebugThread) and //??? if (State <> dsDestroying) and //assigned(FFpDebugThread) and //???
(FDbgController <> nil) and (FDbgController.MainProcess <> nil) (FDbgController <> nil) and (FDbgController.MainProcess <> nil)
@ -3225,6 +3225,7 @@ begin
end; end;
initialization initialization
DBG_VERBOSE := DebugLogger.FindOrRegisterLogGroup('DBG_VERBOSE' {$IFDEF DBG_VERBOSE} , True {$ENDIF} );
DBG_BREAKPOINTS := DebugLogger.FindOrRegisterLogGroup('DBG_BREAKPOINTS' {$IFDEF DBG_BREAKPOINTS} , True {$ENDIF} ); DBG_BREAKPOINTS := DebugLogger.FindOrRegisterLogGroup('DBG_BREAKPOINTS' {$IFDEF DBG_BREAKPOINTS} , True {$ENDIF} );
FPDBG_COMMANDS := DebugLogger.FindOrRegisterLogGroup('FPDBG_COMMANDS' {$IFDEF FPDBG_COMMANDS} , True {$ENDIF} ); FPDBG_COMMANDS := DebugLogger.FindOrRegisterLogGroup('FPDBG_COMMANDS' {$IFDEF FPDBG_COMMANDS} , True {$ENDIF} );