diff --git a/components/fpdebug/fpdbgclasses.pp b/components/fpdebug/fpdbgclasses.pp index c60cbda782..fd003ec5c7 100644 --- a/components/fpdebug/fpdbgclasses.pp +++ b/components/fpdebug/fpdbgclasses.pp @@ -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 diff --git a/components/fpdebug/fpdbgdwarf.pas b/components/fpdebug/fpdbgdwarf.pas index f378c24a3c..83fb0c132d 100644 --- a/components/fpdebug/fpdbgdwarf.pas +++ b/components/fpdebug/fpdbgdwarf.pas @@ -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');