LazDebuggerFp (pure): When stepping(over) out of a procedure, continue until a new sourceline has been reached.

git-svn-id: trunk@44799 -
This commit is contained in:
joost 2014-04-23 21:00:42 +00:00
parent f677379864
commit 056bfcfe4b
2 changed files with 23 additions and 4 deletions

View File

@ -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 }

View File

@ -236,7 +236,7 @@ begin
deInternalContinue :
begin
if assigned(FCurrentThread) and FCurrentThread.Stepping then
FCurrentThread.Next;
FCurrentThread.IntNext;
end;
end; {case}
AExit:=true;