FpDebug: test and helper apps, fixed some compile errors

git-svn-id: trunk@64555 -
This commit is contained in:
martin 2021-02-12 18:31:09 +00:00
parent 068feeb931
commit 14dc58d892
7 changed files with 91 additions and 55 deletions

View File

@ -263,7 +263,10 @@ begin
Val(P, Address, e); Val(P, Address, e);
if e <> 0 if e <> 0
then begin then begin
AContext := GController.CurrentProcess.SymbolTableInfo.FindSymbolScope(GController.CurrentThread.GetInstructionPointerRegisterValue); AContext := GController.CurrentProcess.SymbolTableInfo.FindSymbolScope(
GController.DefaultContext,
GController.CurrentThread.GetInstructionPointerRegisterValue
);
if AContext = nil then begin if AContext = nil then begin
Writeln('Invalid context'); Writeln('Invalid context');
exit; exit;
@ -593,7 +596,10 @@ begin
S := AParams; S := AParams;
P := GetPart([], [' ', #9], S); P := GetPart([], [' ', #9], S);
AContext := GController.CurrentProcess.DbgInfo.FindSymbolScope(GController.CurrentThread.GetInstructionPointerRegisterValue); AContext := GController.CurrentProcess.DbgInfo.FindSymbolScope(
GController.DefaultContext,
GController.CurrentThread.GetInstructionPointerRegisterValue
);
if AContext = nil then begin if AContext = nil then begin
Writeln('Invalid context'); Writeln('Invalid context');
exit; exit;

View File

@ -686,7 +686,6 @@ begin
end; end;
Result := True; Result := True;
AContext.MemManager.DefaultContext := AContext.LocationContext;
APasExpr := TFpPascalExpression.Create(FExpression, AContext); APasExpr := TFpPascalExpression.Create(FExpression, AContext);
try try
APasExpr.ResultValue; // trigger full validation APasExpr.ResultValue; // trigger full validation
@ -700,7 +699,7 @@ begin
APrettyPrinter := TFpPascalPrettyPrinter.Create(sizeof(pointer)); APrettyPrinter := TFpPascalPrettyPrinter.Create(sizeof(pointer));
try try
APrettyPrinter.AddressSize:=AContext.SizeOfAddress; APrettyPrinter.AddressSize:=AContext.SizeOfAddress;
APrettyPrinter.MemManager := AContext.MemManager; APrettyPrinter.Context := AContext.LocationContext;
Res := APrettyPrinter.PrintValue(FResText, ATypeInfo, APasExpr.ResultValue); Res := APrettyPrinter.PrintValue(FResText, ATypeInfo, APasExpr.ResultValue);
if Res then if Res then
begin begin

View File

@ -15,8 +15,27 @@
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>
</i18n> </i18n>
<BuildModes Count="1"> <BuildModes Count="2">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
<Item2 Name="32bit">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<TargetCPU Value="i386"/>
<TargetOS Value="win32"/>
</CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf3"/>
</Debugging>
</Linking>
</CompilerOptions>
</Item2>
</BuildModes> </BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>

View File

@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/> <Version Value="12"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<General> <General>
<Flags>
<CompatibilityMode Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="dwarfviewer"/> <Title Value="dwarfviewer"/>
<ResourceType Value="res"/> <ResourceType Value="res"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
@ -13,9 +15,6 @@
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>
</i18n> </i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="2"> <BuildModes Count="2">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
<Item2 Name="opti"> <Item2 Name="opti">
@ -38,11 +37,7 @@
</Debugging> </Debugging>
</Linking> </Linking>
<Other> <Other>
<CompilerMessages>
<UseMsgFile Value="True"/>
</CompilerMessages>
<CustomOptions Value="-WC"/> <CustomOptions Value="-WC"/>
<CompilerPath Value="$(CompPath)"/>
</Other> </Other>
</CompilerOptions> </CompilerOptions>
</Item2> </Item2>
@ -54,12 +49,12 @@
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<DestinationDirectory Value="B:\tmp_work\dwarfviewer"/> <DestinationDirectory Value="B:\tmp_work\dwarfviewer"/>
<UseExcludeFileFilter Value="True"/>
</PublishOptions> </PublishOptions>
<RunParams> <RunParams>
<local> <FormatVersion Value="2"/>
<FormatVersion Value="1"/> <Modes Count="1">
</local> <Mode0 Name="default"/>
</Modes>
</RunParams> </RunParams>
<RequiredPackages Count="2"> <RequiredPackages Count="2">
<Item1> <Item1>
@ -73,7 +68,6 @@
<Unit0> <Unit0>
<Filename Value="dwarfviewer.lpr"/> <Filename Value="dwarfviewer.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="dwarfviewer"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="unit1.pas"/> <Filename Value="unit1.pas"/>

View File

@ -203,7 +203,7 @@ begin
FImageLoaderList := TDbgImageLoaderList.Create(True); FImageLoaderList := TDbgImageLoaderList.Create(True);
ImageLoader.AddToLoaderList(FImageLoaderList); ImageLoader.AddToLoaderList(FImageLoaderList);
FDwarfInfo := TFpDwarfInfo.Create(FImageLoaderList); FDwarfInfo := TFpDwarfInfo.Create(FImageLoaderList, nil);
FCUCount := FDwarfInfo.LoadCompilationUnits; FCUCount := FDwarfInfo.LoadCompilationUnits;
end; end;

View File

@ -5,8 +5,9 @@ unit TestMemManager;
interface interface
uses uses
FpDbgDwarf, FpDbgUtil, FpdMemoryTools, TestHelperClasses, LazLoggerBase, LazUTF8, FpDbgDwarf, FpDbgUtil, FpdMemoryTools, FpDbgInfo, TestHelperClasses,
DbgIntfBaseTypes, sysutils, fpcunit, testregistry; LazLoggerBase, LazUTF8, LazClasses, DbgIntfBaseTypes, sysutils, fpcunit,
testregistry;
type type
@ -19,6 +20,7 @@ type
FMemConvTarget: TFpDbgMemConvertorLittleEndian; FMemConvTarget: TFpDbgMemConvertorLittleEndian;
FMemConvSelf: TFpDbgMemConvertorLittleEndian; FMemConvSelf: TFpDbgMemConvertorLittleEndian;
FMemManager: TFpDbgMemManager; FMemManager: TFpDbgMemManager;
FDummyContext: TFpDbgSimpleLocationContext;
procedure InitMemMgr; procedure InitMemMgr;
procedure SetUp; override; procedure SetUp; override;
@ -36,6 +38,7 @@ begin
FMemConvTarget := TFpDbgMemConvertorLittleEndian.Create; FMemConvTarget := TFpDbgMemConvertorLittleEndian.Create;
FMemConvSelf := TFpDbgMemConvertorLittleEndian.Create; FMemConvSelf := TFpDbgMemConvertorLittleEndian.Create;
FMemManager := TFpDbgMemManager.Create(FMemReader, FMemConvTarget, FMemConvSelf); FMemManager := TFpDbgMemManager.Create(FMemReader, FMemConvTarget, FMemConvSelf);
FDummyContext := TFpDbgSimpleLocationContext.Create(FMemManager, 0, 4, 0, 0);
end; end;
procedure TTestMemManager.SetUp; procedure TTestMemManager.SetUp;
@ -50,6 +53,7 @@ end;
procedure TTestMemManager.TearDown; procedure TTestMemManager.TearDown;
begin begin
inherited TearDown; inherited TearDown;
ReleaseRefAndNil(FDummyContext);
FreeAndNil(FMemReader); FreeAndNil(FMemReader);
FreeAndNil(FMemConvTarget); FreeAndNil(FMemConvTarget);
FreeAndNil(FMemConvSelf); FreeAndNil(FMemConvSelf);
@ -99,28 +103,28 @@ var
var var
a: Cardinal; a: Cardinal;
begin begin
GotRes := FMemManager.ReadSignedInt(TargetLoc(TDbgPtr(@Data)), SizeVal(ReadSize), GotInt); GotRes := FDummyContext.ReadSignedInt(TargetLoc(TDbgPtr(@Data)), SizeVal(ReadSize), GotInt);
CheckIntRes('signed target', ExpIntVal); CheckIntRes('signed target', ExpIntVal);
GotRes := FMemManager.ReadSignedInt(SelfLoc(@Data), SizeVal(ReadSize), GotInt); GotRes := FDummyContext.ReadSignedInt(SelfLoc(@Data), SizeVal(ReadSize), GotInt);
CheckIntRes('signed self', ExpIntVal); CheckIntRes('signed self', ExpIntVal);
FMemReader.RegisterSizes[2] := ReadSize; FMemReader.RegisterSizes[2] := ReadSize;
GotRes := FMemManager.ReadSignedInt(RegisterLoc(2), SizeVal(ReadSize), GotInt); GotRes := FDummyContext.ReadSignedInt(RegisterLoc(2), SizeVal(ReadSize), GotInt);
CheckIntRes('signed Reg ', ExpIntVal); CheckIntRes('signed Reg ', ExpIntVal);
for a := ReadSize+1 to 8 do begin for a := ReadSize+1 to 8 do begin
// expanded // expanded
FMemReader.RegisterSizes[2] := ReadSize; FMemReader.RegisterSizes[2] := ReadSize;
GotRes := FMemManager.ReadSignedInt(RegisterLoc(2), SizeVal(a), GotInt); GotRes := FDummyContext.ReadSignedInt(RegisterLoc(2), SizeVal(a), GotInt);
CheckIntRes('signed Reg readsize='+IntToStr(a), ExpIntVal); CheckIntRes('signed Reg readsize='+IntToStr(a), ExpIntVal);
FMemReader.RegisterSizes[2] := a; FMemReader.RegisterSizes[2] := a;
GotRes := FMemManager.ReadSignedInt(RegisterLoc(2), SizeVal(ReadSize), GotInt); GotRes := FDummyContext.ReadSignedInt(RegisterLoc(2), SizeVal(ReadSize), GotInt);
CheckIntRes('signed Reg regsize'+IntToStr(a), ExpIntVal); CheckIntRes('signed Reg regsize'+IntToStr(a), ExpIntVal);
end; end;
GotRes := FMemManager.ReadSignedInt(ConstLoc(QWord(ExpIntVal)), SizeVal(ReadSize), GotInt); GotRes := FDummyContext.ReadSignedInt(ConstLoc(QWord(ExpIntVal)), SizeVal(ReadSize), GotInt);
CheckIntRes('signed const (pre-expanded)', ExpIntVal); CheckIntRes('signed const (pre-expanded)', ExpIntVal);
end; end;
@ -128,85 +132,85 @@ var
var var
a: Cardinal; a: Cardinal;
begin begin
GotRes := FMemManager.ReadUnsignedInt(TargetLoc(TDbgPtr(@Data)), SizeVal(ReadSize), GotUInt); GotRes := FDummyContext.ReadUnsignedInt(TargetLoc(TDbgPtr(@Data)), SizeVal(ReadSize), GotUInt);
CheckUIntRes('unsigned target', ExpIntVal); CheckUIntRes('unsigned target', ExpIntVal);
GotRes := FMemManager.ReadUnsignedInt(SelfLoc(@Data), SizeVal(ReadSize), GotUInt); GotRes := FDummyContext.ReadUnsignedInt(SelfLoc(@Data), SizeVal(ReadSize), GotUInt);
CheckUIntRes('unsigned self', ExpIntVal); CheckUIntRes('unsigned self', ExpIntVal);
FMemReader.RegisterSizes[2] := ReadSize; FMemReader.RegisterSizes[2] := ReadSize;
GotRes := FMemManager.ReadUnsignedInt(RegisterLoc(2), SizeVal(ReadSize), GotUInt); GotRes := FDummyContext.ReadUnsignedInt(RegisterLoc(2), SizeVal(ReadSize), GotUInt);
CheckUIntRes('unsigned Reg ', ExpIntVal); CheckUIntRes('unsigned Reg ', ExpIntVal);
for a := ReadSize+1 to 8 do begin for a := ReadSize+1 to 8 do begin
// expanded // expanded
FMemReader.RegisterSizes[2] := ReadSize; FMemReader.RegisterSizes[2] := ReadSize;
GotRes := FMemManager.ReadUnsignedInt(RegisterLoc(2), SizeVal(a), GotUInt); GotRes := FDummyContext.ReadUnsignedInt(RegisterLoc(2), SizeVal(a), GotUInt);
CheckUIntRes('unsigned Reg readsize='+IntToStr(a), ExpIntVal); CheckUIntRes('unsigned Reg readsize='+IntToStr(a), ExpIntVal);
FMemReader.RegisterSizes[2] := a; FMemReader.RegisterSizes[2] := a;
GotRes := FMemManager.ReadUnsignedInt(RegisterLoc(2), SizeVal(ReadSize), GotUInt); GotRes := FDummyContext.ReadUnsignedInt(RegisterLoc(2), SizeVal(ReadSize), GotUInt);
CheckUIntRes('unsigned Reg regsize'+IntToStr(a), ExpIntVal); CheckUIntRes('unsigned Reg regsize'+IntToStr(a), ExpIntVal);
end; end;
GotRes := FMemManager.ReadUnsignedInt(ConstLoc(QWord(ExpIntVal)), SizeVal(ReadSize), GotUInt); GotRes := FDummyContext.ReadUnsignedInt(ConstLoc(QWord(ExpIntVal)), SizeVal(ReadSize), GotUInt);
CheckUIntRes('unsigned const (pre-expanded)', ExpIntVal); CheckUIntRes('unsigned const (pre-expanded)', ExpIntVal);
////// //////
// Address // Address
GotRes := FMemManager.ReadAddress(TargetLoc(TDbgPtr(@Data)), SizeVal(ReadSize), GotAddr); GotRes := FDummyContext.ReadAddress(TargetLoc(TDbgPtr(@Data)), SizeVal(ReadSize), GotAddr);
CheckAddrRes('addr target', ExpIntVal); CheckAddrRes('addr target', ExpIntVal);
GotRes := FMemManager.ReadAddress(SelfLoc(@Data), SizeVal(ReadSize), GotAddr); GotRes := FDummyContext.ReadAddress(SelfLoc(@Data), SizeVal(ReadSize), GotAddr);
CheckAddrRes('addr self', ExpIntVal); CheckAddrRes('addr self', ExpIntVal);
FMemReader.RegisterSizes[2] := ReadSize; FMemReader.RegisterSizes[2] := ReadSize;
GotRes := FMemManager.ReadAddress(RegisterLoc(2), SizeVal(ReadSize), GotAddr); GotRes := FDummyContext.ReadAddress(RegisterLoc(2), SizeVal(ReadSize), GotAddr);
CheckAddrRes('addr Reg ', ExpIntVal); CheckAddrRes('addr Reg ', ExpIntVal);
for a := ReadSize+1 to 8 do begin for a := ReadSize+1 to 8 do begin
// expanded // expanded
FMemReader.RegisterSizes[2] := ReadSize; FMemReader.RegisterSizes[2] := ReadSize;
GotRes := FMemManager.ReadAddress(RegisterLoc(2), SizeVal(a), GotAddr); GotRes := FDummyContext.ReadAddress(RegisterLoc(2), SizeVal(a), GotAddr);
CheckAddrRes('addr Reg readsize='+IntToStr(a), ExpIntVal); CheckAddrRes('addr Reg readsize='+IntToStr(a), ExpIntVal);
FMemReader.RegisterSizes[2] := a; FMemReader.RegisterSizes[2] := a;
GotRes := FMemManager.ReadAddress(RegisterLoc(2), SizeVal(ReadSize), GotAddr); GotRes := FDummyContext.ReadAddress(RegisterLoc(2), SizeVal(ReadSize), GotAddr);
CheckAddrRes('addr Reg regsize'+IntToStr(a), ExpIntVal); CheckAddrRes('addr Reg regsize'+IntToStr(a), ExpIntVal);
end; end;
GotRes := FMemManager.ReadAddress(ConstLoc(QWord(ExpIntVal)), SizeVal(ReadSize), GotAddr); GotRes := FDummyContext.ReadAddress(ConstLoc(QWord(ExpIntVal)), SizeVal(ReadSize), GotAddr);
CheckAddrRes('addr const (pre-expanded)', ExpIntVal); CheckAddrRes('addr const (pre-expanded)', ExpIntVal);
////// //////
// Address // Address
GotAddr := FMemManager.ReadAddress(TargetLoc(TDbgPtr(@Data)), SizeVal(ReadSize)); GotAddr := FDummyContext.ReadAddress(TargetLoc(TDbgPtr(@Data)), SizeVal(ReadSize));
GotRes := isValidLoc(GotAddr); GotRes := isValidLoc(GotAddr);
CheckAddrRes('addr target', ExpIntVal); CheckAddrRes('addr target', ExpIntVal);
GotAddr := FMemManager.ReadAddress(SelfLoc(@Data), SizeVal(ReadSize)); GotAddr := FDummyContext.ReadAddress(SelfLoc(@Data), SizeVal(ReadSize));
GotRes := isValidLoc(GotAddr); GotRes := isValidLoc(GotAddr);
CheckAddrRes('addr self', ExpIntVal); CheckAddrRes('addr self', ExpIntVal);
FMemReader.RegisterSizes[2] := ReadSize; FMemReader.RegisterSizes[2] := ReadSize;
GotAddr := FMemManager.ReadAddress(RegisterLoc(2), SizeVal(ReadSize)); GotAddr := FDummyContext.ReadAddress(RegisterLoc(2), SizeVal(ReadSize));
GotRes := isValidLoc(GotAddr); GotRes := isValidLoc(GotAddr);
CheckAddrRes('addr Reg ', ExpIntVal); CheckAddrRes('addr Reg ', ExpIntVal);
for a := ReadSize+1 to 8 do begin for a := ReadSize+1 to 8 do begin
// expanded // expanded
FMemReader.RegisterSizes[2] := ReadSize; FMemReader.RegisterSizes[2] := ReadSize;
GotAddr := FMemManager.ReadAddress(RegisterLoc(2), SizeVal(a)); GotAddr := FDummyContext.ReadAddress(RegisterLoc(2), SizeVal(a));
GotRes := isValidLoc(GotAddr); GotRes := isValidLoc(GotAddr);
CheckAddrRes('addr Reg readsize='+IntToStr(a), ExpIntVal); CheckAddrRes('addr Reg readsize='+IntToStr(a), ExpIntVal);
FMemReader.RegisterSizes[2] := a; FMemReader.RegisterSizes[2] := a;
GotAddr := FMemManager.ReadAddress(RegisterLoc(2), SizeVal(ReadSize)); GotAddr := FDummyContext.ReadAddress(RegisterLoc(2), SizeVal(ReadSize));
GotRes := isValidLoc(GotAddr); GotRes := isValidLoc(GotAddr);
CheckAddrRes('addr Reg regsize'+IntToStr(a), ExpIntVal); CheckAddrRes('addr Reg regsize'+IntToStr(a), ExpIntVal);
end; end;
GotAddr := FMemManager.ReadAddress(ConstLoc(QWord(ExpIntVal)), SizeVal(ReadSize)); GotAddr := FDummyContext.ReadAddress(ConstLoc(QWord(ExpIntVal)), SizeVal(ReadSize));
GotRes := isValidLoc(GotAddr); GotRes := isValidLoc(GotAddr);
CheckAddrRes('addr const (pre-expanded)', ExpIntVal); CheckAddrRes('addr const (pre-expanded)', ExpIntVal);
@ -246,21 +250,21 @@ begin
FCurrentTestName := 'Extended'; FCurrentTestName := 'Extended';
DataExt := 1.7722; DataExt := 1.7722;
GotRes := FMemManager.ReadFloat(TargetLoc(TDbgPtr(@DataExt)), SizeVal(SizeOf(Extended)), GotExt); GotRes := FDummyContext.ReadFloat(TargetLoc(TDbgPtr(@DataExt)), SizeVal(SizeOf(Extended)), GotExt);
AssertTrue(FCurrentTestName + 'Read OK', GotRes); AssertTrue(FCurrentTestName + 'Read OK', GotRes);
AssertEquals(FCurrentTestName + 'target not changed', 1.7722, DataExt); AssertEquals(FCurrentTestName + 'target not changed', 1.7722, DataExt);
AssertEquals(FCurrentTestName + 'Val', DataExt, GotExt); AssertEquals(FCurrentTestName + 'Val', DataExt, GotExt);
FCurrentTestName := 'Double'; FCurrentTestName := 'Double';
DataDouble := 1.7722; DataDouble := 1.7722;
GotRes := FMemManager.ReadFloat(TargetLoc(TDbgPtr(@DataDouble)), SizeVal(SizeOf(Double)), GotExt); GotRes := FDummyContext.ReadFloat(TargetLoc(TDbgPtr(@DataDouble)), SizeVal(SizeOf(Double)), GotExt);
AssertTrue(FCurrentTestName + 'Read OK', GotRes); AssertTrue(FCurrentTestName + 'Read OK', GotRes);
AssertEquals(FCurrentTestName + 'target not changed', 1.7722, DataDouble); AssertEquals(FCurrentTestName + 'target not changed', 1.7722, DataDouble);
AssertEquals(FCurrentTestName + 'Val', DataDouble, GotExt); AssertEquals(FCurrentTestName + 'Val', DataDouble, GotExt);
FCurrentTestName := 'Single'; FCurrentTestName := 'Single';
DataSingle := 1.7722; DataSingle := 1.7722;
GotRes := FMemManager.ReadFloat(TargetLoc(TDbgPtr(@DataSingle)), SizeVal(SizeOf(Single)), GotExt); GotRes := FDummyContext.ReadFloat(TargetLoc(TDbgPtr(@DataSingle)), SizeVal(SizeOf(Single)), GotExt);
AssertTrue(FCurrentTestName + 'Read OK', GotRes); AssertTrue(FCurrentTestName + 'Read OK', GotRes);
AssertEquals(FCurrentTestName + 'target not changed', 1.7722, DataSingle); AssertEquals(FCurrentTestName + 'target not changed', 1.7722, DataSingle);
AssertEquals(FCurrentTestName + 'Val', DataSingle, GotExt); AssertEquals(FCurrentTestName + 'Val', DataSingle, GotExt);

View File

@ -373,13 +373,15 @@ var
sym: TFpValue; sym: TFpValue;
ImgLoader: TTestLoaderSetupBasic; ImgLoader: TTestLoaderSetupBasic;
TmpResVal: TFpValue; TmpResVal: TFpValue;
Ctx: TFpDbgSimpleLocationContext;
begin begin
InitDwarf(TTestLoaderSetupBasic); InitDwarf(TTestLoaderSetupBasic);
ImgLoader := TTestLoaderSetupBasic(FImageLoader); ImgLoader := TTestLoaderSetupBasic(FImageLoader);
//FMemReader.RegisterValues[5] := TDbgPtr(@ImgLoader.TestStackFrame.EndPoint); //FMemReader.RegisterValues[5] := TDbgPtr(@ImgLoader.TestStackFrame.EndPoint);
Ctx := TFpDbgSimpleLocationContext.Create(FMemManager, TTestSetupBasicProcMainAddr, 4, 0, 0);
FCurrentContext := FDwarfInfo.FindSymbolScope(0, 0, TTestSetupBasicProcMainAddr); FCurrentContext := FDwarfInfo.FindSymbolScope(Ctx, TTestSetupBasicProcMainAddr);
Ctx.ReleaseReference;
AssertTrue('got ctx', FCurrentContext <> nil); AssertTrue('got ctx', FCurrentContext <> nil);
sym := FCurrentContext.FindSymbol('VarEnum0'); sym := FCurrentContext.FindSymbol('VarEnum0');
@ -423,13 +425,16 @@ var
TmpResVal: TFpValue; TmpResVal: TFpValue;
i: Integer; i: Integer;
s: String; s: String;
Ctx: TFpDbgSimpleLocationContext;
begin begin
InitDwarf(TTestLoaderSetupBasic); InitDwarf(TTestLoaderSetupBasic);
ImgLoader := TTestLoaderSetupBasic(FImageLoader); ImgLoader := TTestLoaderSetupBasic(FImageLoader);
//FMemReader.RegisterValues[5] := TDbgPtr(@ImgLoader.TestStackFrame.EndPoint); //FMemReader.RegisterValues[5] := TDbgPtr(@ImgLoader.TestStackFrame.EndPoint);
FCurrentContext := FDwarfInfo.FindSymbolScope(0, 0, TTestSetupBasicProcMainAddr); Ctx := TFpDbgSimpleLocationContext.Create(FMemManager, TTestSetupBasicProcMainAddr, 4, 0, 0);
FCurrentContext := FDwarfInfo.FindSymbolScope(Ctx, TTestSetupBasicProcMainAddr);
Ctx.ReleaseReference;
AssertTrue('got ctx', FCurrentContext <> nil); AssertTrue('got ctx', FCurrentContext <> nil);
sym := FCurrentContext.FindSymbol('VarEnum0'); sym := FCurrentContext.FindSymbol('VarEnum0');
@ -488,12 +493,15 @@ var
TmpResVal: TFpValue; TmpResVal: TFpValue;
i: Integer; i: Integer;
s: String; s: String;
Ctx: TFpDbgSimpleLocationContext;
begin begin
InitDwarf(TTestLoaderSetupArray); InitDwarf(TTestLoaderSetupArray);
ImgLoader := TTestLoaderSetupArray(FImageLoader); ImgLoader := TTestLoaderSetupArray(FImageLoader);
//FMemReader.RegisterValues[5] := TDbgPtr(@ImgLoader.TestStackFrame.EndPoint); //FMemReader.RegisterValues[5] := TDbgPtr(@ImgLoader.TestStackFrame.EndPoint);
FCurrentContext := FDwarfInfo.FindSymbolScope(0, 0, TTestSetupArrayProcMainAddr); Ctx := TFpDbgSimpleLocationContext.Create(FMemManager, TTestSetupBasicProcMainAddr, 4, 0, 0);
FCurrentContext := FDwarfInfo.FindSymbolScope(Ctx, TTestSetupArrayProcMainAddr);
Ctx.ReleaseReference;
AssertTrue('got ctx', FCurrentContext <> nil); AssertTrue('got ctx', FCurrentContext <> nil);
sym := FCurrentContext.FindSymbol('VarDynIntArray'); sym := FCurrentContext.FindSymbol('VarDynIntArray');
@ -588,6 +596,7 @@ var
AddrExp: TDbgPtr; AddrExp: TDbgPtr;
s, s2: String; s, s2: String;
ImgLoader: TTestLoaderSetup1; ImgLoader: TTestLoaderSetup1;
Ctx: TFpDbgSimpleLocationContext;
begin begin
InitDwarf(TTestLoaderSetup1); InitDwarf(TTestLoaderSetup1);
ImgLoader := TTestLoaderSetup1(FImageLoader); ImgLoader := TTestLoaderSetup1(FImageLoader);
@ -598,7 +607,9 @@ begin
ImgLoader.TestStackFrame.Int1 := -299; ImgLoader.TestStackFrame.Int1 := -299;
ImgLoader.TestStackFrame.Obj1 := obj1; ImgLoader.TestStackFrame.Obj1 := obj1;
try try
FCurrentContext := FDwarfInfo.FindSymbolScope(0, 0, TTestSetup1ProcBarAddr); Ctx := TFpDbgSimpleLocationContext.Create(FMemManager, TTestSetupBasicProcMainAddr, 4, 0, 0);
FCurrentContext := FDwarfInfo.FindSymbolScope(Ctx, TTestSetup1ProcBarAddr);
Ctx.ReleaseReference;
AssertTrue('got ctx', FCurrentContext <> nil); AssertTrue('got ctx', FCurrentContext <> nil);
sym := FCurrentContext.FindSymbol('Int1'); sym := FCurrentContext.FindSymbol('Int1');
@ -1244,13 +1255,16 @@ var
sym: TFpValue; sym: TFpValue;
ImgLoader: TTestLoaderSetupBasic; ImgLoader: TTestLoaderSetupBasic;
TmpResVal: TFpValue; TmpResVal: TFpValue;
Ctx: TFpDbgSimpleLocationContext;
begin begin
InitDwarf(TTestLoaderSetupBasic); InitDwarf(TTestLoaderSetupBasic);
ImgLoader := TTestLoaderSetupBasic(FImageLoader); ImgLoader := TTestLoaderSetupBasic(FImageLoader);
//FMemReader.RegisterValues[5] := TDbgPtr(@ImgLoader.TestStackFrame.EndPoint); //FMemReader.RegisterValues[5] := TDbgPtr(@ImgLoader.TestStackFrame.EndPoint);
FCurrentContext := FDwarfInfo.FindSymbolScope(0, 0, TTestSetupBasicProcMainAddr); Ctx := TFpDbgSimpleLocationContext.Create(FMemManager, TTestSetupBasicProcMainAddr, 4, 0, 0);
FCurrentContext := FDwarfInfo.FindSymbolScope(Ctx, TTestSetupBasicProcMainAddr);
Ctx.ReleaseReference;
AssertTrue('got ctx', FCurrentContext <> nil); AssertTrue('got ctx', FCurrentContext <> nil);
sym := FCurrentContext.FindSymbol('VarEnum0'); sym := FCurrentContext.FindSymbol('VarEnum0');