mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 22:19:18 +02:00
FPGDBMIDebug: Value handling / more typecasts
git-svn-id: trunk@43937 -
This commit is contained in:
parent
f170d5d55a
commit
36f4de257b
@ -13,19 +13,6 @@ type
|
|||||||
|
|
||||||
TFpGDBMIDebugger = class;
|
TFpGDBMIDebugger = class;
|
||||||
|
|
||||||
{ TFpGDBMIPascalExpression }
|
|
||||||
|
|
||||||
TFpGDBMIPascalExpression = class(TFpPascalExpression)
|
|
||||||
private
|
|
||||||
FThreadId: Integer;
|
|
||||||
FStackFrame: Integer;
|
|
||||||
FDebugger: TFpGDBMIDebugger;
|
|
||||||
protected
|
|
||||||
function GetDbgSymbolForIdentifier(AnIdent: String): TDbgSymbol; override;
|
|
||||||
public
|
|
||||||
constructor Create(ATextExpression: String; ADebugger: TFpGDBMIDebugger; AThreadId, AStackFrame: Integer);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TFpGDBMIDbgMemReader }
|
{ TFpGDBMIDbgMemReader }
|
||||||
|
|
||||||
TFpGDBMIDbgMemReader = class(TFpDbgMemReaderBase)
|
TFpGDBMIDbgMemReader = class(TFpDbgMemReaderBase)
|
||||||
@ -214,35 +201,6 @@ debugln(['TFpGDBMIDbgMemReader.ReadRegister ',rname, ' ', v]);
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFpGDBMIPascalExpression }
|
|
||||||
|
|
||||||
function TFpGDBMIPascalExpression.GetDbgSymbolForIdentifier(AnIdent: String): TDbgSymbol;
|
|
||||||
var
|
|
||||||
Loc: TDBGPtr;
|
|
||||||
Ctx: TDbgInfoAddressContext;
|
|
||||||
begin
|
|
||||||
Result := nil;
|
|
||||||
if (AnIdent <> '') and FDebugger.HasDwarf then begin
|
|
||||||
//Loc := FDebugger.GetLocationForContext(FThreadId, FStackFrame);
|
|
||||||
//if (Loc <> 0) then begin
|
|
||||||
Ctx := FDebugger.GetInfoContextForContext(FThreadId, FStackFrame);
|
|
||||||
//Ctx := FDebugger.FDwarfInfo.FindContext(Loc);
|
|
||||||
if Ctx <> nil then
|
|
||||||
Result := Ctx.FindSymbol(AnIdent);
|
|
||||||
//Ctx.ReleaseReference;
|
|
||||||
//end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
constructor TFpGDBMIPascalExpression.Create(ATextExpression: String;
|
|
||||||
ADebugger: TFpGDBMIDebugger; AThreadId, AStackFrame: Integer);
|
|
||||||
begin
|
|
||||||
FDebugger := ADebugger;
|
|
||||||
FThreadId := AStackFrame;
|
|
||||||
FStackFrame := AStackFrame;
|
|
||||||
inherited Create(ATextExpression);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TFpGDBPTypeRequestCache }
|
{ TFpGDBPTypeRequestCache }
|
||||||
|
|
||||||
constructor TFpGDBPTypeRequestCache.Create(ADebugger: TFpGDBMIDebugger);
|
constructor TFpGDBPTypeRequestCache.Create(ADebugger: TFpGDBMIDebugger);
|
||||||
@ -673,8 +631,9 @@ const
|
|||||||
|
|
||||||
var
|
var
|
||||||
IdentName: String;
|
IdentName: String;
|
||||||
PasExpr: TFpGDBMIPascalExpression;
|
PasExpr: TFpPascalExpression;
|
||||||
rt: TDbgSymbol;
|
rt: TDbgSymbol;
|
||||||
|
Ctx: TDbgInfoAddressContext;
|
||||||
begin
|
begin
|
||||||
Result := inherited IndexOf(AThreadId, AStackFrame, ARequest);
|
Result := inherited IndexOf(AThreadId, AStackFrame, ARequest);
|
||||||
DebugLn(['######## '+ARequest.Request, ' ## FOUND: ', dbgs(Result)]);
|
DebugLn(['######## '+ARequest.Request, ' ## FOUND: ', dbgs(Result)]);
|
||||||
@ -684,6 +643,7 @@ DebugLn(['######## '+ARequest.Request, ' ## FOUND: ', dbgs(Result)]);
|
|||||||
|
|
||||||
FInIndexOf := True;
|
FInIndexOf := True;
|
||||||
PasExpr := nil;
|
PasExpr := nil;
|
||||||
|
Ctx := nil;
|
||||||
try
|
try
|
||||||
if (ARequest.ReqType = gcrtPType) and (length(ARequest.Request) > 0) then begin
|
if (ARequest.ReqType = gcrtPType) and (length(ARequest.Request) > 0) then begin
|
||||||
//DebugLn('######## '+ARequest.Request);
|
//DebugLn('######## '+ARequest.Request);
|
||||||
@ -695,7 +655,8 @@ DebugLn(['######## '+ARequest.Request, ' ## FOUND: ', dbgs(Result)]);
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
if IdentName <> '' then begin
|
if IdentName <> '' then begin
|
||||||
PasExpr := TFpGDBMIPascalExpression.Create(IdentName, FDebugger, AThreadId, AStackFrame);
|
Ctx := FDebugger.GetInfoContextForContext(AThreadId, AStackFrame);
|
||||||
|
PasExpr := TFpPascalExpression.Create(IdentName, Ctx);
|
||||||
rt := nil;
|
rt := nil;
|
||||||
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
|
||||||
@ -721,6 +682,7 @@ if PasExpr.ResultValue <> nil then
|
|||||||
|
|
||||||
finally
|
finally
|
||||||
PasExpr.Free;
|
PasExpr.Free;
|
||||||
|
Ctx.Free;
|
||||||
FInIndexOf := False;
|
FInIndexOf := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -976,7 +938,7 @@ begin
|
|||||||
(FLastContext[AStackFrame - FlastStackFrame] <> nil) and
|
(FLastContext[AStackFrame - FlastStackFrame] <> nil) and
|
||||||
(FLastContext[AStackFrame - FlastStackFrame].Address = Addr)
|
(FLastContext[AStackFrame - FlastStackFrame].Address = Addr)
|
||||||
then begin
|
then begin
|
||||||
DebugLn('cached contex');
|
DebugLn('******* cached contex <<<<<<<<<<<');
|
||||||
Result := FLastContext[AStackFrame - FlastStackFrame];
|
Result := FLastContext[AStackFrame - FlastStackFrame];
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user