gdb com, add setting to limit the call stack depth

This commit is contained in:
Basile Burg 2020-07-02 06:35:40 +02:00
parent 6bce0a2c14
commit 40b2a0b67f
3 changed files with 18 additions and 3 deletions

View File

@ -1,5 +1,9 @@
# v3.9.6-dev # v3.9.6-dev
## Enhancements
- GDB commander: added the _macCallStackDepth_ option. It prevents slowdown when on automatic break caused by a stack overflow.
## Bugs fixed ## Bugs fixed
- Editor: wrong position indicated in the call tips when starting to type an array literal, a slice or any other expression involving the square brackets. (#51) - Editor: wrong position indicated in the call tips when starting to type an array literal, a slice or any other expression involving the square brackets. (#51)

View File

@ -353,7 +353,7 @@ inherited GdbWidget: TGdbWidget
end end
object button4: TDexedToolButton[2] object button4: TDexedToolButton[2]
Left = 205 Left = 205
Height = 28 Height = 5
Top = 0 Top = 0
AutoSize = True AutoSize = True
Caption = 'button4' Caption = 'button4'

View File

@ -8,7 +8,7 @@ uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, RegExpr, ComCtrls, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, RegExpr, ComCtrls,
PropEdits, GraphPropEdits, RTTIGrids, Dialogs, ExtCtrls, Menus, Buttons, PropEdits, GraphPropEdits, RTTIGrids, Dialogs, ExtCtrls, Menus, Buttons,
StdCtrls, process, fpjson, typinfo, Unix, ListViewFilterEdit, SynEdit, StdCtrls, process, fpjson, typinfo, Unix, ListViewFilterEdit, SynEdit,
ObjectInspector, ObjectInspector, math,
u_common, u_interfaces, u_widget, u_processes, u_observer, u_synmemo, u_common, u_interfaces, u_widget, u_processes, u_observer, u_synmemo,
u_sharedres, u_stringrange, u_dsgncontrols, u_dialogs, u_dbgitf, u_sharedres, u_stringrange, u_dsgncontrols, u_dialogs, u_dbgitf,
u_ddemangle, u_writableComponent, EditBtn, strutils, u_controls; u_ddemangle, u_writableComponent, EditBtn, strutils, u_controls;
@ -315,10 +315,12 @@ type
fHideCpuView: boolean; fHideCpuView: boolean;
fDlangBreakpoints: TDlangBreakpoints; fDlangBreakpoints: TDlangBreakpoints;
fCurrentEvalKind: TGdbEvalKind; fCurrentEvalKind: TGdbEvalKind;
fMaxCallStackDepth: integer;
procedure setIgnoredSignals(value: TStringList); procedure setIgnoredSignals(value: TStringList);
procedure setCommandsHistory(value: TStringList); procedure setCommandsHistory(value: TStringList);
procedure setCustomEvalHistory(value: TStringList); procedure setCustomEvalHistory(value: TStringList);
procedure setShortcuts(value: TDebugShortcuts); procedure setShortcuts(value: TDebugShortcuts);
procedure setMaxCallStackDepth(value: integer);
procedure cleanInvalidHistoryEntries; procedure cleanInvalidHistoryEntries;
published published
property asmSyntax: TAsmSyntax read fAsmSyntax write fAsmSyntax; property asmSyntax: TAsmSyntax read fAsmSyntax write fAsmSyntax;
@ -335,6 +337,7 @@ type
property hideCpuView: boolean read fHideCpuView write fHideCpuView default false; property hideCpuView: boolean read fHideCpuView write fHideCpuView default false;
property ignoredSignals: TStringList read fIgnoredSignals write setIgnoredSignals; property ignoredSignals: TStringList read fIgnoredSignals write setIgnoredSignals;
property keepRedirectedStreams: boolean read fKeepRedirectedStreams write fKeepRedirectedStreams default false; property keepRedirectedStreams: boolean read fKeepRedirectedStreams write fKeepRedirectedStreams default false;
property maxCallStackDepth: integer read fMaxCallStackDepth write setMaxCallStackDepth default 100;
property shortcuts: TDebugShortcuts read fShortcuts write setShortcuts; property shortcuts: TDebugShortcuts read fShortcuts write setShortcuts;
property showGdbOutput: boolean read fShowGdbOutput write fShowGdbOutput; property showGdbOutput: boolean read fShowGdbOutput write fShowGdbOutput;
property showRawMiOutput: boolean read fShowRawMiOutput write fShowRawMiOutput; property showRawMiOutput: boolean read fShowRawMiOutput write fShowRawMiOutput;
@ -679,6 +682,7 @@ var
d: TDlangBreakpoint; d: TDlangBreakpoint;
begin begin
inherited; inherited;
fMaxCallStackDepth := 100;
fAutoDemangle := true; fAutoDemangle := true;
fAutoGetCallStack:= true; fAutoGetCallStack:= true;
fAutoGetRegisters:= true; fAutoGetRegisters:= true;
@ -749,6 +753,13 @@ begin
fShortcuts.assign(value); fShortcuts.assign(value);
end; end;
procedure TDebugOptionsBase.setMaxCallStackDepth(value: integer);
begin
value := max(1, value);
value := min(1000, value);
fMaxCallStackDepth := value;
end;
procedure TDebugOptionsBase.assign(source: TPersistent); procedure TDebugOptionsBase.assign(source: TPersistent);
var var
src: TDebugOptionsBase; src: TDebugOptionsBase;
@ -2796,7 +2807,7 @@ end;
procedure TGdbWidget.infoStack; procedure TGdbWidget.infoStack;
begin begin
gdbCommand('-stack-list-frames', @gdboutJsonize); gdbCommand('-stack-list-frames 0 ' + intToStr(fOptions.maxCallStackDepth - 1), @gdboutJsonize);
end; end;
procedure TGdbWidget.infoVariables; procedure TGdbWidget.infoVariables;