From 056bfcfe4b670484d1cf64618733ba7b58eaa8df Mon Sep 17 00:00:00 2001 From: joost Date: Wed, 23 Apr 2014 21:00:42 +0000 Subject: [PATCH] LazDebuggerFp (pure): When stepping(over) out of a procedure, continue until a new sourceline has been reached. git-svn-id: trunk@44799 - --- components/fpdebug/fpdbgclasses.pp | 25 ++++++++++++++++++++++--- components/fpdebug/fpdbgcontroller.pas | 2 +- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/components/fpdebug/fpdbgclasses.pp b/components/fpdebug/fpdbgclasses.pp index 6fc1eadedc..894eb3c3fa 100644 --- a/components/fpdebug/fpdbgclasses.pp +++ b/components/fpdebug/fpdbgclasses.pp @@ -39,7 +39,8 @@ interface uses Classes, SysUtils, Maps, FpDbgDwarf, FpDbgUtil, FpDbgWinExtra, FpDbgLoader, FpDbgInfo, FpdMemoryTools, LazLoggerBase, LazClasses, DbgIntfBaseTypes, fgl, - FpDbgDisasX86; + FpDbgDisasX86, + FpDbgDwarfDataClasses; type TFPDEvent = (deExitProcess, deBreakpoint, deException, deCreateProcess, deLoadLibrary, deInternalContinue); @@ -123,6 +124,7 @@ type function SingleStep: Boolean; virtual; function StepOver: Boolean; virtual; function Next: Boolean; virtual; + function IntNext: Boolean; virtual; function CompareStepInfo: boolean; property ID: Integer read FID; property Handle: THandle read FHandle; @@ -803,6 +805,7 @@ function TDbgThread.CompareStepInfo: boolean; var AnAddr: TDBGPtr; Sym: TFpDbgSymbol; + CU: TDwarfCompilationUnit; begin AnAddr := FProcess.GetInstructionPointerRegisterValue; sym := FProcess.FindSymbol(AnAddr); @@ -810,6 +813,17 @@ begin begin result := (FStoreStepSrcFilename=sym.FileName) and (FStoreStepSrcLineNo=sym.Line) and (FStoreStepFuncAddr=sym.Address.Address); + if not result and (FStoreStepFuncAddr<>sym.Address.Address) then + begin + // If the procedure changed, also check if the current instruction + // is at the start of a new sourceline. (Dwarf only) + if sym is TDbgDwarfSymbolBase then + begin + CU := TDbgDwarfSymbolBase(sym).CompilationUnit; + if cu.GetLineAddress(sym.FileName, sym.Line)<>AnAddr then + result := true; + end; + end; end else result := true; @@ -838,6 +852,12 @@ begin // Do nothing end; +function TDbgThread.IntNext: Boolean; +begin + result := StepOver; + FStepping:=result; +end; + constructor TDbgThread.Create(const AProcess: TDbgProcess; const AID: Integer; const AHandle: THandle); begin FID := AID; @@ -897,9 +917,8 @@ end; function TDbgThread.Next: Boolean; begin - result := StepOver; StoreStepInfo; - FStepping:=result; + result := IntNext; end; { TDbgBreak } diff --git a/components/fpdebug/fpdbgcontroller.pas b/components/fpdebug/fpdbgcontroller.pas index cc6df92a7d..b5959ef9c1 100644 --- a/components/fpdebug/fpdbgcontroller.pas +++ b/components/fpdebug/fpdbgcontroller.pas @@ -236,7 +236,7 @@ begin deInternalContinue : begin if assigned(FCurrentThread) and FCurrentThread.Stepping then - FCurrentThread.Next; + FCurrentThread.IntNext; end; end; {case} AExit:=true;