mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-08 20:39:30 +02:00
FpDebug: find symbol for fpc_raiseexception (and similar) independent of case.
This commit is contained in:
parent
ebd45b7c62
commit
5efaac3f2f
@ -549,7 +549,7 @@ type
|
|||||||
procedure UpdateState; override;
|
procedure UpdateState; override;
|
||||||
procedure UpdateForLibraryLoaded(ALib: TDbgLibrary); override;
|
procedure UpdateForLibraryLoaded(ALib: TDbgLibrary); override;
|
||||||
public
|
public
|
||||||
constructor Create(const AProcess: TDbgProcess; const AFuncName: String; AnEnabled: Boolean; ASymInstance: TDbgInstance = nil); virtual;
|
constructor Create(const AProcess: TDbgProcess; const AFuncName: String; AnEnabled: Boolean; ASymInstance: TDbgInstance = nil; AIgnoreCase: Boolean = False); virtual;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFpInternalBreakpointAtFileLine }
|
{ TFpInternalBreakpointAtFileLine }
|
||||||
@ -614,7 +614,7 @@ type
|
|||||||
function GetPointerSize: Integer;
|
function GetPointerSize: Integer;
|
||||||
|
|
||||||
function GetLineAddresses(AFileName: String; ALine: Cardinal; var AResultList: TDBGPtrArray): Boolean;
|
function GetLineAddresses(AFileName: String; ALine: Cardinal; var AResultList: TDBGPtrArray): Boolean;
|
||||||
function FindProcSymbol(const AName: String): TFpSymbol; overload;
|
function FindProcSymbol(const AName: String; AIgnoreCase: Boolean = False): TFpSymbol; overload;
|
||||||
function FindProcSymbol(AAdress: TDbgPtr): TFpSymbol; overload;
|
function FindProcSymbol(AAdress: TDbgPtr): TFpSymbol; overload;
|
||||||
protected
|
protected
|
||||||
FDbgInfo: TDbgInfo;
|
FDbgInfo: TDbgInfo;
|
||||||
@ -793,7 +793,7 @@ type
|
|||||||
function AddBreak(const ALocation: TDBGPtr; AnEnabled: Boolean = True): TFpDbgBreakpoint; overload;
|
function AddBreak(const ALocation: TDBGPtr; AnEnabled: Boolean = True): TFpDbgBreakpoint; overload;
|
||||||
function AddBreak(const ALocation: TDBGPtrArray; AnEnabled: Boolean = True): TFpDbgBreakpoint; overload;
|
function AddBreak(const ALocation: TDBGPtrArray; AnEnabled: Boolean = True): TFpDbgBreakpoint; overload;
|
||||||
function AddBreak(const AFileName: String; ALine: Cardinal; AnEnabled: Boolean = True; ASymInstance: TDbgInstance = nil): TFpDbgBreakpoint; overload;
|
function AddBreak(const AFileName: String; ALine: Cardinal; AnEnabled: Boolean = True; ASymInstance: TDbgInstance = nil): TFpDbgBreakpoint; overload;
|
||||||
function AddBreak(const AFuncName: String; AnEnabled: Boolean = True; ASymInstance: TDbgInstance = nil): TFpDbgBreakpoint; overload;
|
function AddBreak(const AFuncName: String; AnEnabled: Boolean = True; ASymInstance: TDbgInstance = nil; AIgnoreCase: Boolean = False): TFpDbgBreakpoint; overload;
|
||||||
function AddWatch(const ALocation: TDBGPtr; ASize: Cardinal; AReadWrite: TDBGWatchPointKind;
|
function AddWatch(const ALocation: TDBGPtr; ASize: Cardinal; AReadWrite: TDBGWatchPointKind;
|
||||||
AScope: TDBGWatchPointScope): TFpInternalWatchpoint;
|
AScope: TDBGWatchPointScope): TFpInternalWatchpoint;
|
||||||
property WatchPointData: TFpWatchPointData read FWatchPointData;
|
property WatchPointData: TFpWatchPointData read FWatchPointData;
|
||||||
@ -807,7 +807,7 @@ type
|
|||||||
*)
|
*)
|
||||||
function FindProcSymbol(const AName: String): TFpSymbol; overload; // deprecated 'backward compatible / use FindProcSymbol(AName, TheDbgProcess)';
|
function FindProcSymbol(const AName: String): TFpSymbol; overload; // deprecated 'backward compatible / use FindProcSymbol(AName, TheDbgProcess)';
|
||||||
function FindProcSymbol(const AName: String; ASymInstance: TDbgInstance): TFpSymbol; overload;
|
function FindProcSymbol(const AName: String; ASymInstance: TDbgInstance): TFpSymbol; overload;
|
||||||
procedure FindProcSymbol(const AName: String; ASymInstance: TDbgInstance; out ASymList: TFpSymbolArray);
|
procedure FindProcSymbol(const AName: String; ASymInstance: TDbgInstance; out ASymList: TFpSymbolArray; AIgnoreCase: Boolean = False);
|
||||||
function FindProcSymbol(const AName, ALibraryName: String; IsFullLibName: Boolean = True): TFpSymbol; overload;
|
function FindProcSymbol(const AName, ALibraryName: String; IsFullLibName: Boolean = True): TFpSymbol; overload;
|
||||||
function FindProcSymbol(AAdress: TDbgPtr): TFpSymbol; overload;
|
function FindProcSymbol(AAdress: TDbgPtr): TFpSymbol; overload;
|
||||||
function FindSymbolScope(AThreadId, AStackFrame: Integer): TFpDbgSymbolScope;
|
function FindSymbolScope(AThreadId, AStackFrame: Integer): TFpDbgSymbolScope;
|
||||||
@ -1936,14 +1936,15 @@ end;
|
|||||||
{ TDbgInstance }
|
{ TDbgInstance }
|
||||||
|
|
||||||
|
|
||||||
function TDbgInstance.FindProcSymbol(const AName: String): TFpSymbol;
|
function TDbgInstance.FindProcSymbol(const AName: String; AIgnoreCase: Boolean
|
||||||
|
): TFpSymbol;
|
||||||
begin
|
begin
|
||||||
if FDbgInfo <> nil then
|
if FDbgInfo <> nil then
|
||||||
Result := FDbgInfo.FindProcSymbol(AName)
|
Result := FDbgInfo.FindProcSymbol(AName)
|
||||||
else
|
else
|
||||||
Result := nil;
|
Result := nil;
|
||||||
if (Result = nil) and (SymbolTableInfo <> nil) then
|
if (Result = nil) and (SymbolTableInfo <> nil) then
|
||||||
Result := SymbolTableInfo.FindProcSymbol(AName);
|
Result := SymbolTableInfo.FindProcSymbol(AName, AIgnoreCase);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TDbgInstance.Create(const AProcess: TDbgProcess);
|
constructor TDbgInstance.Create(const AProcess: TDbgProcess);
|
||||||
@ -2092,9 +2093,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TDbgProcess.AddBreak(const AFuncName: String; AnEnabled: Boolean;
|
function TDbgProcess.AddBreak(const AFuncName: String; AnEnabled: Boolean;
|
||||||
ASymInstance: TDbgInstance): TFpDbgBreakpoint;
|
ASymInstance: TDbgInstance; AIgnoreCase: Boolean): TFpDbgBreakpoint;
|
||||||
begin
|
begin
|
||||||
Result := TFpInternalBreakpointAtSymbol.Create(Self, AFuncName, AnEnabled, ASymInstance);
|
Result := TFpInternalBreakpointAtSymbol.Create(Self, AFuncName, AnEnabled, ASymInstance, AIgnoreCase);
|
||||||
AfterBreakpointAdded(Result);
|
AfterBreakpointAdded(Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2126,7 +2127,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDbgProcess.FindProcSymbol(const AName: String;
|
procedure TDbgProcess.FindProcSymbol(const AName: String;
|
||||||
ASymInstance: TDbgInstance; out ASymList: TFpSymbolArray);
|
ASymInstance: TDbgInstance; out ASymList: TFpSymbolArray; AIgnoreCase: Boolean
|
||||||
|
);
|
||||||
var
|
var
|
||||||
Lib: TDbgLibrary;
|
Lib: TDbgLibrary;
|
||||||
Sym: TFpSymbol;
|
Sym: TFpSymbol;
|
||||||
@ -2134,21 +2136,21 @@ begin
|
|||||||
// TODO: find multiple symbols within the same DbgInfo
|
// TODO: find multiple symbols within the same DbgInfo
|
||||||
ASymList := nil;
|
ASymList := nil;
|
||||||
if ASymInstance <> nil then begin
|
if ASymInstance <> nil then begin
|
||||||
Sym := ASymInstance.FindProcSymbol(AName);
|
Sym := ASymInstance.FindProcSymbol(AName, AIgnoreCase);
|
||||||
if Sym <> nil then begin
|
if Sym <> nil then begin
|
||||||
SetLength(ASymList, 1);
|
SetLength(ASymList, 1);
|
||||||
ASymList[0] := Sym;
|
ASymList[0] := Sym;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
Sym := FindProcSymbol(AName);
|
Sym := FindProcSymbol(AName, AIgnoreCase);
|
||||||
if Sym <> nil then begin
|
if Sym <> nil then begin
|
||||||
SetLength(ASymList, 1);
|
SetLength(ASymList, 1);
|
||||||
ASymList[0] := Sym;
|
ASymList[0] := Sym;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
for Lib in FLibMap do begin
|
for Lib in FLibMap do begin
|
||||||
Sym := Lib.FindProcSymbol(AName);
|
Sym := Lib.FindProcSymbol(AName, AIgnoreCase);
|
||||||
if Sym <> nil then begin
|
if Sym <> nil then begin
|
||||||
SetLength(ASymList, 1);
|
SetLength(ASymList, 1);
|
||||||
ASymList[0] := Sym;
|
ASymList[0] := Sym;
|
||||||
@ -3887,7 +3889,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TFpInternalBreakpointAtSymbol.Create(const AProcess: TDbgProcess;
|
constructor TFpInternalBreakpointAtSymbol.Create(const AProcess: TDbgProcess;
|
||||||
const AFuncName: String; AnEnabled: Boolean; ASymInstance: TDbgInstance);
|
const AFuncName: String; AnEnabled: Boolean; ASymInstance: TDbgInstance;
|
||||||
|
AIgnoreCase: Boolean);
|
||||||
var
|
var
|
||||||
a: TDBGPtrArray;
|
a: TDBGPtrArray;
|
||||||
AProcList: TFpSymbolArray;
|
AProcList: TFpSymbolArray;
|
||||||
@ -3896,7 +3899,7 @@ begin
|
|||||||
FFuncName := AFuncName;
|
FFuncName := AFuncName;
|
||||||
FSymInstance := ASymInstance;
|
FSymInstance := ASymInstance;
|
||||||
|
|
||||||
AProcess.FindProcSymbol(AFuncName, ASymInstance, AProcList);
|
AProcess.FindProcSymbol(AFuncName, ASymInstance, AProcList, AIgnoreCase);
|
||||||
SetLength(a, Length(AProcList));
|
SetLength(a, Length(AProcList));
|
||||||
for i := 0 to Length(AProcList) - 1 do begin
|
for i := 0 to Length(AProcList) - 1 do begin
|
||||||
a[i] := AProcList[i].Address.Address;
|
a[i] := AProcList[i].Address.Address;
|
||||||
|
@ -690,7 +690,7 @@ type
|
|||||||
*)
|
*)
|
||||||
function FindSymbolScope(ALocationContext: TFpDbgLocationContext; {%H-}AAddress: TDbgPtr = 0): TFpDbgSymbolScope; virtual;
|
function FindSymbolScope(ALocationContext: TFpDbgLocationContext; {%H-}AAddress: TDbgPtr = 0): TFpDbgSymbolScope; virtual;
|
||||||
function FindProcSymbol(AAddress: TDbgPtr): TFpSymbol; virtual; overload;
|
function FindProcSymbol(AAddress: TDbgPtr): TFpSymbol; virtual; overload;
|
||||||
function FindProcSymbol(const {%H-}AName: String): TFpSymbol; virtual; overload;
|
function FindProcSymbol(const {%H-}AName: String; AIgnoreCase: Boolean = False): TFpSymbol; virtual; overload;
|
||||||
function FindLineInfo(AAddress: TDbgPtr): TFpSymbol; virtual;
|
function FindLineInfo(AAddress: TDbgPtr): TFpSymbol; virtual;
|
||||||
|
|
||||||
function FindProcStartEndPC(const AAddress: TDbgPtr; out AStartPC, AEndPC: TDBGPtr): boolean; virtual;
|
function FindProcStartEndPC(const AAddress: TDbgPtr; out AStartPC, AEndPC: TDBGPtr): boolean; virtual;
|
||||||
@ -2115,7 +2115,8 @@ begin
|
|||||||
Result := nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDbgInfo.FindProcSymbol(const AName: String): TFpSymbol;
|
function TDbgInfo.FindProcSymbol(const AName: String; AIgnoreCase: Boolean
|
||||||
|
): TFpSymbol;
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
@ -61,7 +61,7 @@ type
|
|||||||
constructor Create(ALoaderList: TDbgImageLoaderList; AMemManager: TFpDbgMemManager; ALibName: String);
|
constructor Create(ALoaderList: TDbgImageLoaderList; AMemManager: TFpDbgMemManager; ALibName: String);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function FindSymbolScope(ALocationContext: TFpDbgLocationContext; AAddress: TDbgPtr = 0): TFpDbgSymbolScope; override;
|
function FindSymbolScope(ALocationContext: TFpDbgLocationContext; AAddress: TDbgPtr = 0): TFpDbgSymbolScope; override;
|
||||||
function FindProcSymbol(const AName: String): TFpSymbol; override; overload;
|
function FindProcSymbol(const AName: String; AIgnoreCase: Boolean = False): TFpSymbol; override; overload;
|
||||||
function FindProcSymbol(AnAdress: TDbgPtr): TFpSymbol; overload;
|
function FindProcSymbol(AnAdress: TDbgPtr): TFpSymbol; overload;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -195,11 +195,23 @@ begin
|
|||||||
Result := TFpSymbolContext.Create(ALocationContext, Self);
|
Result := TFpSymbolContext.Create(ALocationContext, Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFpSymbolInfo.FindProcSymbol(const AName: String): TFpSymbol;
|
function TFpSymbolInfo.FindProcSymbol(const AName: String; AIgnoreCase: Boolean
|
||||||
|
): TFpSymbol;
|
||||||
var
|
var
|
||||||
|
s: String;
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
i := FSymbolList.IndexOf(AName);
|
if AIgnoreCase then begin
|
||||||
|
s := UpperCase(AName);
|
||||||
|
i := FSymbolList.Count - 1;
|
||||||
|
while i >= 0 do begin
|
||||||
|
if UpperCase(FSymbolList.Keys[i]) = s then
|
||||||
|
break;
|
||||||
|
dec(i);
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
i := FSymbolList.IndexOf(AName);
|
||||||
if i >= 0 then
|
if i >= 0 then
|
||||||
Result := TFpSymbolTableProc.Create(AName, FSymbolList.DataPtr[i]^.Addr)
|
Result := TFpSymbolTableProc.Create(AName, FSymbolList.DataPtr[i]^.Addr)
|
||||||
else
|
else
|
||||||
|
@ -4364,7 +4364,7 @@ end;
|
|||||||
|
|
||||||
procedure TFpDebugDebugger.DoAddBreakFuncLib;
|
procedure TFpDebugDebugger.DoAddBreakFuncLib;
|
||||||
begin
|
begin
|
||||||
FCacheBreakpoint := FDbgController.CurrentProcess.AddBreak(FCacheFileName, FCacheBoolean, FCacheLib);
|
FCacheBreakpoint := FDbgController.CurrentProcess.AddBreak(FCacheFileName, FCacheBoolean, FCacheLib, True);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFpDebugDebugger.DoAddBreakLocation;
|
procedure TFpDebugDebugger.DoAddBreakLocation;
|
||||||
|
Loading…
Reference in New Issue
Block a user