mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 14:09:31 +02:00
FpDebug: Search for line-information not only within the executable, but also in the loaded libraries
This commit is contained in:
parent
9877946d86
commit
f073c52428
@ -469,6 +469,12 @@ type
|
|||||||
constructor Create(const AProcess: TDbgProcess); virtual;
|
constructor Create(const AProcess: TDbgProcess); virtual;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
|
// Returns the addresses at the given source-filename and line-number.
|
||||||
|
// Searches the program and all libraries. This can lead to multiple hits,
|
||||||
|
// as the application and libraries can share sourcecode but have their own
|
||||||
|
// binary code.
|
||||||
|
function GetLineAddresses(AFileName: String; ALine: Cardinal; var AResultList: TDBGPtrArray): Boolean; virtual;
|
||||||
|
|
||||||
function AddBreak(const AFileName: String; ALine: Cardinal; AnEnabled: Boolean = True): TFpInternalBreakpoint; overload;
|
function AddBreak(const AFileName: String; ALine: Cardinal; AnEnabled: Boolean = True): TFpInternalBreakpoint; overload;
|
||||||
function AddBreak(const AFuncName: String; AnEnabled: Boolean = True): TFpDbgBreakpoint; overload;
|
function AddBreak(const AFuncName: String; AnEnabled: Boolean = True): TFpDbgBreakpoint; overload;
|
||||||
function AddrOffset: TDBGPtr; virtual; // gives the offset between the loaded addresses and the compiled addresses
|
function AddrOffset: TDBGPtr; virtual; // gives the offset between the loaded addresses and the compiled addresses
|
||||||
@ -637,6 +643,7 @@ type
|
|||||||
function FindSymbolScope(AThreadId, AStackFrame: Integer): TFpDbgSymbolScope;
|
function FindSymbolScope(AThreadId, AStackFrame: Integer): TFpDbgSymbolScope;
|
||||||
function FindProcStartEndPC(const AAdress: TDbgPtr; out AStartPC, AEndPC: TDBGPtr): boolean;
|
function FindProcStartEndPC(const AAdress: TDbgPtr; out AStartPC, AEndPC: TDBGPtr): boolean;
|
||||||
|
|
||||||
|
function GetLineAddresses(AFileName: String; ALine: Cardinal; var AResultList: TDBGPtrArray): Boolean; override;
|
||||||
function ContextFromProc(AThreadId, AStackFrame: Integer; AProcSym: TFpSymbol): TFpDbgLocationContext; inline; deprecated 'use TFpDbgSimpleLocationContext.Create';
|
function ContextFromProc(AThreadId, AStackFrame: Integer; AProcSym: TFpSymbol): TFpDbgLocationContext; inline; deprecated 'use TFpDbgSimpleLocationContext.Create';
|
||||||
function GetLib(const AHandle: THandle; out ALib: TDbgLibrary): Boolean;
|
function GetLib(const AHandle: THandle; out ALib: TDbgLibrary): Boolean;
|
||||||
property LastLibrariesLoaded: TDbgLibraryArr read GetLastLibrariesLoaded;
|
property LastLibrariesLoaded: TDbgLibraryArr read GetLastLibrariesLoaded;
|
||||||
@ -1603,8 +1610,7 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
if not FDbgInfo.HasInfo then Exit;
|
if GetLineAddresses(AFileName, ALine, addr) then begin
|
||||||
if FDbgInfo.GetLineAddresses(AFileName, ALine, addr) then begin
|
|
||||||
o := AddrOffset;
|
o := AddrOffset;
|
||||||
for i := 0 to High(addr) do
|
for i := 0 to High(addr) do
|
||||||
addr[i] := addr[i] - o;
|
addr[i] := addr[i] - o;
|
||||||
@ -1657,6 +1663,14 @@ begin
|
|||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TDbgInstance.GetLineAddresses(AFileName: String; ALine: Cardinal; var AResultList: TDBGPtrArray): Boolean;
|
||||||
|
begin
|
||||||
|
if Assigned(DbgInfo) and DbgInfo.HasInfo then
|
||||||
|
Result := DbgInfo.GetLineAddresses(AFileName, ALine, AResultList)
|
||||||
|
else
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
function TDbgInstance.FindProcSymbol(AAdress: TDbgPtr): TFpSymbol;
|
function TDbgInstance.FindProcSymbol(AAdress: TDbgPtr): TFpSymbol;
|
||||||
begin
|
begin
|
||||||
{$PUSH}{$R-}{$Q-}
|
{$PUSH}{$R-}{$Q-}
|
||||||
@ -1953,6 +1967,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TDbgProcess.GetLineAddresses(AFileName: String; ALine: Cardinal; var AResultList: TDBGPtrArray): Boolean;
|
||||||
|
var
|
||||||
|
Iterator: TMapIterator;
|
||||||
|
Lib: TDbgLibrary;
|
||||||
|
begin
|
||||||
|
Result := inherited;
|
||||||
|
|
||||||
|
Iterator := TMapIterator.Create(FLibMap);
|
||||||
|
while not Iterator.EOM do
|
||||||
|
begin
|
||||||
|
Iterator.GetData(Lib);
|
||||||
|
if Lib.GetLineAddresses(AFileName, ALine, AResultList) then
|
||||||
|
Result := True;
|
||||||
|
Iterator.Next;
|
||||||
|
end;
|
||||||
|
Iterator.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
function TDbgProcess.ContextFromProc(AThreadId, AStackFrame: Integer;
|
function TDbgProcess.ContextFromProc(AThreadId, AStackFrame: Integer;
|
||||||
AProcSym: TFpSymbol): TFpDbgLocationContext;
|
AProcSym: TFpSymbol): TFpDbgLocationContext;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user