Debugger: put some common types into DbgIntf

git-svn-id: trunk@44079 -
This commit is contained in:
martin 2014-02-15 01:31:30 +00:00
parent 4ec00361b1
commit 3f415797e4
30 changed files with 111 additions and 224 deletions

View File

@ -12,8 +12,54 @@ uses
Classes, SysUtils; Classes, SysUtils;
type type
// datatype pointing to data on the target (* TDBGPtr
TDBGPtr = QWord; datatype pointing to data on the target
*)
TDBGPtr = type QWord;
(* TDbgSymbolKind
Enum of types that a value can have.
*)
TDbgSymbolKind = (
skNone, // undefined type
//skType // Not a value, but a type description
//skUser, // userdefined type, this sym refers to another sym defined elswhere
//--------------------------------------------------------------------------
skInstance, // the main exe/dll, containing all other syms
skUnit, // contains syms defined in this unit
skProcedure, // an actual procedure, with an address // NOT just the type of a procedure
skFunction,
//--------------------------------------------------------------------------
//----------------- Basic types, these cannot have references or children
skSimple, // Any of the below (in this group), the dbg does not know more detailed
skPointer,
skInteger,
skCardinal,
skBoolean,
skChar,
skFloat,
skString,
skAnsiString,
skCurrency,
skVariant,
skWideString,
//--------------------------------------------------------------------------
skEnum, // Variable holding an enum / enum type
skEnumValue, // a single element from an enum
skSet,
//--------------------------------------------------------------------------
skRecord, // the address member is the relative location within the
skObject, // structure: type TFoo=object end; // may also be reported as record
skClass,
skInterface,
//--------------------------------------------------------------------------
skArray,
//--------------------------------------------------------------------------
skRegister // the Address member is the register number
//--------------------------------------------------------------------------
);
implementation implementation

View File

@ -36,7 +36,7 @@ Provides an interface to add debuggers to the IDE"/>
<UnitName Value="DbgIntfMiscClasses"/> <UnitName Value="DbgIntfMiscClasses"/>
</Item3> </Item3>
</Files> </Files>
<Type Value="DesignTime"/> <Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="2"> <RequiredPkgs Count="2">
<Item1> <Item1>
<PackageName Value="LazUtils"/> <PackageName Value="LazUtils"/>

View File

@ -36,7 +36,7 @@ unit FPDCommand;
interface interface
uses uses
SysUtils, Classes, Windows, LCLProc, FpDbgWinExtra, FpDbgInfo, FpDbgClasses, FpdMemoryTools; SysUtils, Classes, Windows, LCLProc, FpDbgWinExtra, FpDbgInfo, FpDbgClasses, DbgIntfBaseTypes;
procedure HandleCommand(ACommand: String); procedure HandleCommand(ACommand: String);

View File

@ -38,7 +38,7 @@ interface
uses uses
Windows, Classes, SysUtils, FileUtil, FpDbgInfo, FpDbgClasses, FpDbgWinExtra, FpDbgDisasX86, Windows, Classes, SysUtils, FileUtil, FpDbgInfo, FpDbgClasses, FpDbgWinExtra, FpDbgDisasX86,
FpDbgWinClasses, FpdMemoryTools; FpDbgWinClasses, DbgIntfBaseTypes, FpdMemoryTools;
procedure DebugLoop; procedure DebugLoop;

View File

@ -37,7 +37,7 @@ unit FPDPEImage;
interface interface
uses uses
Windows, SysUtils, FPDGLobal, FpDbgInfo, FpDbgClasses, FpDbgPETypes, FpdMemoryTools; Windows, SysUtils, FPDGLobal, FpDbgInfo, FpDbgClasses, FpDbgPETypes, DbgIntfBaseTypes;
procedure DumpPEImage(const AProcessHandle: THandle; const AAddress: TDbgPtr); procedure DumpPEImage(const AProcessHandle: THandle; const AAddress: TDbgPtr);

View File

@ -38,7 +38,7 @@ interface
uses uses
Classes, SysUtils, Maps, FpDbgDwarf, FpDbgUtil, FpDbgWinExtra, FpDbgLoader, Classes, SysUtils, Maps, FpDbgDwarf, FpDbgUtil, FpDbgWinExtra, FpDbgLoader,
FpDbgInfo, FpdMemoryTools, LazLoggerBase, LazClasses; FpDbgInfo, FpdMemoryTools, LazLoggerBase, LazClasses, DbgIntfBaseTypes;
type type
TDbgProcess = class; TDbgProcess = class;

View File

