mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 14:29:29 +02:00
FPDebug: moved TDbgPtr to new unit (avoid circle units)
git-svn-id: trunk@44024 -
This commit is contained in:
parent
ddbe559512
commit
4af520994a
@ -36,7 +36,7 @@ unit FPDCommand;
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, Windows, LCLProc, FpDbgWinExtra, FpDbgInfo, FpDbgClasses;
|
||||
SysUtils, Classes, Windows, LCLProc, FpDbgWinExtra, FpDbgInfo, FpDbgClasses, FpdMemoryTools;
|
||||
|
||||
procedure HandleCommand(ACommand: String);
|
||||
|
||||
|
@ -38,7 +38,7 @@ interface
|
||||
|
||||
uses
|
||||
Windows, Classes, SysUtils, FileUtil, FpDbgInfo, FpDbgClasses, FpDbgWinExtra, FpDbgDisasX86,
|
||||
FpDbgWinClasses;
|
||||
FpDbgWinClasses, FpdMemoryTools;
|
||||
|
||||
procedure DebugLoop;
|
||||
|
||||
|
@ -37,7 +37,7 @@ unit FPDPEImage;
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, SysUtils, FPDGLobal, FpDbgInfo, FpDbgClasses, FpDbgPETypes;
|
||||
Windows, SysUtils, FPDGLobal, FpDbgInfo, FpDbgClasses, FpDbgPETypes, FpdMemoryTools;
|
||||
|
||||
procedure DumpPEImage(const AProcessHandle: THandle; const AAddress: TDbgPtr);
|
||||
|
||||
|
@ -37,7 +37,8 @@ unit FpDbgClasses;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Maps, FpDbgDwarf, FpDbgUtil, FpDbgWinExtra, FpDbgLoader, FpDbgInfo, LazLoggerBase, LazClasses;
|
||||
Classes, SysUtils, Maps, FpDbgDwarf, FpDbgUtil, FpDbgWinExtra, FpDbgLoader,
|
||||
FpDbgInfo, FpdMemoryTools, LazLoggerBase, LazClasses;
|
||||
|
||||
type
|
||||
TDbgProcess = class;
|
||||
|
@ -43,7 +43,7 @@ uses
|
||||
{$ifdef windows}
|
||||
Windows,
|
||||
{$endif}
|
||||
FpDbgUtil, FpDbgInfo;
|
||||
FpDbgUtil, FpDbgInfo, FpdMemoryTools;
|
||||
|
||||
{
|
||||
The function Disassemble decodes the instruction at the given address.
|
||||
|
@ -42,7 +42,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, Types, SysUtils, FpDbgUtil, FpDbgInfo, FpDbgDwarfConst, Maps, Math,
|
||||
FpDbgLoader, FpImgReaderBase, LazLoggerBase, // LazLoggerDummy,
|
||||
FpDbgLoader, FpImgReaderBase, FpdMemoryTools, LazLoggerBase, // LazLoggerDummy,
|
||||
LazClasses, LazFileUtils, LazUTF8, contnrs;
|
||||
|
||||
type
|
||||
|
@ -5,11 +5,9 @@ unit FpDbgInfo;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FpDbgLoader, LazLoggerBase, LazClasses;
|
||||
Classes, SysUtils, FpDbgLoader, FpdMemoryTools, LazLoggerBase, LazClasses;
|
||||
|
||||
type
|
||||
TDbgPtr = QWord; // PtrUInt;
|
||||
|
||||
{ TFpDbgCircularRefCountedObject }
|
||||
|
||||
TFpDbgCircularRefCountedObject = class(TRefCountedObject)
|
||||
@ -41,14 +39,6 @@ type
|
||||
procedure Notify(Ptr: Pointer; Action: TListNotification); override;
|
||||
end;
|
||||
|
||||
|
||||
TFpDbgMemReaderBase = class
|
||||
public
|
||||
function ReadMemory(AnAddress: TDbgPtr; ASize: Cardinal; ADest: Pointer): Boolean; virtual; abstract;
|
||||
function ReadMemoryEx(AnAddress, AnAddressSpace: TDbgPtr; ASize: Cardinal; ADest: Pointer): Boolean; virtual; abstract;
|
||||
function ReadRegister(ARegNum: Integer; out AValue: TDbgPtr): Boolean; virtual; abstract;
|
||||
end;
|
||||
|
||||
TDbgSymbolType = (
|
||||
stNone,
|
||||
stValue, // The symbol has a value (var, field, function, procedure (value is address of func/proc, so it can be called)
|
||||
|
@ -45,7 +45,7 @@ uses
|
||||
FpDbgClasses,
|
||||
FpDbgWinExtra,
|
||||
FpDbgInfo,
|
||||
FpDbgLoader,
|
||||
FpDbgLoader, FpdMemoryTools,
|
||||
LazLoggerBase;
|
||||
|
||||
type
|
||||
|
@ -34,7 +34,7 @@ File(s) with other licenses (see also header in file(s):
|
||||
|
||||
(Any modifications/translations of this file are from duby)
|
||||
"/>
|
||||
<Files Count="20">
|
||||
<Files Count="21">
|
||||
<Item1>
|
||||
<Filename Value="fpdbgclasses.pp"/>
|
||||
<UnitName Value="FpDbgClasses"/>
|
||||
@ -116,6 +116,10 @@ File(s) with other licenses (see also header in file(s):
|
||||
<AddToUsesPkgSection Value="False"/>
|
||||
<UnitName Value="FpDbgWinClasses"/>
|
||||
</Item20>
|
||||
<Item21>
|
||||
<Filename Value="fpdmemorytools.pas"/>
|
||||
<UnitName Value="fpdmemorytools"/>
|
||||
</Item21>
|
||||
</Files>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
<RequiredPkgs Count="2">
|
||||
|
@ -7,11 +7,10 @@ unit fpdebug;
|
||||
interface
|
||||
|
||||
uses
|
||||
FpDbgClasses, FpDbgDisasX86, FpDbgDwarf, FpDbgDwarfConst, FpDbgLoader,
|
||||
FpDbgPETypes, FpDbgSymbols, FpDbgUtil, FpDbgWinExtra, FpImgReaderWinPE,
|
||||
FpImgReaderElf, FpImgReaderElfTypes, FpImgReaderBase, FpPascalParser, macho,
|
||||
FpImgReaderMachoFile, FpImgReaderMacho, FpPascalBuilder, FpDbgInfo,
|
||||
LazarusPackageIntf;
|
||||
FpDbgClasses, FpDbgDisasX86, FpDbgDwarf, FpDbgDwarfConst, FpDbgLoader, FpDbgPETypes,
|
||||
FpDbgSymbols, FpDbgUtil, FpDbgWinExtra, FpImgReaderWinPE, FpImgReaderElf,
|
||||
FpImgReaderElfTypes, FpImgReaderBase, FpPascalParser, macho, FpImgReaderMachoFile,
|
||||
FpImgReaderMacho, FpPascalBuilder, FpDbgInfo, FpdMemoryTools, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -29,7 +29,7 @@ unit FpPascalParser;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, sysutils, math, FpDbgInfo, LazLoggerBase, LazClasses;
|
||||
Classes, sysutils, math, FpDbgInfo, FpdMemoryTools, LazLoggerBase, LazClasses;
|
||||
|
||||
type
|
||||
|
||||
|
@ -4,7 +4,7 @@ program FpTest;
|
||||
|
||||
uses
|
||||
Interfaces, Forms, GuiTestRunner, TestPascalParser, TestTypeInfo, TestHelperClasses,
|
||||
TestDwarfSetup1;
|
||||
TestDwarfSetup1, TestDwarfSetupBasic, TestDwarfVarious, testdwarfsetupArray;
|
||||
|
||||
{$R *.res}
|
||||
|
||||
|
@ -5,7 +5,7 @@ unit TestHelperClasses;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FpImgReaderBase, FpDbgDwarfConst, FpDbgLoader, FpDbgInfo;
|
||||
Classes, SysUtils, FpImgReaderBase, FpDbgDwarfConst, FpDbgLoader, FpDbgInfo, FpdMemoryTools;
|
||||
|
||||
const
|
||||
TestAddrSize = sizeof(Pointer);
|
||||
@ -17,9 +17,9 @@ type
|
||||
TTestMemReader = class(TFpDbgMemReaderBase)
|
||||
public
|
||||
RegisterValues: array[0..30] of TDbgPtr;
|
||||
function ReadMemory(AnAddress: FpDbgInfo.TDbgPtr; ASize: Cardinal; ADest: Pointer): Boolean; override;
|
||||
function ReadMemoryEx({%H-}AnAddress, {%H-}AnAddressSpace: FpDbgInfo.TDbgPtr; {%H-}ASize: Cardinal; {%H-}ADest: Pointer): Boolean; override;
|
||||
function ReadRegister(ARegNum: Integer; out AValue: FpDbgInfo.TDbgPtr): Boolean; override;
|
||||
function ReadMemory(AnAddress: TDbgPtr; ASize: Cardinal; ADest: Pointer): Boolean; override;
|
||||
function ReadMemoryEx({%H-}AnAddress, {%H-}AnAddressSpace: TDbgPtr; {%H-}ASize: Cardinal; {%H-}ADest: Pointer): Boolean; override;
|
||||
function ReadRegister(ARegNum: Integer; out AValue: TDbgPtr): Boolean; override;
|
||||
end;
|
||||
|
||||
TTestDwarfAbbrev = class;
|
||||
@ -387,20 +387,20 @@ end;
|
||||
|
||||
{ TTestMemReader }
|
||||
|
||||
function TTestMemReader.ReadMemory(AnAddress: FpDbgInfo.TDbgPtr; ASize: Cardinal;
|
||||
function TTestMemReader.ReadMemory(AnAddress: TDbgPtr; ASize: Cardinal;
|
||||
ADest: Pointer): Boolean;
|
||||
begin
|
||||
Result := True;
|
||||
Move(Pointer(AnAddress)^, ADest^, ASize);
|
||||
end;
|
||||
|
||||
function TTestMemReader.ReadMemoryEx(AnAddress, AnAddressSpace: FpDbgInfo.TDbgPtr;
|
||||
function TTestMemReader.ReadMemoryEx(AnAddress, AnAddressSpace: TDbgPtr;
|
||||
ASize: Cardinal; ADest: Pointer): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TTestMemReader.ReadRegister(ARegNum: Integer; out AValue: FpDbgInfo.TDbgPtr): Boolean;
|
||||
function TTestMemReader.ReadRegister(ARegNum: Integer; out AValue: TDbgPtr): Boolean;
|
||||
begin
|
||||
Result := True;
|
||||
AValue := RegisterValues[ARegNum];
|
||||
|
@ -5,8 +5,9 @@ unit TestTypeInfo;
|
||||
interface
|
||||
|
||||
uses
|
||||
FpPascalParser, FpDbgDwarf, FpDbgInfo, LazLoggerBase, LazUTF8, sysutils, fpcunit,
|
||||
testregistry, TestHelperClasses, TestDwarfSetup1, TestDwarfSetupBasic, TestDwarfSetupArray;
|
||||
FpPascalParser, FpDbgDwarf, FpDbgInfo, FpdMemoryTools, LazLoggerBase, LazUTF8, sysutils,
|
||||
fpcunit, testregistry, TestHelperClasses, TestDwarfSetup1, TestDwarfSetupBasic,
|
||||
TestDwarfSetupArray;
|
||||
|
||||
|
||||
type
|
||||
@ -467,10 +468,44 @@ begin
|
||||
StartInvalTest('VarDynIntArray[0]', 'xxx');
|
||||
|
||||
SetLength(ImgLoader.GlobalVar.VarDynIntArray,33);
|
||||
ImgLoader.GlobalVar.VarDynIntArray[0] := 10;
|
||||
ImgLoader.GlobalVar.VarDynIntArray[1] := 11;
|
||||
ImgLoader.GlobalVar.VarDynIntArray[2] := 12;
|
||||
ImgLoader.GlobalVar.VarDynIntArray[31] := 410;
|
||||
ImgLoader.GlobalVar.VarDynIntArray[32] := 420;
|
||||
|
||||
StartTest('VarDynIntArray[0]', skInteger, [ttHasType]);
|
||||
ExpFlags([svfInteger, svfOrdinal, svfAddress, svfSize], [svfSizeOfPointer, svfDataAddress, svfDataSize]);
|
||||
ExpResult(svfInteger, 10);
|
||||
ExpResult(svfOrdinal, QWord(10));
|
||||
ExpResult(svfAddress, TDbgPtr(PtrUInt(@ImgLoader.GlobalVar.VarDynIntArray[0])));
|
||||
ExpResult(svfSize, SizeOf(ImgLoader.GlobalVar.VarDynIntArray[0]));
|
||||
|
||||
StartTest('VarDynIntArray[1]', skInteger, [ttHasType]);
|
||||
ExpResult(svfInteger, 11);
|
||||
ExpResult(svfOrdinal, QWord(11));
|
||||
ExpResult(svfAddress, TDbgPtr(PtrUInt(@ImgLoader.GlobalVar.VarDynIntArray[1])));
|
||||
|
||||
StartTest('VarDynIntArray[32]', skInteger, [ttHasType]);
|
||||
ExpResult(svfInteger, 420);
|
||||
ExpResult(svfOrdinal, QWord(420));
|
||||
ExpResult(svfAddress, TDbgPtr(PtrUInt(@ImgLoader.GlobalVar.VarDynIntArray[32])));
|
||||
|
||||
|
||||
ImgLoader.GlobalVar.VarStatIntArray1[0] := 110;
|
||||
ImgLoader.GlobalVar.VarStatIntArray1[1] := 111;
|
||||
|
||||
StartTest('VarStatIntArray1[0]', skInteger, [ttHasType]);
|
||||
ExpFlags([svfInteger, svfOrdinal, svfAddress, svfSize], [svfSizeOfPointer, svfDataAddress, svfDataSize]);
|
||||
ExpResult(svfInteger, 110);
|
||||
ExpResult(svfOrdinal, QWord(110));
|
||||
ExpResult(svfAddress, TDbgPtr(PtrUInt(@ImgLoader.GlobalVar.VarStatIntArray1[0])));
|
||||
ExpResult(svfSize, SizeOf(ImgLoader.GlobalVar.VarStatIntArray1[0]));
|
||||
|
||||
StartTest('VarStatIntArray1[1]', skInteger, [ttHasType]);
|
||||
ExpResult(svfInteger, 111);
|
||||
ExpResult(svfAddress, TDbgPtr(PtrUInt(@ImgLoader.GlobalVar.VarStatIntArray1[1])));
|
||||
|
||||
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user