1 unit FpDbgInfo;
2 (*
3   About TFpDbgValue and TFpDbgSymbol
4 
5   * TFpDbgSymbol
6     Represents a Symbol or Identifier (stType or stValue)
7 
8   * TFpDbgValue
9     Holds the Value of a Symbol according to its type.
10 
11   TFpDbgSymbol should not hold any Data, except for information that is in the
12   debug info (dwarf/stabs).
13   All Data read from the target must be in TFpDbgValue.
14   Target adta includes Address (can be indirect via ref or pointer, Size and
15   Boundaries (Sub range / Array).
16 
17   This means that TFpDbgSymbol (stType or stValue) should be re-usable. There can
18   be multiple TFpDbgValue for each TFpDbgSymbol. (even for stValue, as in an
19   Array the Symbol itself is repeated / Array of record: the same member occurs
20   over and over)
21 
22   ---
23   A Variable value in the target typically consists of:
24   - TFpDbgSymbol (stValue)
25   - TFpDbgSymbol (stType)
26   - TFpDbgValue
27 
28 *)
29 {$mode objfpc}{$H+}
30 
31 interface
32 
33 uses
34   Classes, SysUtils, DbgIntfBaseTypes, FpDbgLoader, FpdMemoryTools, FpErrorMessages,
35   LazLoggerBase, LazClasses;
36 
37 type
38   { TFpDbgCircularRefCountedObject }
39 
40   TFpDbgCircularRefCountedObject = class(TRefCountedObject)
41   private
42     FCircleRefCount: Integer;
43   protected
44     (* InOrder to activate, and use an interited class must override
45        DoReferenceAdded; and DoReferenceReleased;
46        And Point then to
47        DoPlainReferenceAdded; and DoPlainReferenceReleased;
48     *)
49     procedure DoPlainReferenceAdded; inline;
50     procedure DoPlainReferenceReleased; inline;
51 
52     // Receive the *strong* reference (always set)
53     // The circle back ref will only be set, if this is also referenced by others
54     procedure AddCirclularReference{$IFDEF WITH_REFCOUNT_DEBUG}(DebugIdAdr: Pointer = nil; DebugIdTxt: String = ''){$ENDIF};
55     procedure ReleaseCirclularReference{$IFDEF WITH_REFCOUNT_DEBUG}(DebugIdAdr: Pointer = nil; DebugIdTxt: String = ''){$ENDIF};
56 
57     procedure MakePlainRefToCirclular;
58     procedure MakeCirclularRefToPlain;
59 
CircleBackRefsActivenull60     function  CircleBackRefsActive: Boolean; inline;
61     procedure CircleBackRefActiveChanged({%H-}NewActive: Boolean); virtual;
62   end;
63 
64   { TFpDbgCircularRefCntObjList }
65 
66   TFpDbgCircularRefCntObjList = class(TRefCntObjList)
67   protected
68     procedure Notify(Ptr: Pointer; Action: TListNotification); override;
69   end;
70 
71   TDbgSymbolType = (
72     stNone,
procedurenull73     stValue,  // The symbol has a value (var, field, function, procedure (value is address of func/proc, so it can be called)
74     stType    // The Symbol is a type (including proc/func declaration / without DW_AT_low_pc)
75   );
76 
77   TDbgSymbolMemberVisibility =(
78     svPrivate,
79     svProtected,
80     svPublic
81   );
82 
83   TDbgSymbolFlag =(
84     sfSubRange,     // This is a subrange, e.g 3..99
85     sfDynArray,     // skArray is known to be a dynamic array
86     sfStatArray,    // skArray is known to be a static array
87     sfVirtual,      // skProcedure,skFunction:  virtual function (or overriden)
88     sfParameter,    // Parameter to a function
89     // unimplemented:
90     sfInternalRef,  // TODO: (May not always be present) Internal ref/pointer e.g. var/constref parameters
91     sfConst,         // The sym is a constant and cannot be modified
92     sfVar,
93     sfOut,
94     sfpropGet,
95     sfPropSet,
96     sfPropStored
97   );
98   TDbgSymbolFlags = set of TDbgSymbolFlag;
99 
100   TFpDbgSymbolField = (
101     sfiName, sfiKind, sfiSymType, sfiAddress, sfiSize,
102     sfiTypeInfo, sfiMemberVisibility,
103     sfiForwardToSymbol
104   );
105   TFpDbgSymbolFields = set of TFpDbgSymbolField;
106 
107   TFpDbgSymbol = class;
108 
109   TFpDbgSymbolBase = class(TFpDbgCircularRefCountedObject)
110   end;
111 
112   TFpDbgValueFieldFlag = (
113     // svfAddress, svfDataAddress this symbol does have an address, but it may still be nil
114     svfAddress, svfSize, svfSizeOfPointer,
115     svfDataAddress, svfDataSize, svfDataSizeOfPointer,
116     svfInteger, svfCardinal, svfFloat,
117     svfString, svfWideString,
118     svfBoolean,
119     svfIdentifier,   // returned via AsString: a named value (enum, set-member)
120     svfMembers,
121     //svfParent, // TODO: for members, get the parent (object/record-fields, enum/set-members
122     svfOrdinal       // AsCardinal ruturns an ordinal value, but the value is not represented as cardinal (e.g. bool, enum)
123                      // if size > 8, then ordinal (if present) is based on a part only
124   );
125   TFpDbgValueFieldFlags = set of TFpDbgValueFieldFlag;
126 
127   { TFpDbgValue }
128 
129   TFpDbgValue = class(TFpDbgSymbolBase)
130   protected
GetKindnull131     function GetKind: TDbgSymbolKind; virtual;
GetFieldFlagsnull132     function GetFieldFlags: TFpDbgValueFieldFlags; virtual;
133 
GetAsBoolnull134     function GetAsBool: Boolean;  virtual;
GetAsCardinalnull135     function GetAsCardinal: QWord; virtual;
GetAsIntegernull136     function GetAsInteger: Int64; virtual;
GetAsStringnull137     function GetAsString: AnsiString; virtual;
GetAsWideStringnull138     function GetAsWideString: WideString; virtual;
GetAsFloatnull139     function GetAsFloat: Extended; virtual;
140 
GetAddressnull141     function GetAddress: TFpDbgMemLocation;  virtual;
GetSizenull142     function GetSize: Integer;  virtual;  // returns -1, if not available
GetDataAddressnull143     function GetDataAddress: TFpDbgMemLocation;  virtual;
GetDataSizenull144     function GetDataSize: Integer;  virtual;
145 
GetHasBoundsnull146     function GetHasBounds: Boolean; virtual;
GetOrdHighBoundnull147     function GetOrdHighBound: Int64; virtual;
GetOrdLowBoundnull148     function GetOrdLowBound: Int64; virtual;
149 
GetMembernull150     function GetMember({%H-}AIndex: Int64): TFpDbgValue; virtual;
GetMemberByNamenull151     function GetMemberByName({%H-}AIndex: String): TFpDbgValue; virtual;
GetMemberCountnull152     function GetMemberCount: Integer; virtual;
GetIndexTypenull153     function GetIndexType({%H-}AIndex: Integer): TFpDbgSymbol; virtual;
GetIndexTypeCountnull154     function GetIndexTypeCount: Integer; virtual;
GetMemberCountExnull155     function GetMemberCountEx(const AIndex: array of Int64): Integer; virtual;
GetMemberExnull156     function GetMemberEx(const AIndex: Array of Int64): TFpDbgValue; virtual;
157 
GetDbgSymbolnull158     function GetDbgSymbol: TFpDbgSymbol; virtual;
GetTypeInfonull159     function GetTypeInfo: TFpDbgSymbol; virtual;
GetContextTypeInfonull160     function GetContextTypeInfo: TFpDbgSymbol; virtual;
161 
GetLastErrornull162     function GetLastError: TFpError; virtual;
163   public
164     constructor Create;
165     property RefCount;
166 
167     // Kind: determines which types of value are available
168     property Kind: TDbgSymbolKind read GetKind;
169     property FieldFlags: TFpDbgValueFieldFlags read GetFieldFlags;
170 
171     property AsInteger: Int64 read GetAsInteger;
172     property AsCardinal: QWord read GetAsCardinal;
173     property AsBool: Boolean read GetAsBool;
174     property AsString: AnsiString read GetAsString;
175     property AsWideString: WideString read GetAsWideString;
176     property AsFloat: Extended read GetAsFloat;
177 
178     (* * Address/Size
179          Address of the variable (as returned by the "@" address of operator
180        * DataAddress/DataSize
181          Address of Data, if avail and diff from Address (e.g. String, TObject, DynArray, ..., BUT NOT record)
182          Otherwise same as Address/Size
183          For pointers, this is the address of the pointed-to data
184     *)
185     property Address: TFpDbgMemLocation read GetAddress;
186     property Size: Integer read GetSize;
187     property DataAddress: TFpDbgMemLocation read GetDataAddress; //
188     property DataSize: Integer read GetDataSize;
189 
190     property HasBounds: Boolean  read GetHasBounds;
191     property OrdLowBound: Int64  read GetOrdLowBound;   // need typecast for QuadWord
192     property OrdHighBound: Int64 read GetOrdHighBound;  // need typecast for QuadWord
193     // memdump
194   public
GetTypeCastedValuenull195     function GetTypeCastedValue(ADataVal: TFpDbgValue): TFpDbgValue; virtual; // only if Symbol is a type
196 // base class? Or Member includes member from base
197     (* Member:
198        * skClass, skStructure:
199            stType: it excludes BaseClass (TODO: decide?)
200            stValue: includes
201        * skSet
202            stType: all members
203            stValue: only members set in value (Only impremented for DbgSymbolValue)
204        * skArray: (differs from TFpDbgSymbol)
205          The values. The type of each Index-dimension is avail via IndexType
206        * skPointer: deref the pointer, with index (0 = normal deref)
207        NOTE: Values returned by Member/MemberByName are volatile.
208              They maybe released or changed when Member is called again.
209              To keep a returned Value a reference can be added (AddReference)
210     *)
211     property MemberCount: Integer read GetMemberCount;
212     property Member[AIndex: Int64]: TFpDbgValue read GetMember;
213     property MemberByName[AIndex: String]: TFpDbgValue read GetMemberByName; // Includes inheritance
214     //  For Arrays (TODO pointers) only, the values stored in the array
215     property IndexTypeCount: Integer read GetIndexTypeCount;
216     property IndexType[AIndex: Integer]: TFpDbgSymbol read GetIndexType;
217 
218     (* DbgSymbol: The TFpDbgSymbol from which this value came, maybe nil.
219                   Maybe a stType, then there is no Value *)
220     property DbgSymbol: TFpDbgSymbol read GetDbgSymbol;
221     property TypeInfo: TFpDbgSymbol read GetTypeInfo;
222     property ContextTypeInfo: TFpDbgSymbol read GetContextTypeInfo; // For members, the class in which this member is declared
223 
224     property LastError: TFpError read GetLastError;
225   end;
226 
227   { TFpDbgValueConstNumber }
228 
229   TFpDbgValueConstNumber = class(TFpDbgValue)
230   private
231     FValue: QWord;
232     FSigned: Boolean;
233   protected
234     property Value: QWord read FValue write FValue;
235     property Signed: Boolean read FSigned write FSigned;
GetKindnull236     function GetKind: TDbgSymbolKind; override;
GetFieldFlagsnull237     function GetFieldFlags: TFpDbgValueFieldFlags; override;
GetAsCardinalnull238     function GetAsCardinal: QWord; override;
GetAsIntegernull239     function GetAsInteger: Int64; override;
240   public
241     constructor Create(AValue: QWord; ASigned: Boolean = True);
242   end;
243 
244   { TFpDbgValueConstChar }
245 
246   TFpDbgValueConstChar = class(TFpDbgValue) // skChar / Not for strings
247   private
248     FValue: String;
249     FSigned: Boolean;
250   protected
251     property Value: String read FValue write FValue;
GetKindnull252     function GetKind: TDbgSymbolKind; override;
GetFieldFlagsnull253     function GetFieldFlags: TFpDbgValueFieldFlags; override;
GetAsStringnull254     function GetAsString: AnsiString; override;
255   public
256     constructor Create(AValue: AnsiString);
257   end;
258 
259   { TFpDbgValueConstWideChar }
260 
261   TFpDbgValueConstWideChar = class(TFpDbgValue) // skChar / Not for strings
262   private
263     FValue: String;
264     FSigned: Boolean;
265   protected
266     property Value: String read FValue write FValue;
GetKindnull267     function GetKind: TDbgSymbolKind; override;
GetFieldFlagsnull268     function GetFieldFlags: TFpDbgValueFieldFlags; override;
GetAsStringnull269     function GetAsString: AnsiString; override;
270   public
271     constructor Create(AValue: AnsiString);
272   end;
273 
274   { TFpDbgValueConstFloat }
275 
276   TFpDbgValueConstFloat = class(TFpDbgValue)
277   private
278     FValue: Extended;
279   protected
280     property Value: Extended read FValue write FValue;
GetKindnull281     function GetKind: TDbgSymbolKind; override;
GetFieldFlagsnull282     function GetFieldFlags: TFpDbgValueFieldFlags; override;
GetAsFloatnull283     function GetAsFloat: Extended; override;
284   public
285     constructor Create(AValue: Extended);
286   end;
287 
288   { TFpDbgValueConstBool}
289 
290   TFpDbgValueConstBool = class(TFpDbgValue)
291   private
292     FValue: Boolean;
293   protected
294     property Value: Boolean read FValue write FValue;
GetKindnull295     function GetKind: TDbgSymbolKind; override;
GetFieldFlagsnull296     function GetFieldFlags: TFpDbgValueFieldFlags; override;
GetAsBoolnull297     function GetAsBool: Boolean; override;
GetAsCardinalnull298     function GetAsCardinal: QWord; override;
299   public
300     constructor Create(AValue: Boolean);
301   end;
302 
303   { TFpDbgValueConstAddress }
304 
305   TFpDbgValueConstAddress = class(TFpDbgValue)
306   private
307     FAddress: TFpDbgMemLocation;
308   protected
309     property Address: TFpDbgMemLocation read FAddress write FAddress;
GetKindnull310     function GetKind: TDbgSymbolKind; override; // skAddress
GetFieldFlagsnull311     function GetFieldFlags: TFpDbgValueFieldFlags; override;
GetAddressnull312     function GetAddress: TFpDbgMemLocation; override;
313   public
314     constructor Create(AnAddress: TFpDbgMemLocation);
315   end;
316 
317   { TFpDbgValueTypeDefinition }
318 
319   TFpDbgValueTypeDefinition = class(TFpDbgValue)
320   private
321     FSymbol: TFpDbgSymbol; // stType
322   protected
GetKindnull323     function GetKind: TDbgSymbolKind; override;
GetDbgSymbolnull324     function GetDbgSymbol: TFpDbgSymbol; override;
325   public
326     constructor Create(ASymbol: TFpDbgSymbol); // Only for stType
327     destructor Destroy; override;
328   end;
329 
330   { TFpDbgSymbol }
331 
332   TFpDbgSymbol = class(TFpDbgSymbolBase)
333   private
334     FEvaluatedFields: TFpDbgSymbolFields;
335     FLastError: TFpError;
336 
337     // Cached fields
338     FName: String;
339     FKind: TDbgSymbolKind;
340     FSymbolType: TDbgSymbolType;
341     FAddress: TFpDbgMemLocation;
342     FSize: Integer;
343     FTypeInfo: TFpDbgSymbol;
344     FMemberVisibility: TDbgSymbolMemberVisibility; // Todo: not cached
345 
GetSymbolTypenull346     function GetSymbolType: TDbgSymbolType; inline;
GetKindnull347     function GetKind: TDbgSymbolKind; inline;
GetNamenull348     function GetName: String; inline;
GetSizenull349     function GetSize: Integer; inline;
GetAddressnull350     function GetAddress: TFpDbgMemLocation; inline;
GetTypeInfonull351     function GetTypeInfo: TFpDbgSymbol; inline;
GetMemberVisibilitynull352     function GetMemberVisibility: TDbgSymbolMemberVisibility; inline;
353   protected
GetLastErrornull354     function  GetLastError: TFpError; virtual;
355     procedure SetLastError(AnError: TFpError);
356     // NOT cached fields
GetChildnull357     function GetChild({%H-}AIndex: Integer): TFpDbgSymbol; virtual;
GetColumnnull358     function GetColumn: Cardinal; virtual;
GetCountnull359     function GetCount: Integer; virtual;
GetFilenull360     function GetFile: String; virtual;
GetFlagsnull361     function GetFlags: TDbgSymbolFlags; virtual;
GetLinenull362     function GetLine: Cardinal; virtual;
GetParentnull363     function GetParent: TFpDbgSymbol; virtual;
364 
GetValueObjectnull365     function GetValueObject: TFpDbgValue; virtual;
GetHasOrdinalValuenull366     function GetHasOrdinalValue: Boolean; virtual;
GetOrdinalValuenull367     function GetOrdinalValue: Int64; virtual;
368 
GetHasBoundsnull369     function GetHasBounds: Boolean; virtual;
GetOrdHighBoundnull370     function GetOrdHighBound: Int64; virtual;
GetOrdLowBoundnull371     function GetOrdLowBound: Int64; virtual;
372 
GetMembernull373     function GetMember({%H-}AIndex: Int64): TFpDbgSymbol; virtual;
GetMemberByNamenull374     function GetMemberByName({%H-}AIndex: String): TFpDbgSymbol; virtual;
GetMemberCountnull375     function GetMemberCount: Integer; virtual;
376   protected
377     property EvaluatedFields: TFpDbgSymbolFields read FEvaluatedFields write FEvaluatedFields;
378     // Cached fields
379     procedure SetName(AValue: String); inline;
380     procedure SetKind(AValue: TDbgSymbolKind); inline;
381     procedure SetSymbolType(AValue: TDbgSymbolType); inline;
382     procedure SetAddress(AValue: TFpDbgMemLocation); inline;
383     procedure SetSize(AValue: Integer); inline;
384     procedure SetTypeInfo(AValue: TFpDbgSymbol); inline;
385     procedure SetMemberVisibility(AValue: TDbgSymbolMemberVisibility); inline;
386 
387     procedure KindNeeded; virtual;
388     procedure NameNeeded; virtual;
389     procedure SymbolTypeNeeded; virtual;
390     procedure AddressNeeded; virtual;
391     procedure SizeNeeded; virtual;
392     procedure TypeInfoNeeded; virtual;
393     procedure MemberVisibilityNeeded; virtual;
394     //procedure Needed; virtual;
395   public
396     constructor Create(const AName: String);
397     constructor Create(const AName: String; AKind: TDbgSymbolKind; AAddress: TFpDbgMemLocation);
398     destructor Destroy; override;
399     // Basic info
400     property Name:       String read GetName;
401     property SymbolType: TDbgSymbolType read GetSymbolType;
402     property Kind:       TDbgSymbolKind read GetKind;
403     // Memory; Size is also part of type (byte vs word vs ...)
404     // HasAddress // (register does not have)
405     property Address:    TFpDbgMemLocation read GetAddress;    // used by Proc/func
406     property Size:       Integer read GetSize; // In Bytes
407     // TypeInfo used by
408     // stValue (Variable): Type
409     // stType: Pointer: type pointed to / Array: Element Type / Func: Result / Class: itheritance
410     property TypeInfo: TFpDbgSymbol read GetTypeInfo;
411     // Location
412     property FileName: String read GetFile;
413     property Line: Cardinal read GetLine;
414     property Column: Cardinal read GetColumn;
415     // Methods for structures (record / class / enum)
416     //         array: each member represents an index (enum or subrange) and has low/high bounds
417     property MemberVisibility: TDbgSymbolMemberVisibility read GetMemberVisibility;
418     property MemberCount: Integer read GetMemberCount;
419     (* Member:
420        * skClass, skStructure:
421            stType: it excludes BaseClass (TODO: decide?)
422            includes
423        * skSet
424            stType: all members
425            stValue: only members set in value (Only impremented for DbgSymbolValue)
426        * skArray:
427          The type of each Index-dimension
428          The count is the amount of dimensions
429        NOTE: Values returned by Member/MemberByName are volatile.
430              They maybe released or changed when Member is called again.
431              To keep a returned Value a reference can be added (AddReference)
432     *)
433     property Member[AIndex: Int64]: TFpDbgSymbol read GetMember;
434     property MemberByName[AIndex: String]: TFpDbgSymbol read GetMemberByName; // Includes inheritance
435     //
436     property Flags: TDbgSymbolFlags read GetFlags;
437     property Count: Integer read GetCount; deprecated 'use MemberCount instead';
438     property Parent: TFpDbgSymbol read GetParent; deprecated;
439     // for Subranges
440     property HasBounds: Boolean read GetHasBounds;
441     property OrdLowBound: Int64 read GetOrdLowBound;  //deprecated 'xxxx'; // need typecast for QuadWord
442     property OrdHighBound: Int64 read GetOrdHighBound;  //deprecated 'xxxx'; // need typecast for QuadWord
443     // VALUE
444     property Value: TFpDbgValue read GetValueObject; //deprecated 'rename / create';
445     property HasOrdinalValue: Boolean read GetHasOrdinalValue;
446     property OrdinalValue: Int64 read GetOrdinalValue;   //deprecated 'xxxx'; // need typecast for QuadWord
447 
448     // TypeCastValue| only fon stType symbols, may return nil
449     // Returns a reference to caller / caller must release
TypeCastValuenull450     function TypeCastValue({%H-}AValue: TFpDbgValue): TFpDbgValue; virtual;
451 
452     property LastError: TFpError read GetLastError; experimental;
453   end;
454 
455   { TDbgSymbolForwarder }
456 
457   TDbgSymbolForwarder = class(TFpDbgSymbol)
458   private
459     FForwardToSymbol: TFpDbgSymbol;
460   protected
461     procedure SetForwardToSymbol(AValue: TFpDbgSymbol); inline;
462     procedure ForwardToSymbolNeeded; virtual;
GetForwardToSymbolnull463     function  GetForwardToSymbol: TFpDbgSymbol; inline;
464   protected
GetLastErrornull465     function GetLastError: TFpError; override;
466     procedure KindNeeded; override;
467     procedure NameNeeded; override;
468     procedure SymbolTypeNeeded; override;
469     procedure SizeNeeded; override;
470     procedure TypeInfoNeeded; override;
471     procedure MemberVisibilityNeeded; override;
472 
GetFlagsnull473     function GetFlags: TDbgSymbolFlags; override;
GetValueObjectnull474     function GetValueObject: TFpDbgValue; override;
GetHasOrdinalValuenull475     function GetHasOrdinalValue: Boolean; override;
GetOrdinalValuenull476     function GetOrdinalValue: Int64; override;
GetHasBoundsnull477     function GetHasBounds: Boolean; override;
GetOrdLowBoundnull478     function GetOrdLowBound: Int64; override;
GetOrdHighBoundnull479     function GetOrdHighBound: Int64; override;
GetMembernull480     function GetMember(AIndex: Int64): TFpDbgSymbol; override;
GetMemberByNamenull481     function GetMemberByName(AIndex: String): TFpDbgSymbol; override;
GetMemberCountnull482     function GetMemberCount: Integer; override;
483   end;
484 
485   { TFpDbgInfoContext }
486 
487   TFpDbgInfoContext = class(TFpDbgAddressContext)
488   protected
GetSymbolAtAddressnull489     function GetSymbolAtAddress: TFpDbgSymbol; virtual;
GetProcedureAtAddressnull490     function GetProcedureAtAddress: TFpDbgValue; virtual;
GetMemManagernull491     function GetMemManager: TFpDbgMemManager; virtual;
492   public
493     property SymbolAtAddress: TFpDbgSymbol read GetSymbolAtAddress;
494     property ProcedureAtAddress: TFpDbgValue read GetProcedureAtAddress;
495     // search this, and all parent context
FindSymbolnull496     function FindSymbol(const {%H-}AName: String): TFpDbgValue; virtual;
497     property MemManager: TFpDbgMemManager read GetMemManager;
498   end;
499 
500   { TDbgInfo }
501 
502   TDbgInfo = class(TObject)
503   private
504     FHasInfo: Boolean;
505   protected
506     procedure SetHasInfo;
507   public
508     constructor Create({%H-}ALoaderList: TDbgImageLoaderList); virtual;
509     (* Context should be searched by Thread, and StackFrame. The Address can be
510        derived from this.
511        However a different Address may be froced.
512        TODO: for now address may be needed, as stack decoding is not done yet
513     *)
FindContextnull514     function FindContext(AThreadId, AStackFrame: Integer; {%H-}AAddress: TDbgPtr = 0): TFpDbgInfoContext; virtual;
FindContextnull515     function FindContext({%H-}AAddress: TDbgPtr): TFpDbgInfoContext; virtual; deprecated 'use FindContextFindContext(thread,stack,address)';
FindSymbolnull516     function FindSymbol(const {%H-}AName: String): TFpDbgSymbol; virtual; deprecated;
FindSymbolnull517     function FindSymbol({%H-}AAddress: TDbgPtr): TFpDbgSymbol; virtual; deprecated;
518     property HasInfo: Boolean read FHasInfo;
GetLineAddressesnull519     function GetLineAddresses(const AFileName: String; ALine: Cardinal; var AResultList: TDBGPtrArray): Boolean; virtual;
520     //property MemManager: TFpDbgMemReaderBase read GetMemManager write SetMemManager;
521   end;
522 
dbgsnull523 function dbgs(ADbgSymbolKind: TDbgSymbolKind): String; overload;
524 
525 implementation
526 
dbgsnull527 function dbgs(ADbgSymbolKind: TDbgSymbolKind): String;
528 begin
529   Result := '';
530   WriteStr(Result, ADbgSymbolKind);
531 end;
532 
533 { TFpDbgValueConstChar }
534 
GetKindnull535 function TFpDbgValueConstChar.GetKind: TDbgSymbolKind;
536 begin
537   Result := skChar;
538 end;
539 
TFpDbgValueConstChar.GetFieldFlagsnull540 function TFpDbgValueConstChar.GetFieldFlags: TFpDbgValueFieldFlags;
541 begin
542   Result := [svfString]
543 end;
544 
TFpDbgValueConstChar.GetAsStringnull545 function TFpDbgValueConstChar.GetAsString: AnsiString;
546 begin
547   Result := Value;
548 end;
549 
550 constructor TFpDbgValueConstChar.Create(AValue: AnsiString);
551 begin
552   inherited Create;
553   FValue := AValue;
554 end;
555 
556 { TFpDbgValueConstWideChar }
557 
GetKindnull558 function TFpDbgValueConstWideChar.GetKind: TDbgSymbolKind;
559 begin
560   Result := skChar;
561 end;
562 
TFpDbgValueConstWideChar.GetFieldFlagsnull563 function TFpDbgValueConstWideChar.GetFieldFlags: TFpDbgValueFieldFlags;
564 begin
565   Result := [svfString]
566 end;
567 
GetAsStringnull568 function TFpDbgValueConstWideChar.GetAsString: AnsiString;
569 begin
570   Result := Value;
571 end;
572 
573 constructor TFpDbgValueConstWideChar.Create(AValue: AnsiString);
574 begin
575   inherited Create;
576   FValue := AValue;
577 end;
578 
579 { TFpDbgCircularRefCountedObject }
580 
581 procedure TFpDbgCircularRefCountedObject.DoPlainReferenceAdded;
582 begin
583   if (RefCount = FCircleRefCount + 1) then
584     CircleBackRefActiveChanged(True);
585 end;
586 
587 procedure TFpDbgCircularRefCountedObject.DoPlainReferenceReleased;
588 begin
589   if (RefCount = FCircleRefCount) then
590     CircleBackRefActiveChanged(False);
591 end;
592 
593 procedure TFpDbgCircularRefCountedObject.AddCirclularReference{$IFDEF WITH_REFCOUNT_DEBUG}(DebugIdAdr: Pointer = nil; DebugIdTxt: String = ''){$ENDIF};
594 begin
595   if CircleBackRefsActive then begin
596     AddReference{$IFDEF WITH_REFCOUNT_DEBUG}(DebugIdAdr, DebugIdTxt){$ENDIF};
597     inc(FCircleRefCount);
598   end
599   else begin
600     inc(FCircleRefCount);
601     AddReference{$IFDEF WITH_REFCOUNT_DEBUG}(DebugIdAdr, DebugIdTxt){$ENDIF};
602   end;
603 end;
604 
605 procedure TFpDbgCircularRefCountedObject.ReleaseCirclularReference{$IFDEF WITH_REFCOUNT_DEBUG}(DebugIdAdr: Pointer = nil; DebugIdTxt: String = ''){$ENDIF};
606 var
607   i: Integer;
608 begin
609   Assert(FCircleRefCount > 0, 'ReleaseCirclularReference > 0');
610   if CircleBackRefsActive then begin
611     dec(FCircleRefCount);
612     ReleaseReference{$IFDEF WITH_REFCOUNT_DEBUG}(DebugIdAdr, DebugIdTxt){$ENDIF};
613   end
614   else begin
615     i := RefCount;
616     ReleaseReference{$IFDEF WITH_REFCOUNT_DEBUG}(DebugIdAdr, DebugIdTxt){$ENDIF};
617     if i > 1 then // if i was 1, then self is destroyed
618       dec(FCircleRefCount);
619   end;
620 end;
621 
622 procedure TFpDbgCircularRefCountedObject.MakePlainRefToCirclular;
623 begin
624   Assert(FCircleRefCount < RefCount, 'MakePlainRefToCirclular < max');
625   inc(FCircleRefCount);
626   if (RefCount = FCircleRefCount) then
627     CircleBackRefActiveChanged(False);
628 end;
629 
630 procedure TFpDbgCircularRefCountedObject.MakeCirclularRefToPlain;
631 begin
632   Assert(FCircleRefCount > 0, 'MakeCirclularRefToPlain > 0');
633   dec(FCircleRefCount);
634   if (RefCount = FCircleRefCount + 1) then
635     CircleBackRefActiveChanged(True);
636 end;
637 
TFpDbgCircularRefCountedObject.CircleBackRefsActivenull638 function TFpDbgCircularRefCountedObject.CircleBackRefsActive: Boolean;
639 begin
640   Result := (RefCount > FCircleRefCount);
641 end;
642 
643 procedure TFpDbgCircularRefCountedObject.CircleBackRefActiveChanged(NewActive: Boolean);
644 begin
645   //
646 end;
647 
648 { TFpDbgCircularRefCntObjList }
649 
650 procedure TFpDbgCircularRefCntObjList.Notify(Ptr: Pointer; Action: TListNotification);
651 begin
652   // Do NOT call inherited
653   case Action of
654     lnAdded:   TFpDbgCircularRefCountedObject(Ptr).AddCirclularReference;
655     lnExtracted,
656     lnDeleted: TFpDbgCircularRefCountedObject(Ptr).ReleaseCirclularReference;
657   end;
658 end;
659 
660 { TDbgSymbolValue }
661 
GetAsStringnull662 function TFpDbgValue.GetAsString: AnsiString;
663 begin
664   Result := '';
665 end;
666 
GetAsWideStringnull667 function TFpDbgValue.GetAsWideString: WideString;
668 begin
669   Result := '';
670 end;
671 
TFpDbgValue.GetDbgSymbolnull672 function TFpDbgValue.GetDbgSymbol: TFpDbgSymbol;
673 begin
674   Result := nil;
675 end;
676 
677 constructor TFpDbgValue.Create;
678 begin
679   inherited Create;
680   AddReference;
681 end;
682 
GetTypeCastedValuenull683 function TFpDbgValue.GetTypeCastedValue(ADataVal: TFpDbgValue): TFpDbgValue;
684 begin
685   assert(False, 'TFpDbgValue.GetTypeCastedValue: False');
686   Result := nil;
687 end;
688 
GetTypeInfonull689 function TFpDbgValue.GetTypeInfo: TFpDbgSymbol;
690 begin
691   if (DbgSymbol <> nil) and (DbgSymbol.SymbolType = stValue) then
692     Result := DbgSymbol.TypeInfo
693   else
694     Result := nil;
695 end;
696 
TFpDbgValue.GetFieldFlagsnull697 function TFpDbgValue.GetFieldFlags: TFpDbgValueFieldFlags;
698 begin
699   Result := [];
700 end;
701 
GetIndexTypenull702 function TFpDbgValue.GetIndexType(AIndex: Integer): TFpDbgSymbol;
703 begin
704   Result := nil;;
705 end;
706 
TFpDbgValue.GetIndexTypeCountnull707 function TFpDbgValue.GetIndexTypeCount: Integer;
708 begin
709   Result := 0;
710 end;
711 
TFpDbgValue.GetMemberExnull712 function TFpDbgValue.GetMemberEx(const AIndex: array of Int64): TFpDbgValue;
713 begin
714   Result := nil;
715 end;
716 
TFpDbgValue.GetMemberCountExnull717 function TFpDbgValue.GetMemberCountEx(const AIndex: array of Int64): Integer;
718 begin
719   Result := 0;
720 end;
721 
GetAsFloatnull722 function TFpDbgValue.GetAsFloat: Extended;
723 begin
724   Result := 0;
725 end;
726 
GetContextTypeInfonull727 function TFpDbgValue.GetContextTypeInfo: TFpDbgSymbol;
728 begin
729   Result := nil;
730 end;
731 
GetLastErrornull732 function TFpDbgValue.GetLastError: TFpError;
733 begin
734   Result := NoError;
735 end;
736 
TFpDbgValue.GetHasBoundsnull737 function TFpDbgValue.GetHasBounds: Boolean;
738 begin
739   Result := False;
740 end;
741 
TFpDbgValue.GetOrdHighBoundnull742 function TFpDbgValue.GetOrdHighBound: Int64;
743 begin
744   Result := 0;
745 end;
746 
TFpDbgValue.GetOrdLowBoundnull747 function TFpDbgValue.GetOrdLowBound: Int64;
748 begin
749   Result := 0;
750 end;
751 
GetKindnull752 function TFpDbgValue.GetKind: TDbgSymbolKind;
753 begin
754   Result := skNone;
755 end;
756 
TFpDbgValue.GetMembernull757 function TFpDbgValue.GetMember(AIndex: Int64): TFpDbgValue;
758 begin
759   Result := nil;
760 end;
761 
TFpDbgValue.GetMemberByNamenull762 function TFpDbgValue.GetMemberByName(AIndex: String): TFpDbgValue;
763 begin
764   Result := nil;
765 end;
766 
GetMemberCountnull767 function TFpDbgValue.GetMemberCount: Integer;
768 begin
769   Result := 0;
770 end;
771 
TFpDbgValue.GetAddressnull772 function TFpDbgValue.GetAddress: TFpDbgMemLocation;
773 begin
774   Result := InvalidLoc;
775 end;
776 
TFpDbgValue.GetDataAddressnull777 function TFpDbgValue.GetDataAddress: TFpDbgMemLocation;
778 begin
779   Result := Address;
780 end;
781 
GetDataSizenull782 function TFpDbgValue.GetDataSize: Integer;
783 begin
784   Result := Size;
785 end;
786 
TFpDbgValue.GetSizenull787 function TFpDbgValue.GetSize: Integer;
788 begin
789   Result := -1;
790 end;
791 
TFpDbgValue.GetAsBoolnull792 function TFpDbgValue.GetAsBool: Boolean;
793 begin
794   Result := False;
795 end;
796 
TFpDbgValue.GetAsCardinalnull797 function TFpDbgValue.GetAsCardinal: QWord;
798 begin
799   Result := 0;
800 end;
801 
TFpDbgValue.GetAsIntegernull802 function TFpDbgValue.GetAsInteger: Int64;
803 begin
804   Result := 0;
805 end;
806 
807 { TPasParserConstNumberSymbolValue }
808 
GetKindnull809 function TFpDbgValueConstNumber.GetKind: TDbgSymbolKind;
810 begin
811   if FSigned then
812     Result := skInteger
813   else
814     Result := skCardinal;
815 end;
816 
TFpDbgValueConstNumber.GetFieldFlagsnull817 function TFpDbgValueConstNumber.GetFieldFlags: TFpDbgValueFieldFlags;
818 begin
819   if FSigned then
820     Result := [svfOrdinal, svfInteger]
821   else
822     Result := [svfOrdinal, svfCardinal];
823 end;
824 
TFpDbgValueConstNumber.GetAsCardinalnull825 function TFpDbgValueConstNumber.GetAsCardinal: QWord;
826 begin
827   Result := FValue;
828 end;
829 
TFpDbgValueConstNumber.GetAsIntegernull830 function TFpDbgValueConstNumber.GetAsInteger: Int64;
831 begin
832   Result := Int64(FValue);
833 end;
834 
835 constructor TFpDbgValueConstNumber.Create(AValue: QWord; ASigned: Boolean);
836 begin
837   inherited Create;
838   FValue := AValue;
839   FSigned := ASigned;
840 end;
841 
842 { TFpDbgValueConstFloat }
843 
GetKindnull844 function TFpDbgValueConstFloat.GetKind: TDbgSymbolKind;
845 begin
846   Result := skFloat;
847 end;
848 
TFpDbgValueConstFloat.GetFieldFlagsnull849 function TFpDbgValueConstFloat.GetFieldFlags: TFpDbgValueFieldFlags;
850 begin
851   Result := [svfFloat];
852 end;
853 
TFpDbgValueConstFloat.GetAsFloatnull854 function TFpDbgValueConstFloat.GetAsFloat: Extended;
855 begin
856   Result := FValue;
857 end;
858 
859 constructor TFpDbgValueConstFloat.Create(AValue: Extended);
860 begin
861   inherited Create;
862   FValue := AValue;
863 end;
864 
865 { TFpDbgValueConstBool }
866 
GetKindnull867 function TFpDbgValueConstBool.GetKind: TDbgSymbolKind;
868 begin
869   Result := skBoolean;
870 end;
871 
TFpDbgValueConstBool.GetFieldFlagsnull872 function TFpDbgValueConstBool.GetFieldFlags: TFpDbgValueFieldFlags;
873 begin
874   Result := [svfOrdinal, svfBoolean];
875 end;
876 
GetAsBoolnull877 function TFpDbgValueConstBool.GetAsBool: Boolean;
878 begin
879   Result := FValue;
880 end;
881 
TFpDbgValueConstBool.GetAsCardinalnull882 function TFpDbgValueConstBool.GetAsCardinal: QWord;
883 begin
884   if FValue then
885     Result := 1
886   else
887     Result := 0;
888 end;
889 
890 constructor TFpDbgValueConstBool.Create(AValue: Boolean);
891 begin
892   inherited Create;
893   FValue := AValue;
894 end;
895 
896 { TDbgSymbolValueConstAddress }
897 
GetKindnull898 function TFpDbgValueConstAddress.GetKind: TDbgSymbolKind;
899 begin
900   Result := skAddress;
901 end;
902 
TFpDbgValueConstAddress.GetFieldFlagsnull903 function TFpDbgValueConstAddress.GetFieldFlags: TFpDbgValueFieldFlags;
904 begin
905   Result := [svfAddress]
906 end;
907 
GetAddressnull908 function TFpDbgValueConstAddress.GetAddress: TFpDbgMemLocation;
909 begin
910   Result := FAddress;
911 end;
912 
913 constructor TFpDbgValueConstAddress.Create(AnAddress: TFpDbgMemLocation);
914 begin
915   inherited Create;
916   FAddress := AnAddress;
917 end;
918 
919 { TFpDbgValueTypeDeclaration }
920 
GetKindnull921 function TFpDbgValueTypeDefinition.GetKind: TDbgSymbolKind;
922 begin
923   Result := skNone;
924 end;
925 
GetDbgSymbolnull926 function TFpDbgValueTypeDefinition.GetDbgSymbol: TFpDbgSymbol;
927 begin
928   Result := FSymbol;
929 end;
930 
931 constructor TFpDbgValueTypeDefinition.Create(ASymbol: TFpDbgSymbol);
932 begin
933   inherited Create;
934   FSymbol := ASymbol;
935   FSymbol.AddReference{$IFDEF WITH_REFCOUNT_DEBUG}(@FSymbol, 'TFpDbgValueTypeDeclaration'){$ENDIF};
936 end;
937 
938 destructor TFpDbgValueTypeDefinition.Destroy;
939 begin
940   inherited Destroy;
941   FSymbol.ReleaseReference{$IFDEF WITH_REFCOUNT_DEBUG}(@FSymbol, 'TFpDbgValueTypeDeclaration'){$ENDIF};
942 end;
943 
944 { TDbgInfoAddressContext }
945 
TFpDbgInfoContext.GetMemManagernull946 function TFpDbgInfoContext.GetMemManager: TFpDbgMemManager;
947 begin
948   Result := nil;
949 end;
950 
TFpDbgInfoContext.GetProcedureAtAddressnull951 function TFpDbgInfoContext.GetProcedureAtAddress: TFpDbgValue;
952 begin
953   Result := SymbolAtAddress.Value;
954 end;
955 
GetSymbolAtAddressnull956 function TFpDbgInfoContext.GetSymbolAtAddress: TFpDbgSymbol;
957 begin
958   Result := nil;
959 end;
960 
FindSymbolnull961 function TFpDbgInfoContext.FindSymbol(const AName: String): TFpDbgValue;
962 begin
963   Result := nil;
964 end;
965 
966 { TFpDbgSymbol }
967 
968 constructor TFpDbgSymbol.Create(const AName: String);
969 begin
970   inherited Create;
971   AddReference;
972   if AName <> '' then
973     SetName(AName);
974 end;
975 
976 constructor TFpDbgSymbol.Create(const AName: String; AKind: TDbgSymbolKind;
977   AAddress: TFpDbgMemLocation);
978 begin
979   Create(AName);
980   SetKind(AKind);
981   FAddress := AAddress;
982 end;
983 
984 destructor TFpDbgSymbol.Destroy;
985 begin
986   SetTypeInfo(nil);
987   inherited Destroy;
988 end;
989 
TFpDbgSymbol.TypeCastValuenull990 function TFpDbgSymbol.TypeCastValue(AValue: TFpDbgValue): TFpDbgValue;
991 begin
992   Result := nil;
993 end;
994 
GetAddressnull995 function TFpDbgSymbol.GetAddress: TFpDbgMemLocation;
996 begin
997   if not(sfiAddress in FEvaluatedFields) then
998     AddressNeeded;
999   Result := FAddress;
1000 end;
1001 
TFpDbgSymbol.GetTypeInfonull1002 function TFpDbgSymbol.GetTypeInfo: TFpDbgSymbol;
1003 begin
1004   if not(sfiTypeInfo in FEvaluatedFields) then
1005     TypeInfoNeeded;
1006   Result := FTypeInfo;
1007 end;
1008 
GetMemberVisibilitynull1009 function TFpDbgSymbol.GetMemberVisibility: TDbgSymbolMemberVisibility;
1010 begin
1011   if not(sfiMemberVisibility in FEvaluatedFields) then
1012     MemberVisibilityNeeded;
1013   Result := FMemberVisibility;
1014 end;
1015 
GetValueObjectnull1016 function TFpDbgSymbol.GetValueObject: TFpDbgValue;
1017 begin
1018   Result := nil;
1019 end;
1020 
GetKindnull1021 function TFpDbgSymbol.GetKind: TDbgSymbolKind;
1022 begin
1023   if not(sfiKind in FEvaluatedFields) then
1024     KindNeeded;
1025   Result := FKind;
1026 end;
1027 
TFpDbgSymbol.GetNamenull1028 function TFpDbgSymbol.GetName: String;
1029 begin
1030   if not(sfiName in FEvaluatedFields) then
1031     NameNeeded;
1032   Result := FName;
1033 end;
1034 
GetSizenull1035 function TFpDbgSymbol.GetSize: Integer;
1036 begin
1037   if not(sfiSize in FEvaluatedFields) then
1038     SizeNeeded;
1039   Result := FSize;
1040 end;
1041 
GetSymbolTypenull1042 function TFpDbgSymbol.GetSymbolType: TDbgSymbolType;
1043 begin
1044   if not(sfiSymType in FEvaluatedFields) then
1045     SymbolTypeNeeded;
1046   Result := FSymbolType;
1047 end;
1048 
GetLastErrornull1049 function TFpDbgSymbol.GetLastError: TFpError;
1050 begin
1051   Result := FLastError;
1052 end;
1053 
1054 procedure TFpDbgSymbol.SetLastError(AnError: TFpError);
1055 begin
1056   FLastError := AnError;
1057 end;
1058 
TFpDbgSymbol.GetHasBoundsnull1059 function TFpDbgSymbol.GetHasBounds: Boolean;
1060 begin
1061   Result := False;
1062 end;
1063 
TFpDbgSymbol.GetOrdHighBoundnull1064 function TFpDbgSymbol.GetOrdHighBound: Int64;
1065 begin
1066   Result := 0;
1067 end;
1068 
TFpDbgSymbol.GetOrdLowBoundnull1069 function TFpDbgSymbol.GetOrdLowBound: Int64;
1070 begin
1071   Result := 0;
1072 end;
1073 
GetHasOrdinalValuenull1074 function TFpDbgSymbol.GetHasOrdinalValue: Boolean;
1075 begin
1076   Result := False;
1077 end;
1078 
TFpDbgSymbol.GetOrdinalValuenull1079 function TFpDbgSymbol.GetOrdinalValue: Int64;
1080 begin
1081   Result := 0;
1082 end;
1083 
TFpDbgSymbol.GetMembernull1084 function TFpDbgSymbol.GetMember(AIndex: Int64): TFpDbgSymbol;
1085 begin
1086   Result := nil;
1087 end;
1088 
TFpDbgSymbol.GetMemberByNamenull1089 function TFpDbgSymbol.GetMemberByName(AIndex: String): TFpDbgSymbol;
1090 begin
1091   Result := nil;
1092 end;
1093 
GetMemberCountnull1094 function TFpDbgSymbol.GetMemberCount: Integer;
1095 begin
1096   Result := 0;
1097 end;
1098 
1099 procedure TFpDbgSymbol.SetAddress(AValue: TFpDbgMemLocation);
1100 begin
1101   FAddress := AValue;
1102   Include(FEvaluatedFields, sfiAddress);
1103 end;
1104 
1105 procedure TFpDbgSymbol.SetKind(AValue: TDbgSymbolKind);
1106 begin
1107   FKind := AValue;
1108   Include(FEvaluatedFields, sfiKind);
1109 end;
1110 
1111 procedure TFpDbgSymbol.SetSymbolType(AValue: TDbgSymbolType);
1112 begin
1113   FSymbolType := AValue;
1114   Include(FEvaluatedFields, sfiSymType);
1115 end;
1116 
1117 procedure TFpDbgSymbol.SetSize(AValue: Integer);
1118 begin
1119   FSize := AValue;
1120   Include(FEvaluatedFields, sfiSize);
1121 end;
1122 
1123 procedure TFpDbgSymbol.SetTypeInfo(AValue: TFpDbgSymbol);
1124 begin
1125   if FTypeInfo <> nil then begin
1126     //Assert((FTypeInfo.Reference = self) or (FTypeInfo.Reference = nil), 'FTypeInfo.Reference = self|nil');
1127     {$IFDEF WITH_REFCOUNT_DEBUG}FTypeInfo.ReleaseReference(@FTypeInfo, 'SetTypeInfo'); FTypeInfo := nil;{$ENDIF}
1128     ReleaseRefAndNil(FTypeInfo);
1129   end;
1130   FTypeInfo := AValue;
1131   Include(FEvaluatedFields, sfiTypeInfo);
1132   if FTypeInfo <> nil then begin
1133     FTypeInfo.AddReference{$IFDEF WITH_REFCOUNT_DEBUG}(@FTypeInfo, 'SetTypeInfo'){$ENDIF};
1134   end;
1135 end;
1136 
1137 procedure TFpDbgSymbol.SetMemberVisibility(AValue: TDbgSymbolMemberVisibility);
1138 begin
1139   FMemberVisibility := AValue;
1140   Include(FEvaluatedFields, sfiMemberVisibility);
1141 end;
1142 
1143 procedure TFpDbgSymbol.SetName(AValue: String);
1144 begin
1145   FName := AValue;
1146   Include(FEvaluatedFields, sfiName);
1147 end;
1148 
TFpDbgSymbol.GetChildnull1149 function TFpDbgSymbol.GetChild(AIndex: Integer): TFpDbgSymbol;
1150 begin
1151   result := nil;
1152 end;
1153 
GetColumnnull1154 function TFpDbgSymbol.GetColumn: Cardinal;
1155 begin
1156   Result := 0;
1157 end;
1158 
TFpDbgSymbol.GetCountnull1159 function TFpDbgSymbol.GetCount: Integer;
1160 begin
1161   Result := 0;
1162 end;
1163 
GetFilenull1164 function TFpDbgSymbol.GetFile: String;
1165 begin
1166   Result := '';
1167 end;
1168 
TFpDbgSymbol.GetFlagsnull1169 function TFpDbgSymbol.GetFlags: TDbgSymbolFlags;
1170 begin
1171   Result := [];
1172 end;
1173 
GetLinenull1174 function TFpDbgSymbol.GetLine: Cardinal;
1175 begin
1176   Result := 0;
1177 end;
1178 
TFpDbgSymbol.GetParentnull1179 function TFpDbgSymbol.GetParent: TFpDbgSymbol;
1180 begin
1181   Result := nil;
1182 end;
1183 
1184 procedure TFpDbgSymbol.KindNeeded;
1185 begin
1186   SetKind(skNone);
1187 end;
1188 
1189 procedure TFpDbgSymbol.NameNeeded;
1190 begin
1191   SetName('');
1192 end;
1193 
1194 procedure TFpDbgSymbol.SymbolTypeNeeded;
1195 begin
1196   SetSymbolType(stNone);
1197 end;
1198 
1199 procedure TFpDbgSymbol.AddressNeeded;
1200 begin
1201   SetAddress(InvalidLoc);
1202 end;
1203 
1204 procedure TFpDbgSymbol.SizeNeeded;
1205 begin
1206   SetSize(0);
1207 end;
1208 
1209 procedure TFpDbgSymbol.TypeInfoNeeded;
1210 begin
1211   SetTypeInfo(nil);
1212 end;
1213 
1214 procedure TFpDbgSymbol.MemberVisibilityNeeded;
1215 begin
1216   SetMemberVisibility(svPrivate);
1217 end;
1218 
1219 { TDbgSymbolForwarder }
1220 
1221 procedure TDbgSymbolForwarder.SetForwardToSymbol(AValue: TFpDbgSymbol);
1222 begin
1223   FForwardToSymbol := AValue;
1224   EvaluatedFields :=  EvaluatedFields + [sfiForwardToSymbol];
1225 end;
1226 
1227 procedure TDbgSymbolForwarder.ForwardToSymbolNeeded;
1228 begin
1229   SetForwardToSymbol(nil);
1230 end;
1231 
TDbgSymbolForwarder.GetForwardToSymbolnull1232 function TDbgSymbolForwarder.GetForwardToSymbol: TFpDbgSymbol;
1233 begin
1234   if TMethod(@ForwardToSymbolNeeded).Code = Pointer(@TDbgSymbolForwarder.ForwardToSymbolNeeded) then
1235     exit(nil);
1236 
1237   if not(sfiForwardToSymbol in EvaluatedFields) then
1238     ForwardToSymbolNeeded;
1239   Result := FForwardToSymbol;
1240 end;
1241 
TDbgSymbolForwarder.GetLastErrornull1242 function TDbgSymbolForwarder.GetLastError: TFpError;
1243 var
1244   p: TFpDbgSymbol;
1245 begin
1246   Result := inherited GetLastError;
1247   if IsError(Result) then
1248     exit;
1249   p := GetForwardToSymbol;
1250   if p <> nil then
1251     Result := p.LastError;
1252 end;
1253 
1254 procedure TDbgSymbolForwarder.KindNeeded;
1255 var
1256   p: TFpDbgSymbol;
1257 begin
1258   p := GetForwardToSymbol;
1259   if p <> nil then
1260     SetKind(p.Kind)
1261   else
1262     SetKind(skNone);  //  inherited KindNeeded;
1263 end;
1264 
1265 procedure TDbgSymbolForwarder.NameNeeded;
1266 var
1267   p: TFpDbgSymbol;
1268 begin
1269   p := GetForwardToSymbol;
1270   if p <> nil then
1271     SetName(p.Name)
1272   else
1273     SetName('');  //  inherited NameNeeded;
1274 end;
1275 
1276 procedure TDbgSymbolForwarder.SymbolTypeNeeded;
1277 var
1278   p: TFpDbgSymbol;
1279 begin
1280   p := GetForwardToSymbol;
1281   if p <> nil then
1282     SetSymbolType(p.SymbolType)
1283   else
1284     SetSymbolType(stNone);  //  inherited SymbolTypeNeeded;
1285 end;
1286 
1287 procedure TDbgSymbolForwarder.SizeNeeded;
1288 var
1289   p: TFpDbgSymbol;
1290 begin
1291   p := GetForwardToSymbol;
1292   if p <> nil then
1293     SetSize(p.Size)
1294   else
1295     SetSize(0);  //  inherited SizeNeeded;
1296 end;
1297 
1298 procedure TDbgSymbolForwarder.TypeInfoNeeded;
1299 var
1300   p: TFpDbgSymbol;
1301 begin
1302   p := GetForwardToSymbol;
1303   if p <> nil then
1304     SetTypeInfo(p.TypeInfo)
1305   else
1306     SetTypeInfo(nil);  //  inherited TypeInfoNeeded;
1307 end;
1308 
1309 procedure TDbgSymbolForwarder.MemberVisibilityNeeded;
1310 var
1311   p: TFpDbgSymbol;
1312 begin
1313   p := GetForwardToSymbol;
1314   if p <> nil then
1315     SetMemberVisibility(p.MemberVisibility)
1316   else
1317     SetMemberVisibility(svPrivate);  //  inherited MemberVisibilityNeeded;
1318 end;
1319 
GetFlagsnull1320 function TDbgSymbolForwarder.GetFlags: TDbgSymbolFlags;
1321 var
1322   p: TFpDbgSymbol;
1323 begin
1324   p := GetForwardToSymbol;
1325   if p <> nil then
1326     Result := p.Flags
1327   else
1328     Result := [];  //  Result := inherited GetFlags;
1329 end;
1330 
GetValueObjectnull1331 function TDbgSymbolForwarder.GetValueObject: TFpDbgValue;
1332 var
1333   p: TFpDbgSymbol;
1334 begin
1335   p := GetForwardToSymbol;
1336   if p <> nil then
1337     Result := p.Value
1338   else
1339     Result := nil;  //  Result := inherited Value;
1340 end;
1341 
TDbgSymbolForwarder.GetHasOrdinalValuenull1342 function TDbgSymbolForwarder.GetHasOrdinalValue: Boolean;
1343 var
1344   p: TFpDbgSymbol;
1345 begin
1346   p := GetForwardToSymbol;
1347   if p <> nil then
1348     Result := p.HasOrdinalValue
1349   else
1350     Result := False;  //  Result := inherited GetHasOrdinalValue;
1351 end;
1352 
TDbgSymbolForwarder.GetOrdinalValuenull1353 function TDbgSymbolForwarder.GetOrdinalValue: Int64;
1354 var
1355   p: TFpDbgSymbol;
1356 begin
1357   p := GetForwardToSymbol;
1358   if p <> nil then
1359     Result := p.OrdinalValue
1360   else
1361     Result := 0;  //  Result := inherited GetOrdinalValue;
1362 end;
1363 
TDbgSymbolForwarder.GetHasBoundsnull1364 function TDbgSymbolForwarder.GetHasBounds: Boolean;
1365 var
1366   p: TFpDbgSymbol;
1367 begin
1368   p := GetForwardToSymbol;
1369   if p <> nil then
1370     Result := p.HasBounds
1371   else
1372     Result := False;  //  Result := inherited GetHasBounds;
1373 end;
1374 
TDbgSymbolForwarder.GetOrdLowBoundnull1375 function TDbgSymbolForwarder.GetOrdLowBound: Int64;
1376 var
1377   p: TFpDbgSymbol;
1378 begin
1379   p := GetForwardToSymbol;
1380   if p <> nil then
1381     Result := p.OrdLowBound
1382   else
1383     Result := 0;  //  Result := inherited GetOrdLowBound;
1384 end;
1385 
TDbgSymbolForwarder.GetOrdHighBoundnull1386 function TDbgSymbolForwarder.GetOrdHighBound: Int64;
1387 var
1388   p: TFpDbgSymbol;
1389 begin
1390   p := GetForwardToSymbol;
1391   if p <> nil then
1392     Result := p.OrdHighBound
1393   else
1394     Result := 0;  //  Result := inherited GetOrdHighBound;
1395 end;
1396 
TDbgSymbolForwarder.GetMembernull1397 function TDbgSymbolForwarder.GetMember(AIndex: Int64): TFpDbgSymbol;
1398 var
1399   p: TFpDbgSymbol;
1400 begin
1401   p := GetForwardToSymbol;
1402   if p <> nil then
1403     Result := p.Member[AIndex]
1404   else
1405     Result := nil;  //  Result := inherited GetMember(AIndex);
1406 end;
1407 
TDbgSymbolForwarder.GetMemberByNamenull1408 function TDbgSymbolForwarder.GetMemberByName(AIndex: String): TFpDbgSymbol;
1409 var
1410   p: TFpDbgSymbol;
1411 begin
1412   p := GetForwardToSymbol;
1413   if p <> nil then
1414     Result := p.MemberByName[AIndex]
1415   else
1416     Result := nil;  //  Result := inherited GetMemberByName(AIndex);
1417 end;
1418 
GetMemberCountnull1419 function TDbgSymbolForwarder.GetMemberCount: Integer;
1420 var
1421   p: TFpDbgSymbol;
1422 begin
1423   p := GetForwardToSymbol;
1424   if p <> nil then
1425     Result := p.MemberCount
1426   else
1427     Result := 0;  //  Result := inherited GetMemberCount;
1428 end;
1429 
1430 { TDbgInfo }
1431 
1432 constructor TDbgInfo.Create(ALoaderList: TDbgImageLoaderList);
1433 begin
1434   inherited Create;
1435 end;
1436 
FindContextnull1437 function TDbgInfo.FindContext(AThreadId, AStackFrame: Integer;
1438   AAddress: TDbgPtr): TFpDbgInfoContext;
1439 begin
1440   Result := nil;;
1441 end;
1442 
FindContextnull1443 function TDbgInfo.FindContext(AAddress: TDbgPtr): TFpDbgInfoContext;
1444 begin
1445   Result := nil;
1446 end;
1447 
FindSymbolnull1448 function TDbgInfo.FindSymbol(const AName: String): TFpDbgSymbol;
1449 begin
1450   Result := nil;
1451 end;
1452 
FindSymbolnull1453 function TDbgInfo.FindSymbol(AAddress: TDbgPtr): TFpDbgSymbol;
1454 begin
1455   Result := nil;
1456 end;
1457 
GetLineAddressesnull1458 function TDbgInfo.GetLineAddresses(const AFileName: String; ALine: Cardinal;
1459   var AResultList: TDBGPtrArray): Boolean;
1460 begin
1461   Result := False;
1462 end;
1463 
1464 procedure TDbgInfo.SetHasInfo;
1465 begin
1466   FHasInfo := True;
1467 end;
1468 
1469 end.
1470 
1471