FpDebug: FPC sets some lines to line-num=0 => map them to the next avail line. This will at least be somewhere around the correct location.

git-svn-id: trunk@62337 -
This commit is contained in:
martin 2019-12-08 00:18:05 +00:00
parent f64a5f7d3b
commit 2dd36b3cd8
2 changed files with 36 additions and 6 deletions

View File

@ -1876,6 +1876,7 @@ end;
function TDbgThread.CompareStepInfo(AnAddr: TDBGPtr): TFPDCompareStepInfo;
var
Sym: TFpSymbol;
l: TDBGPtr;
begin
if FStoreStepSrcLineNo = -1 then begin // stepping from location with no line info
Result := dcsiNewLine;
@ -1887,12 +1888,16 @@ begin
sym := FProcess.FindProcSymbol(AnAddr);
if assigned(sym) then
begin
debugln(FPDBG_COMMANDS, ['CompareStepInfo @IP=',AnAddr,' ',sym.FileName, ':',sym.Line, ' in ',sym.Name, ' @Func=',sym.Address.Address]);
if (((FStoreStepSrcFilename=sym.FileName) and (FStoreStepSrcLineNo=sym.Line)) {or FStepOut}) then
if sym is TFpSymbolDwarfDataProc then
l := TFpSymbolDwarfDataProc(sym).LineUnfixed
else
l := Sym.Line;
debugln(FPDBG_COMMANDS, ['CompareStepInfo @IP=',AnAddr,' ',sym.FileName, ':',l, ' in ',sym.Name, ' @Func=',sym.Address.Address]);
if (((FStoreStepSrcFilename=sym.FileName) and (FStoreStepSrcLineNo=l)) {or FStepOut}) then
result := dcsiSameLine
else if sym.FileName = '' then
result := dcsiNoLineInfo
else if sym.Line = 0 then
else if l = 0 then
result := dcsiZeroLine
else
result := dcsiNewLine;
@ -1935,10 +1940,14 @@ begin
sym := FProcess.FindProcSymbol(AnAddr);
if assigned(sym) then
begin
debugln(FPDBG_COMMANDS, ['StoreStepInfo @IP=',AnAddr,' ',sym.FileName, ':',sym.Line, ' in ',sym.Name, ' @Func=',sym.Address.Address]);
FStoreStepSrcFilename:=sym.FileName;
FStoreStepSrcLineNo:=sym.Line;
FStoreStepFuncAddr:=sym.Address.Address;
if sym is TFpSymbolDwarfDataProc then begin
FStoreStepSrcLineNo := TFpSymbolDwarfDataProc(sym).LineUnfixed;
end
else
FStoreStepSrcLineNo:=sym.Line;
debugln(FPDBG_COMMANDS, ['StoreStepInfo @IP=',AnAddr,' ',sym.FileName, ':',FStoreStepSrcLineNo, ' in ',sym.Name, ' @Func=',sym.Address.Address]);
sym.ReleaseReference;
end
else begin

View File

@ -896,6 +896,7 @@ DECL = DW_AT_decl_column, DW_AT_decl_file, DW_AT_decl_line
FAddressInfo: PDwarfAddressInfo;
FStateMachine: TDwarfLineInfoStateMachine;
FFrameBaseParser: TDwarfLocationExpression;
function GetLineUnfixed: TDBGPtr;
function StateMachineValid: Boolean;
function ReadVirtuality(out AFlags: TDbgSymbolFlags): Boolean;
protected
@ -916,6 +917,7 @@ DECL = DW_AT_decl_column, DW_AT_decl_file, DW_AT_decl_line
function CreateContext(AThreadId, AStackFrame: Integer; ADwarfInfo: TFpDwarfInfo): TFpDbgInfoContext; override;
// TODO members = locals ?
function GetSelfParameter(AnAddress: TDbgPtr = 0): TFpValueDwarf;
property LineUnfixed: TDBGPtr read GetLineUnfixed; // with 0 lines
end;
{ TFpSymbolDwarfTypeProc }
@ -5091,12 +5093,31 @@ begin
end;
function TFpSymbolDwarfDataProc.GetLine: Cardinal;
var
sm: TDwarfLineInfoStateMachine;
begin
if StateMachineValid
then Result := FStateMachine.Line
then begin
Result := FStateMachine.Line;
if Result = 0 then begin // TODO: fpc specific.
sm := FStateMachine.Clone;
sm.NextLine;
Result := sm.Line;
sm.Free;
end;
end
else Result := inherited GetLine;
end;
function TFpSymbolDwarfDataProc.GetLineUnfixed: TDBGPtr;
begin
if StateMachineValid
then
Result := FStateMachine.Line
else
Result := inherited GetLine;
end;
function TFpSymbolDwarfDataProc.GetValueObject: TFpValue;
begin
assert(TypeInfo is TFpSymbolDwarfType, 'TFpSymbolDwarfDataProc.GetValueObject: TypeInfo is TFpSymbolDwarfType');