From 735cd248e479d4990099d560cddd03bd252fcc50 Mon Sep 17 00:00:00 2001 From: maxim Date: Thu, 1 Feb 2018 22:40:14 +0000 Subject: [PATCH] Merged revision(s) 57089 #dee589f02f, 57101-57103 #6f95f40044-#6f95f40044, 57198 #392a64d93b from trunk: Debbugger: Do not always auto adjust the stackframe when stopping. (temp fix) Issue #0032978 ........ IDE, Debugger: fixed name for "step to cursor". Two different names where in use for this. ........ IDE: removed unused caption resource for "run to cursor". Clean up for rev 57101 #6f95f40044 ........ Debugger: Allow pause button to abort auto-continue of breakpoint ........ Debugger, GDBMI: fix range check, when comparing qword for min() Issue #033106 ........ git-svn-id: branches/fixes_1_8@57211 - --- .../debuggerintf/dbgintfdebuggerbase.pp | 13 ++++++++++-- components/lazdebuggergdbmi/gdbmidebugger.pp | 21 ++++++++++++------- ide/debugmanager.pas | 5 +++-- ide/lazarusidestrconsts.pas | 1 - ide/sourceeditor.pp | 2 +- 5 files changed, 28 insertions(+), 14 deletions(-) diff --git a/components/debuggerintf/dbgintfdebuggerbase.pp b/components/debuggerintf/dbgintfdebuggerbase.pp index 410b08b81d..a4894bf4fd 100644 --- a/components/debuggerintf/dbgintfdebuggerbase.pp +++ b/components/debuggerintf/dbgintfdebuggerbase.pp @@ -1932,6 +1932,7 @@ type end; procedure RegisterDebugger(const ADebuggerClass: TDebuggerClass); +function MinDbgPtr(a, b: TDBGPtr): TDBGPtr;inline; overload; function dbgs(AState: TDBGState): String; overload; function dbgs(ADataState: TDebuggerDataState): String; overload; @@ -1982,6 +1983,14 @@ begin MDebuggerClasses.AddObject(ADebuggerClass.ClassName, TObject(Pointer(ADebuggerClass))); end; +function MinDbgPtr(a, b: TDBGPtr): TDBGPtr; +begin + if a < b then + Result := a + else + Result := b; +end; + procedure DoFinalization; var n: Integer; @@ -2189,7 +2198,7 @@ begin TryStartAt.GuessedValue := TmpAddr; AdjustToRangeOrKnowFunctionStart(TryStartAt, RngBefore); // check max size - if (TryStartAt.Value < AStartAddr - Min(AStartAddr, DAssMaxRangeSize)) + if (TryStartAt.Value < AStartAddr - MinDbgPtr(AStartAddr, DAssMaxRangeSize)) then begin DebugLn(DBG_DISASSEMBLER, ['INFO: Limit Range for Disass: FStartAddr=', AStartAddr, ' TryStartAt.Value=', TryStartAt.Value ]); TryStartAt := InitAddress(TmpAddr, avGuessed); @@ -2307,7 +2316,7 @@ begin then RngBefore := nil; {$POP} AdjustToRangeOrKnowFunctionStart(TryStartAt, RngBefore); - if (TryStartAt.Value < TryEndAt.Value - Min(TryEndAt.Value, DAssMaxRangeSize)) + if (TryStartAt.Value < TryEndAt.Value - MinDbgPtr(TryEndAt.Value, DAssMaxRangeSize)) then begin DebugLn(DBG_DISASSEMBLER, ['INFO: Limit Range for Disass: TryEndAt.Value=', TryEndAt.Value, ' TryStartAt.Value=', TryStartAt.Value ]); TryStartAt := InitAddress(TmpAddr, avGuessed); diff --git a/components/lazdebuggergdbmi/gdbmidebugger.pp b/components/lazdebuggergdbmi/gdbmidebugger.pp index 2278c831d8..816d94dd85 100644 --- a/components/lazdebuggergdbmi/gdbmidebugger.pp +++ b/components/lazdebuggergdbmi/gdbmidebugger.pp @@ -396,8 +396,8 @@ type function CheckHasType(TypeName: String; TypeFlag: TGDBMITargetFlag): TGDBMIExecResult; function PointerTypeCast: string; function FrameToLocation(const AFrame: String = ''): TDBGLocationRec; - procedure ProcessFrame(const ALocation: TDBGLocationRec); overload; - procedure ProcessFrame(const AFrame: String = ''); overload; + procedure ProcessFrame(ALocation: TDBGLocationRec; ASeachStackForSource: Boolean = True); overload; + procedure ProcessFrame(const AFrame: String = ''; ASeachStackForSource: Boolean = True); overload; procedure DoDbgEvent(const ACategory: TDBGEventCategory; const AEventType: TDBGEventType; const AText: String); property LastExecResult: TGDBMIExecResult read FLastExecResult; property DefaultTimeOut: Integer read FDefaultTimeOut write FDefaultTimeOut; @@ -6005,21 +6005,21 @@ begin if Reason = 'function-finished' then begin SetDebuggerState(dsPause); - ProcessFrame(List.Values['frame']); + ProcessFrame(List.Values['frame'], False); Exit; end; if Reason = 'end-stepping-range' then begin SetDebuggerState(dsPause); - ProcessFrame(List.Values['frame']); + ProcessFrame(List.Values['frame'], False); Exit; end; if Reason = 'location-reached' then begin SetDebuggerState(dsPause); - ProcessFrame(List.Values['frame']); + ProcessFrame(List.Values['frame'], False); Exit; end; @@ -11132,18 +11132,23 @@ begin Frame.Free; end; -procedure TGDBMIDebuggerCommand.ProcessFrame(const ALocation: TDBGLocationRec); +procedure TGDBMIDebuggerCommand.ProcessFrame(ALocation: TDBGLocationRec; + ASeachStackForSource: Boolean); begin + // TODO: process stack in gdbmi debugger // currently: signal IDE + if (not ASeachStackForSource) and (ALocation.SrcLine < 0) then + ALocation.SrcLine := -2; FTheDebugger.DoCurrent(ALocation); // TODO: only selected callers FTheDebugger.FCurrentLocation := ALocation; end; -procedure TGDBMIDebuggerCommand.ProcessFrame(const AFrame: String); +procedure TGDBMIDebuggerCommand.ProcessFrame(const AFrame: String; + ASeachStackForSource: Boolean); var Location: TDBGLocationRec; begin Location := FrameToLocation(AFrame); - ProcessFrame(Location); + ProcessFrame(Location, ASeachStackForSource); end; procedure TGDBMIDebuggerCommand.DoDbgEvent(const ACategory: TDBGEventCategory; diff --git a/ide/debugmanager.pas b/ide/debugmanager.pas index e358eea153..f158da780d 100644 --- a/ide/debugmanager.pas +++ b/ide/debugmanager.pas @@ -1331,7 +1331,7 @@ begin SrcLine := ALocation.SrcLine; CurrentSourceUnitInfo := nil; - if SrcLine < 1 + if (SrcLine < 1) and (SrcLine <> -2) // TODO: this should move to the debugger then begin // jump to the deepest stack frame with debugging info // TODO: Only below the frame supplied by debugger @@ -1942,7 +1942,7 @@ begin or (dcRun in FDebugger.Commands) or (FDebugger.State = dsIdle)); // Pause itmRunMenuPause.Enabled := CanRun and DebuggerIsValid - and (dcPause in FDebugger.Commands); + and ((dcPause in FDebugger.Commands) or FAutoContinueTimer.Enabled); // Show execution point itmRunMenuShowExecutionPoint.Enabled := CanRun and DebuggerIsValid and (FDebugger.State = dsPause); @@ -2442,6 +2442,7 @@ begin if (MainIDE.ToolStatus <> itDebugger) or (FDebugger = nil) or Destroying then Exit; + FAutoContinueTimer.Enabled := False; FDebugger.Pause; Result := mrOk; end; diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 25d3b28725..1323aa76e5 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -2833,7 +2833,6 @@ resourcestring uemAddWatchAtCursor = 'Add &Watch At Cursor'; uemAddWatchPointAtCursor = 'Add Watch&Point At Cursor'; uemInspect = '&Inspect ...'; - uemRunToCursor='&Run to Cursor'; uemViewCallStack = 'View Call Stack'; uemMovePageLeft='Move Page Left'; uemMovePageRight='Move Page Right'; diff --git a/ide/sourceeditor.pp b/ide/sourceeditor.pp index 502b184225..d398eb2b3d 100644 --- a/ide/sourceeditor.pp +++ b/ide/sourceeditor.pp @@ -1661,7 +1661,7 @@ begin 'Inspect...', uemInspect, nil, nil, nil, 'debugger_inspect'); SrcEditMenuInspect.Enabled:=False; SrcEditMenuRunToCursor:=RegisterIDEMenuCommand(AParent, - 'Run to cursor', uemRunToCursor, nil, nil, nil, 'menu_run_cursor'); + 'Run to cursor', lisMenuRunToCursor, nil, nil, nil, 'menu_run_cursor'); SrcEditMenuViewCallStack:=RegisterIDEMenuCommand(AParent, 'View Call Stack', uemViewCallStack, nil, @ExecuteIdeMenuClick, nil, 'debugger_call_stack'); {%endregion}