@ -43,7 +43,7 @@ uses
{$ifdef windows} {$ifdef windows}
Windows, Windows,
{$endif} {$endif}
FpDbgUtil, FpDbgInfo, FpdMemoryTools; FpDbgUtil, FpDbgInfo, DbgIntfBaseTypes, FpdMemoryTools;
{ {
The function Disassemble decodes the instruction at the given address. The function Disassemble decodes the instruction at the given address.

View File

@ -43,7 +43,7 @@ interface
uses uses
Classes, Types, SysUtils, FpDbgUtil, FpDbgInfo, FpDbgDwarfConst, Maps, Math, Classes, Types, SysUtils, FpDbgUtil, FpDbgInfo, FpDbgDwarfConst, Maps, Math,
FpDbgLoader, FpImgReaderBase, FpdMemoryTools, LazLoggerBase, // LazLoggerDummy, FpDbgLoader, FpImgReaderBase, FpdMemoryTools, LazLoggerBase, // LazLoggerDummy,
LazClasses, LazFileUtils, LazUTF8, contnrs; LazClasses, LazFileUtils, LazUTF8, contnrs, DbgIntfBaseTypes;
type type
// compilation unit header // compilation unit header

View File

@ -5,7 +5,7 @@ unit FpDbgInfo;
interface interface
uses uses
Classes, SysUtils, FpDbgLoader, FpdMemoryTools, LazLoggerBase, LazClasses; Classes, SysUtils, DbgIntfBaseTypes, FpDbgLoader, FpdMemoryTools, LazLoggerBase, LazClasses;
type type
{ TFpDbgCircularRefCountedObject } { TFpDbgCircularRefCountedObject }
@ -45,40 +45,6 @@ type
stType // The Symbol is a type (including proc/func declaration / without DW_AT_low_pc) stType // The Symbol is a type (including proc/func declaration / without DW_AT_low_pc)
); );
TDbgSymbolKind = (
skNone, // undefined type
// skUser, // userdefined type, this sym refers to another sym defined elswhere
skInstance, // the main exe/dll, containing all other syms
skUnit, // contains syms defined in this unit
//--------------------------------------------------------------------------
skRecord, // the address member is the relative location within the
skObject, // structure: type TFoo=object end;
skClass,
skInterface,
skProcedure,
skFunction,
//--------------------------------------------------------------------------
skArray,
//--------------------------------------------------------------------------
skPointer,
skInteger, // Basic types, these cannot have references or children
skCardinal, // only size matters ( char(1) = Char, char(2) = WideChar
skBoolean, // cardinal(1) = Byte etc.
skChar,
skFloat,
skString,
skAnsiString,
skCurrency,
skVariant,
skWideString,
skEnum, // Variable holding an enum / enum type
skEnumValue, // a single element from an enum
skSet,
//--------------------------------------------------------------------------
skRegister // the Address member is the register number
//--------------------------------------------------------------------------
);
TDbgSymbolMemberVisibility =( TDbgSymbolMemberVisibility =(
svPrivate, svPrivate,
svProtected, svProtected,

View File

@ -46,6 +46,7 @@ uses
FpDbgWinExtra, FpDbgWinExtra,
FpDbgInfo, FpDbgInfo,
FpDbgLoader, FpdMemoryTools, FpDbgLoader, FpdMemoryTools,
DbgIntfBaseTypes,
LazLoggerBase; LazLoggerBase;
type type

View File

@ -118,17 +118,20 @@ File(s) with other licenses (see also header in file(s):
</Item20> </Item20>
<Item21> <Item21>
<Filename Value="fpdmemorytools.pas"/> <Filename Value="fpdmemorytools.pas"/>
<UnitName Value="fpdmemorytools"/> <UnitName Value="FpdMemoryTools"/>
</Item21> </Item21>
</Files> </Files>
<Type Value="RunAndDesignTime"/> <Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="2"> <RequiredPkgs Count="3">
<Item1> <Item1>
<PackageName Value="LCLBase"/> <PackageName Value="DebuggerIntf"/>
</Item1> </Item1>
<Item2> <Item2>
<PackageName Value="FCL"/> <PackageName Value="LCLBase"/>
</Item2> </Item2>
<Item3>
<PackageName Value="FCL"/>
</Item3>
</RequiredPkgs> </RequiredPkgs>
<UsageOptions> <UsageOptions>
<UnitPath Value="$(PkgOutDir)"/> <UnitPath Value="$(PkgOutDir)"/>

View File

@ -24,10 +24,9 @@ unit FpdMemoryTools;
interface interface
uses uses
Classes, SysUtils, math; Classes, SysUtils, math, DbgIntfBaseTypes;
type type
TDbgPtr = QWord; // TODO, use from IdeDebuggerInterface, once that is done.
TFpDbgMemReaderBase = class TFpDbgMemReaderBase = class
public public

View File

@ -5,7 +5,7 @@ unit FpPascalBuilder;
interface interface
uses uses
Classes, SysUtils, FpDbgInfo; Classes, SysUtils, DbgIntfBaseTypes, FpDbgInfo;
type type
TTypeNameFlag = ( TTypeNameFlag = (

View File

@ -29,7 +29,7 @@ unit FpPascalParser;
interface interface
uses uses
Classes, sysutils, math, FpDbgInfo, FpdMemoryTools, LazLoggerBase, LazClasses; Classes, sysutils, math, DbgIntfBaseTypes, FpDbgInfo, FpdMemoryTools, LazLoggerBase, LazClasses;
type type

View File

@ -3,7 +3,7 @@ program FpTest;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
uses uses
Interfaces, Forms, GuiTestRunner, TestPascalParser, TestTypeInfo, TestHelperClasses, Interfaces, Forms, GuiTestRunner, TestTypeInfo, TestHelperClasses,
TestDwarfSetup1, TestDwarfSetupBasic, TestDwarfVarious, testdwarfsetupArray, TestMemManager; TestDwarfSetup1, TestDwarfSetupBasic, TestDwarfVarious, testdwarfsetupArray, TestMemManager;
{$R *.res} {$R *.res}

View File

@ -5,7 +5,8 @@ unit TestHelperClasses;
interface interface
uses uses
Classes, SysUtils, FpImgReaderBase, FpDbgDwarfConst, FpDbgLoader, FpDbgInfo, FpdMemoryTools; Classes, SysUtils, FpImgReaderBase, FpDbgDwarfConst, FpDbgLoader, FpDbgInfo,
DbgIntfBaseTypes, FpdMemoryTools;
const const
TestAddrSize = sizeof(Pointer); TestAddrSize = sizeof(Pointer);

View File

@ -5,8 +5,8 @@ unit TestMemManager;
interface interface
uses uses
FpDbgDwarf, FpDbgUtil, FpdMemoryTools, TestHelperClasses, LazLoggerBase, LazUTF8, sysutils, FpDbgDwarf, FpDbgUtil, FpdMemoryTools, TestHelperClasses, LazLoggerBase, LazUTF8,
fpcunit, testregistry; DbgIntfBaseTypes, sysutils, fpcunit, testregistry;
type type

View File

@ -7,7 +7,7 @@ interface
uses uses
FpPascalParser, FpDbgDwarf, FpDbgInfo, FpdMemoryTools, LazLoggerBase, LazUTF8, sysutils, FpPascalParser, FpDbgDwarf, FpDbgInfo, FpdMemoryTools, LazLoggerBase, LazUTF8, sysutils,
fpcunit, testregistry, TestHelperClasses, TestDwarfSetup1, TestDwarfSetupBasic, fpcunit, testregistry, TestHelperClasses, TestDwarfSetup1, TestDwarfSetupBasic,
TestDwarfSetupArray; DbgIntfBaseTypes, TestDwarfSetupArray;
type type

View File

@ -6,7 +6,7 @@ interface
uses uses
Classes, SysUtils, Forms, Controls, Graphics, Classes, SysUtils, Forms, Controls, Graphics,
IDEWindowIntf, IDEWindowIntf, DbgIntfBaseTypes,
ComCtrls, StdCtrls, ExtCtrls, LclType, LCLIntf, DebuggerDlg, Debugger, ComCtrls, StdCtrls, ExtCtrls, LclType, LCLIntf, DebuggerDlg, Debugger,
BaseDebugManager, EditorOptions, Math, types, LCLProc, Menus, Clipbrd, ActnList, BaseDebugManager, EditorOptions, Math, types, LCLProc, Menus, Clipbrd, ActnList,
IDECommands, IDEImagesIntf, CodeToolManager, CodeCache, SourceEditor; IDECommands, IDEImagesIntf, CodeToolManager, CodeCache, SourceEditor;

View File

@ -38,12 +38,10 @@ unit Debugger;
interface interface
uses uses
TypInfo, Classes, SysUtils, Laz2_XMLCfg, math, FileUtil, LazLoggerBase, LazClasses, DbgIntfBaseTypes, DbgIntfMiscClasses, TypInfo, Classes, SysUtils, Laz2_XMLCfg, math, FileUtil, LazLoggerBase, LazClasses,
LCLProc, LazConfigStorage, DebugUtils, maps, contnrs; LCLProc, LazConfigStorage, DebugUtils, maps, contnrs;
type type
// datatype pointing to data on the target
TDBGPtr = DebugUtils.TDBGPtr;
TDBGLocationRec = record TDBGLocationRec = record
Address: TDBGPtr; Address: TDBGPtr;
@ -221,21 +219,6 @@ type
published published
end; end;
{ TRefCountedColectionItem }
TRefCountedColectionItem = class(TDelayedUdateItem)
public
constructor Create(ACollection: TCollection); override;
destructor Destroy; override;
procedure AddReference;
procedure ReleaseReference;
private
FRefCount: Integer;
protected
procedure DoFree; virtual;
property RefCount: Integer read FRefCount;
end;
procedure ReleaseRefAndNil(var ARefCountedObject); procedure ReleaseRefAndNil(var ARefCountedObject);
type type
@ -919,7 +902,6 @@ type
(******************************************************************************) (******************************************************************************)
type type
TDBGSymbolKind = (skClass, skRecord, skEnum, skSet, skProcedure, skFunction, skSimple, skPointer, skVariant);
TDBGSymbolAttribute = (saRefParam, // var, const, constref passed by reference TDBGSymbolAttribute = (saRefParam, // var, const, constref passed by reference
saInternalPointer, // PointerToObject saInternalPointer, // PointerToObject
saArray, saDynArray saArray, saDynArray
@ -6191,38 +6173,6 @@ begin
// //
end; end;
{ =========================================================================== }
{ TRefCountedColectionItem }
constructor TRefCountedColectionItem.Create(ACollection: TCollection);
begin
FRefCount := 0;
inherited Create(ACollection);
end;
destructor TRefCountedColectionItem.Destroy;
begin
Assert(FRefcount = 0, 'Destroying referenced object');
inherited Destroy;
end;
procedure TRefCountedColectionItem.AddReference;
begin
Inc(FRefcount);
end;
procedure TRefCountedColectionItem.ReleaseReference;
begin
Assert(FRefCount > 0, 'TRefCountedObject.ReleaseReference RefCount > 0');
Dec(FRefCount);
if FRefCount = 0 then DoFree;
end;
procedure TRefCountedColectionItem.DoFree;
begin
Self.Free;
end;
(******************************************************************************) (******************************************************************************)
(******************************************************************************) (******************************************************************************)
(** **) (** **)

View File

@ -35,31 +35,10 @@ unit DebugUtils;
interface interface
uses uses
Classes, LCLProc; DbgIntfBaseTypes, Classes, LCLProc;
type type
TDBGPtr = type QWord;
{ TDelayedUdateItem }
TDelayedUdateItem = class(TCollectionItem)
private
FUpdateCount: Integer;
FDoChanged: Boolean;
protected
procedure Changed;
procedure DoChanged; virtual;
procedure DoEndUpdate; virtual; // even if not changed
public
procedure Assign(ASource: TPersistent); override;
procedure BeginUpdate;
constructor Create(ACollection: TCollection); override;
procedure EndUpdate;
function IsUpdating: Boolean;
end;
TPCharWithLen = record TPCharWithLen = record
Ptr: PChar; Ptr: PChar;
Len: Integer; Len: Integer;
@ -523,66 +502,6 @@ begin
end; end;
{ TDelayedUdateItem }
procedure TDelayedUdateItem.Assign(ASource: TPersistent);
begin
BeginUpdate;
try
inherited Assign(ASource);
finally
EndUpdate;
end;
end;
procedure TDelayedUdateItem.BeginUpdate;
begin
Inc(FUpdateCount);
if FUpdateCount = 1 then FDoChanged := False;
end;
procedure TDelayedUdateItem.Changed;
begin
if FUpdateCount > 0
then FDoChanged := True
else DoChanged;
end;
constructor TDelayedUdateItem.Create(ACollection: TCollection);
begin
inherited Create(ACollection);
FUpdateCount := 0;
end;
procedure TDelayedUdateItem.DoChanged;
begin
inherited Changed(False);
end;
procedure TDelayedUdateItem.DoEndUpdate;
begin
//
end;
procedure TDelayedUdateItem.EndUpdate;
begin
Dec(FUpdateCount);
if FUpdateCount < 0 then raise EInvalidOperation.Create('TDelayedUdateItem.EndUpdate');
if (FUpdateCount = 0)
then DoEndUpdate;
if (FUpdateCount = 0) and FDoChanged
then begin
DoChanged;
FDoChanged := False;
end;
end;
function TDelayedUdateItem.IsUpdating: Boolean;
begin
Result := FUpdateCount > 0;
end;
initialization initialization
LastSmartWritelnCount:=0; LastSmartWritelnCount:=0;

View File

@ -9,7 +9,8 @@ unit FpGdbmiDebugger;
interface interface
uses uses
Classes, {$IFdef MSWindows}windows,{$ENDIF} sysutils, math, FpdMemoryTools, FpDbgInfo, FpDbgClasses, GDBMIDebugger, BaseDebugManager, Classes, {$IFdef MSWindows}windows,{$ENDIF} sysutils, math, FpdMemoryTools,
FpDbgInfo, FpDbgClasses, GDBMIDebugger, BaseDebugManager, DbgIntfBaseTypes,
Debugger, GDBMIMiscClasses, GDBTypeInfo, maps, LCLProc, Forms, FpDbgLoader, FpDbgDwarf, Debugger, GDBMIMiscClasses, GDBTypeInfo, maps, LCLProc, Forms, FpDbgLoader, FpDbgDwarf,
FpDbgDwarfConst, LazLoggerBase, LazLoggerProfiling, FpPascalParser, FpPascalBuilder; FpDbgDwarfConst, LazLoggerBase, LazLoggerProfiling, FpPascalParser, FpPascalBuilder;
@ -27,9 +28,9 @@ type
FDebugger: TFpGDBMIDebugger; FDebugger: TFpGDBMIDebugger;
public public
constructor Create(ADebugger: TFpGDBMIDebugger); constructor Create(ADebugger: TFpGDBMIDebugger);
function ReadMemory(AnAddress: FpdMemoryTools.TDbgPtr; ASize: Cardinal; ADest: Pointer): Boolean; override; function ReadMemory(AnAddress: TDbgPtr; ASize: Cardinal; ADest: Pointer): Boolean; override;
function ReadMemoryEx(AnAddress, AnAddressSpace: FpdMemoryTools.TDbgPtr; ASize: Cardinal; ADest: Pointer): Boolean; override; function ReadMemoryEx(AnAddress, AnAddressSpace: TDbgPtr; ASize: Cardinal; ADest: Pointer): Boolean; override;
function ReadRegister(ARegNum: Cardinal; out AValue: FpdMemoryTools.TDbgPtr): Boolean; override; function ReadRegister(ARegNum: Cardinal; out AValue: TDbgPtr): Boolean; override;
function RegisterSize(ARegNum: Cardinal): Integer; override; function RegisterSize(ARegNum: Cardinal): Integer; override;
end; end;
@ -40,7 +41,7 @@ type
hProcess: THandle; hProcess: THandle;
public public
destructor Destroy; override; destructor Destroy; override;
function ReadMemory(AnAddress: FpdMemoryTools.TDbgPtr; ASize: Cardinal; ADest: Pointer): Boolean; override; function ReadMemory(AnAddress: TDbgPtr; ASize: Cardinal; ADest: Pointer): Boolean; override;
//function ReadRegister(ARegNum: Integer; out AValue: TDbgPtr): Boolean; override; //function ReadRegister(ARegNum: Integer; out AValue: TDbgPtr): Boolean; override;
procedure OpenProcess(APid: Cardinal); procedure OpenProcess(APid: Cardinal);
procedure CloseProcess; procedure CloseProcess;
@ -148,7 +149,7 @@ begin
inherited Destroy; inherited Destroy;
end; end;
function TFpGDBMIAndWin32DbgMemReader.ReadMemory(AnAddress: FpdMemoryTools.TDbgPtr; function TFpGDBMIAndWin32DbgMemReader.ReadMemory(AnAddress: TDbgPtr;
ASize: Cardinal; ADest: Pointer): Boolean; ASize: Cardinal; ADest: Pointer): Boolean;
var var
BytesRead: Cardinal; BytesRead: Cardinal;
@ -192,7 +193,7 @@ end;
type TGDBMIDebuggerCommandHack = class(TGDBMIDebuggerCommand) end; type TGDBMIDebuggerCommandHack = class(TGDBMIDebuggerCommand) end;
function TFpGDBMIDbgMemReader.ReadMemory(AnAddress: FpdMemoryTools.TDbgPtr; ASize: Cardinal; function TFpGDBMIDbgMemReader.ReadMemory(AnAddress: TDbgPtr; ASize: Cardinal;
ADest: Pointer): Boolean; ADest: Pointer): Boolean;
var var
cmd: TGDBMIDebuggerCommandHack; cmd: TGDBMIDebuggerCommandHack;
@ -223,14 +224,14 @@ begin
debugln(['TFpGDBMIDbgMemReader.ReadMemory ', dbgs(AnAddress), ' ', dbgMemRange(ADest, ASize)]); debugln(['TFpGDBMIDbgMemReader.ReadMemory ', dbgs(AnAddress), ' ', dbgMemRange(ADest, ASize)]);
end; end;
function TFpGDBMIDbgMemReader.ReadMemoryEx(AnAddress, AnAddressSpace: FpdMemoryTools.TDbgPtr; function TFpGDBMIDbgMemReader.ReadMemoryEx(AnAddress, AnAddressSpace: TDbgPtr;
ASize: Cardinal; ADest: Pointer): Boolean; ASize: Cardinal; ADest: Pointer): Boolean;
begin begin
Result := False; Result := False;
end; end;
function TFpGDBMIDbgMemReader.ReadRegister(ARegNum: Cardinal; out function TFpGDBMIDbgMemReader.ReadRegister(ARegNum: Cardinal; out
AValue: FpdMemoryTools.TDbgPtr): Boolean; AValue: TDbgPtr): Boolean;
var var
rname: String; rname: String;
v: String; v: String;
@ -301,7 +302,7 @@ const
ADeRefTypeName := ''; ADeRefTypeName := '';
ABaseTypeName := ABaseType.Name; ABaseTypeName := ABaseType.Name;
while (ABaseType.Kind = FpDbgInfo.skPointer) and (ABaseType.TypeInfo <> nil) do begin while (ABaseType.Kind = skPointer) and (ABaseType.TypeInfo <> nil) do begin
ABaseType := ABaseType.TypeInfo; ABaseType := ABaseType.TypeInfo;
inc(APointerLevel); inc(APointerLevel);
@ -345,7 +346,7 @@ const
begin begin
//todo: functions / virtual / array ... //todo: functions / virtual / array ...
s2 := ''; s2 := '';
if AMember.Kind = FpDbgInfo.skProcedure then begin if AMember.Kind = skProcedure then begin
if sfVirtual in AMember.Flags then s2 := ' virtual;'; if sfVirtual in AMember.Flags then s2 := ' virtual;';
AText := AText + ' procedure ' + AMember.Name + ' ();' + s2 + LineEnding; AText := AText + ' procedure ' + AMember.Name + ' ();' + s2 + LineEnding;
exit exit
@ -359,9 +360,9 @@ const
s := ti.Name; s := ti.Name;
if s = '' then begin if s = '' then begin
if not( (AMember.Kind = FpDbgInfo.skSet) or (AMember.Kind = FpDbgInfo.skEnum) or if not( (AMember.Kind = skSet) or (AMember.Kind = skEnum) or
(AMember.Kind = FpDbgInfo.skArray) or (AMember.Kind = FpDbgInfo.skPointer) or (AMember.Kind = skArray) or (AMember.Kind = skPointer) or
(AMember.Kind = FpDbgInfo.skRecord) (AMember.Kind = skRecord)
) )
then begin then begin
Result := False; Result := False;
@ -373,7 +374,7 @@ const
end end
end; end;
if AMember.Kind = FpDbgInfo.skFunction then begin if AMember.Kind = skFunction then begin
if sfVirtual in AMember.Flags then s2 := ' virtual;'; if sfVirtual in AMember.Flags then s2 := ' virtual;';
AText := AText + ' function ' + AMember.Name + ' () : '+s+';' + s2 + LineEnding; AText := AText + ' function ' + AMember.Name + ' () : '+s+';' + s2 + LineEnding;
end end
@ -693,7 +694,7 @@ const
if (AVal <> nil) and (ATypeIdent.Kind = skBoolean) then if (AVal <> nil) and (ATypeIdent.Kind = skBoolean) then
MaybeAdd(gcrtEvalExpr, GdbCmdEval + ASourceExpr, Format(',value="%s"', [dbgs(AVal.AsBool)])) MaybeAdd(gcrtEvalExpr, GdbCmdEval + ASourceExpr, Format(',value="%s"', [dbgs(AVal.AsBool)]))
else else
if (AVal <> nil) and (ATypeIdent.Kind = FpDbgInfo.skPointer) then if (AVal <> nil) and (ATypeIdent.Kind = skPointer) then
MaybeAdd(gcrtEvalExpr, GdbCmdEval + ASourceExpr, Format(',value="%u"', [AVal.AsCardinal])) MaybeAdd(gcrtEvalExpr, GdbCmdEval + ASourceExpr, Format(',value="%u"', [AVal.AsCardinal]))
; ;
end; end;
@ -701,28 +702,28 @@ const
AddBaseType(ASourceExpr, PointerLevel, AddBaseType(ASourceExpr, PointerLevel,
SrcTypeName, DeRefTypeName, BaseTypeName, SrcTypeName, DeRefTypeName, BaseTypeName,
ATypeIdent, BaseType); ATypeIdent, BaseType);
FpDbgInfo.skClass: skClass:
AddClassType(ASourceExpr, PointerLevel, AddClassType(ASourceExpr, PointerLevel,
SrcTypeName, DeRefTypeName, BaseTypeName, SrcTypeName, DeRefTypeName, BaseTypeName,
ATypeIdent, BaseType); ATypeIdent, BaseType);
FpDbgInfo.skRecord: skRecord:
AddRecordType(ASourceExpr, PointerLevel, AddRecordType(ASourceExpr, PointerLevel,
SrcTypeName, DeRefTypeName, BaseTypeName, SrcTypeName, DeRefTypeName, BaseTypeName,
ATypeIdent, BaseType); ATypeIdent, BaseType);
FpDbgInfo.skEnum: begin skEnum: begin
AddEnumType(ASourceExpr, PointerLevel, AddEnumType(ASourceExpr, PointerLevel,
SrcTypeName, DeRefTypeName, BaseTypeName, SrcTypeName, DeRefTypeName, BaseTypeName,
ATypeIdent, BaseType); ATypeIdent, BaseType);
if (AVal <> nil) and (ATypeIdent.Kind = FpDbgInfo.skEnum) then if (AVal <> nil) and (ATypeIdent.Kind = skEnum) then
if AVal.AsString = '' if AVal.AsString = ''
then MaybeAdd(gcrtEvalExpr, GdbCmdEval + ASourceExpr, Format(',value="%u"', [AVal.AsCardinal])) then MaybeAdd(gcrtEvalExpr, GdbCmdEval + ASourceExpr, Format(',value="%u"', [AVal.AsCardinal]))
else MaybeAdd(gcrtEvalExpr, GdbCmdEval + ASourceExpr, Format(',value="%s"', [AVal.AsString])); else MaybeAdd(gcrtEvalExpr, GdbCmdEval + ASourceExpr, Format(',value="%s"', [AVal.AsString]));
end; end;
FpDbgInfo.skSet: begin skSet: begin
AddSetType(ASourceExpr, PointerLevel, AddSetType(ASourceExpr, PointerLevel,
SrcTypeName, DeRefTypeName, BaseTypeName, SrcTypeName, DeRefTypeName, BaseTypeName,
ATypeIdent, BaseType); ATypeIdent, BaseType);
if (AVal <> nil) and (ATypeIdent.Kind = FpDbgInfo.skSet) then begin if (AVal <> nil) and (ATypeIdent.Kind = skSet) then begin
s := ''; s := '';
for i := 0 to AVal.MemberCount-1 do for i := 0 to AVal.MemberCount-1 do
if i = 0 if i = 0
@ -731,7 +732,7 @@ const
MaybeAdd(gcrtEvalExpr, GdbCmdEval + ASourceExpr, Format(',value="[%s]"', [s])) MaybeAdd(gcrtEvalExpr, GdbCmdEval + ASourceExpr, Format(',value="[%s]"', [s]))
end; end;
end; end;
FpDbgInfo.skArray: skArray:
AddArrayType(ASourceExpr, PointerLevel, AddArrayType(ASourceExpr, PointerLevel,
SrcTypeName, DeRefTypeName, BaseTypeName, SrcTypeName, DeRefTypeName, BaseTypeName,
ATypeIdent, BaseType); ATypeIdent, BaseType);
@ -767,7 +768,7 @@ DebugLn(['######## '+ARequest.Request, ' ## FOUND: ', dbgs(Result)]);
if PasExpr.Valid and (PasExpr.ResultValue <> nil) then begin if PasExpr.Valid and (PasExpr.ResultValue <> nil) then begin
rt := PasExpr.ResultValue.DbgSymbol; // value or typecast rt := PasExpr.ResultValue.DbgSymbol; // value or typecast
if rt <> nil then debugln(['@@@@@ ',rt.ClassName, ' ADDR=', dbgs(rt.Address)]); if rt <> nil then debugln(['@@@@@ ',rt.ClassName, ' ADDR=', dbgs(rt.Address)]);
DebugLn(['== VAL === ', PasExpr.ResultValue.AsInteger, ' / ', PasExpr.ResultValue.AsCardinal, ' / ', PasExpr.ResultValue.AsBool, ' / ', PasExpr.ResultValue.AsString, ' / ', PasExpr.ResultValue.MemberCount]); DebugLn(['== VAL === ', PasExpr.ResultValue.AsInteger, ' / ', PasExpr.ResultValue.AsCardinal, ' / ', PasExpr.ResultValue.AsBool, ' / ', PasExpr.ResultValue.AsString, ' / ', PasExpr.ResultValue.MemberCount, ' / ', PasExpr.ResultValue.AsFloat]);
if (rt <> nil) and (rt is TDbgDwarfValueIdentifier) then begin if (rt <> nil) and (rt is TDbgDwarfValueIdentifier) then begin
// symbol is value // symbol is value

View File

@ -41,7 +41,7 @@ interface
uses uses
Classes, SysUtils, strutils, Controls, Math, Variants, LCLProc, LazClasses, LazLoggerBase, Classes, SysUtils, strutils, Controls, Math, Variants, LCLProc, LazClasses, LazLoggerBase,
Dialogs, DebugUtils, Debugger, FileUtil, LazLoggerProfiling, BaseIDEIntf, CmdLineDebugger, Dialogs, DebugUtils, Debugger, FileUtil, LazLoggerProfiling, BaseIDEIntf, CmdLineDebugger,
GDBTypeInfo, Maps, GDBMIDebugInstructions, LCLIntf, Forms, DbgIntfBaseTypes, GDBTypeInfo, Maps, GDBMIDebugInstructions, LCLIntf, Forms,
{$IFdef MSWindows} {$IFdef MSWindows}
Windows, Windows,
{$ENDIF} {$ENDIF}

View File

@ -34,7 +34,8 @@ unit GDBTypeInfo;
interface interface
uses uses
Classes, SysUtils, Debugger, LclProc, math, LazLoggerBase, DebugUtils, GDBMIMiscClasses; Classes, SysUtils, Debugger, LclProc, math, LazLoggerBase, DebugUtils,
DbgIntfBaseTypes, GDBMIMiscClasses;
(* (*
ptype = { ptype = {

View File

@ -29,7 +29,7 @@ interface
uses uses
Classes, SysUtils, Forms, Controls, Graphics, IDEWindowIntf, DebuggerStrConst, ComCtrls, Classes, SysUtils, Forms, Controls, Graphics, IDEWindowIntf, DebuggerStrConst, ComCtrls,
ObjectInspector, PropEdits, IDEImagesIntf, Debugger, DebuggerDlg, BaseDebugManager, ObjectInspector, PropEdits, IDEImagesIntf, Debugger, DebuggerDlg, DbgIntfBaseTypes, BaseDebugManager,
LazarusIDEStrConsts, LCLType, Grids, StdCtrls, Menus, LCLProc, InputHistory, IDEProcs; LazarusIDEStrConsts, LCLType, Grids, StdCtrls, Menus, LCLProc, InputHistory, IDEProcs;
type type

View File

@ -41,7 +41,7 @@ uses
Classes, Forms, Controls, math, sysutils, LazLoggerBase, Clipbrd, Classes, Forms, Controls, math, sysutils, LazLoggerBase, Clipbrd,
IDEWindowIntf, Menus, ComCtrls, ActnList, ExtCtrls, StdCtrls, LCLType, IDEImagesIntf, IDEWindowIntf, Menus, ComCtrls, ActnList, ExtCtrls, StdCtrls, LCLType, IDEImagesIntf,
LazarusIDEStrConsts, DebuggerStrConst, Debugger, DebuggerDlg, LazarusIDEStrConsts, DebuggerStrConst, Debugger, DebuggerDlg,
BaseDebugManager; DbgIntfBaseTypes, BaseDebugManager;
type type

View File

@ -40,7 +40,7 @@ uses
{$IFDEF IDE_MEM_CHECK} {$IFDEF IDE_MEM_CHECK}
MemCheck, MemCheck,
{$ENDIF} {$ENDIF}
Classes, SysUtils, Forms, Project, SourceMarks, Debugger, ProjectDefs, Classes, SysUtils, Forms, Project, SourceMarks, DbgIntfBaseTypes, Debugger, ProjectDefs,
IDEOptionsIntf, LazarusIDEStrConsts, Laz2_XMLCfg; IDEOptionsIntf, LazarusIDEStrConsts, Laz2_XMLCfg;
type type

View File

@ -57,8 +57,8 @@ uses
DebuggerDlg, Watchesdlg, BreakPointsdlg, BreakPropertyDlg, LocalsDlg, WatchPropertyDlg, DebuggerDlg, Watchesdlg, BreakPointsdlg, BreakPropertyDlg, LocalsDlg, WatchPropertyDlg,
CallStackDlg, EvaluateDlg, RegistersDlg, AssemblerDlg, DebugOutputForm, ExceptionDlg, CallStackDlg, EvaluateDlg, RegistersDlg, AssemblerDlg, DebugOutputForm, ExceptionDlg,
InspectDlg, DebugEventsForm, PseudoTerminalDlg, FeedbackDlg, ThreadDlg, HistoryDlg, InspectDlg, DebugEventsForm, PseudoTerminalDlg, FeedbackDlg, ThreadDlg, HistoryDlg,
GDBMIDebugger, SSHGDBMIDebugger, ProcessDebugger, GDBMIServerDebugger, GDBMIDebugger, SSHGDBMIDebugger, ProcessDebugger, GDBMIServerDebugger,
BaseDebugManager; DbgIntfBaseTypes, BaseDebugManager;
type type

View File

@ -101,7 +101,7 @@ uses
Translations, Translations,
// debugger // debugger
RunParamsOpts, BaseDebugManager, DebugManager, debugger, DebuggerDlg, RunParamsOpts, BaseDebugManager, DebugManager, debugger, DebuggerDlg,
DebugAttachDialog, DebugAttachDialog, DbgIntfBaseTypes,
// packager // packager
PackageSystem, PkgManager, BasePkgManager, LPKCache, PackageSystem, PkgManager, BasePkgManager, LPKCache,
// source editing // source editing

View File

@ -74,7 +74,7 @@ uses
SortSelectionDlg, EncloseSelectionDlg, ConDef, InvertAssignTool, SortSelectionDlg, EncloseSelectionDlg, ConDef, InvertAssignTool,
SourceEditProcs, SourceMarks, CharacterMapDlg, SearchFrm, SourceEditProcs, SourceMarks, CharacterMapDlg, SearchFrm,
FPDocHints, EditorMacroListViewer, FPDocHints, EditorMacroListViewer,
BaseDebugManager, Debugger, MainIntf, GotoFrm; DbgIntfBaseTypes, BaseDebugManager, Debugger, MainIntf, GotoFrm;
type type
TSourceNotebook = class; TSourceNotebook = class;