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 uses
Classes, SysUtils, Maps, FpDbgDwarf, FpDbgUtil, FpDbgWinExtra, FpDbgLoader, Classes, SysUtils, Maps, FpDbgDwarf, FpDbgUtil, FpDbgWinExtra, FpDbgLoader,
FpDbgInfo, FpdMemoryTools, LazLoggerBase, LazClasses, DbgIntfBaseTypes, fgl, FpDbgInfo, FpdMemoryTools, LazLoggerBase, LazClasses, DbgIntfBaseTypes, fgl,
FpDbgDisasX86; FpDbgDisasX86,
FpDbgDwarfDataClasses;
type type
TFPDEvent = (deExitProcess, deBreakpoint, deException, deCreateProcess, deLoadLibrary, deInternalContinue); TFPDEvent = (deExitProcess, deBreakpoint, deException, deCreateProcess, deLoadLibrary, deInternalContinue);
@ -123,6 +124,7 @@ type
function SingleStep: Boolean; virtual; function SingleStep: Boolean; virtual;
function StepOver: Boolean; virtual; function StepOver: Boolean; virtual;
function Next: Boolean; virtual; function Next: Boolean; virtual;
function IntNext: Boolean; virtual;
function CompareStepInfo: boolean; function CompareStepInfo: boolean;
property ID: Integer read FID; property ID: Integer read FID;
property Handle: THandle read FHandle; property Handle: THandle read FHandle;
@ -803,6 +805,7 @@ function TDbgThread.CompareStepInfo: boolean;
var var
AnAddr: TDBGPtr; AnAddr: TDBGPtr;
Sym: TFpDbgSymbol; Sym: TFpDbgSymbol;
CU: TDwarfCompilationUnit;
begin begin
AnAddr := FProcess.GetInstructionPointerRegisterValue; AnAddr := FProcess.GetInstructionPointerRegisterValue;
sym := FProcess.FindSymbol(AnAddr); sym := FProcess.FindSymbol(AnAddr);
@ -810,6 +813,17 @@ begin
begin begin
result := (FStoreStepSrcFilename=sym.FileName) and (FStoreStepSrcLineNo=sym.Line) and result := (FStoreStepSrcFilename=sym.FileName) and (FStoreStepSrcLineNo=sym.Line) and
(FStoreStepFuncAddr=sym.Address.Address); (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 end
else else
result := true; result := true;
@ -838,6 +852,12 @@ begin
// Do nothing // Do nothing
end; end;
function TDbgThread.IntNext: Boolean;
begin
result := StepOver;
FStepping:=result;
end;
constructor TDbgThread.Create(const AProcess: TDbgProcess; const AID: Integer; const AHandle: THandle); constructor TDbgThread.Create(const AProcess: TDbgProcess; const AID: Integer; const AHandle: THandle);
begin begin
FID := AID; FID := AID;
@ -897,9 +917,8 @@ end;
function TDbgThread.Next: Boolean; function TDbgThread.Next: Boolean;
begin begin
result := StepOver;
StoreStepInfo; StoreStepInfo;
FStepping:=result; result := IntNext;
end; end;
{ TDbgBreak } { TDbgBreak }

View File

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