diff --git a/Source/uPSDebugger.pas b/Source/uPSDebugger.pas index 2c40d503..d050bfd6 100644 --- a/Source/uPSDebugger.pas +++ b/Source/uPSDebugger.pas @@ -38,6 +38,12 @@ TPSCustomDebugExec = class(TPSExec) function TranslatePosition(Proc, Position: Cardinal): Cardinal; function TranslatePositionEx(Proc, Position: Cardinal; var Pos, Row, Col: Cardinal; var Fn: tbtstring): Boolean; + + { True when any opcode of any procedure maps to source row Row. This is + the exact "may a breakpoint sit on this line" test for IDEs - only + meaningful while DebugDataLoaded is True. Fn filters by source/module + name ('' = any file). } + function HasCodeAtRow(Row: Cardinal; const Fn: tbtstring = ''): Boolean; procedure LoadDebugData(const Data: tbtstring); @@ -273,6 +279,32 @@ function GetProcDebugInfo(FProcs: TIFList; Proc: TPSProcRec): PFunctionInfo; REsult := c; end; +function TPSCustomDebugExec.HasCodeAtRow(Row: Cardinal; const Fn: tbtstring): Boolean; +var + i, j: Longint; + fi: PFunctionInfo; + r: PPositionData; +begin + Result := False; + if FDebugDataForProcs = nil then + Exit; + for i := 0 to FDebugDataForProcs.Count - 1 do + begin + fi := FDebugDataForProcs[i]; + if fi^.FPositionTable = nil then + Continue; + for j := 0 to fi^.FPositionTable.Count - 1 do + begin + r := PPositionData(fi^.FPositionTable[j]); + if (r^.Row = Row) and ((Fn = '') or (r^.FileName = Fn)) then + begin + Result := True; + Exit; + end; + end; + end; +end; + procedure TPSCustomDebugExec.LoadDebugData(const Data: tbtstring); var CP, I: Longint;