fix #71 - add "Run until instruction" to gdb commander asm view

This commit is contained in:
Basile Burg 2021-09-15 03:19:34 +02:00
parent 0fd5ca5461
commit 0679140ef9
3 changed files with 62 additions and 37 deletions

View File

@ -7,6 +7,7 @@
- DUB projects: added support for the _syntax_ build type. (#83)
- GDB commander: arguments of the _Debugee Options_ can be temporarily deactivated by prepending `//`.
- GDB commander: add an option allowing to set the path to the gdb binary. (#73)
- GDB commander: the context menu of the ASM view allows to resume execution until the selected instruction. (#71)
- Search results: use GNU style messages. (#84)
## Bugs fixed

View File

@ -20,28 +20,28 @@ inherited GdbWidget: TGdbWidget
ClientWidth = 672
object Panel1: TPanel[0]
Left = 0
Height = 387
Height = 385
Top = 205
Width = 672
Align = alClient
AutoSize = True
BevelOuter = bvNone
ClientHeight = 387
ClientHeight = 385
ClientWidth = 672
TabOrder = 0
object GroupBox3: TGroupBox
Left = 0
Height = 181
Height = 179
Top = 206
Width = 672
Align = alClient
Caption = 'CPU'
ClientHeight = 162
ClientHeight = 160
ClientWidth = 668
TabOrder = 0
object cpuViewer: TTIPropertyGrid
Left = 0
Height = 162
Height = 160
Hint = 'cpu registers'
Top = 0
Width = 668
@ -70,9 +70,9 @@ inherited GdbWidget: TGdbWidget
Height = 200
Top = 0
Width = 672
ActivePage = TabSheet3
ActivePage = TabSheet4
Align = alTop
TabIndex = 0
TabIndex = 1
TabOrder = 2
OnChange = PageControl2Change
object TabSheet3: TTabSheet
@ -81,8 +81,8 @@ inherited GdbWidget: TGdbWidget
ClientWidth = 670
object lstVariables: TListView
Left = 2
Height = 141
Top = 30
Height = 139
Top = 32
Width = 666
Align = alClient
BorderSpacing.Around = 2
@ -90,12 +90,12 @@ inherited GdbWidget: TGdbWidget
item
AutoSize = True
Caption = 'name'
Width = 45
Width = 43
end
item
AutoSize = True
Caption = 'value'
Width = 619
Width = 621
end>
GridLines = True
HideSelection = False
@ -109,7 +109,7 @@ inherited GdbWidget: TGdbWidget
end
object varListFlt: TListViewFilterEdit
Left = 2
Height = 26
Height = 28
Hint = 'locate variables'
Top = 2
Width = 666
@ -128,9 +128,9 @@ inherited GdbWidget: TGdbWidget
ClientWidth = 670
object lstAsm: TListView
Left = 2
Height = 161
Height = 169
Top = 2
Width = 507
Width = 666
Align = alClient
AutoSort = False
AutoWidthLastColumn = True
@ -139,11 +139,11 @@ inherited GdbWidget: TGdbWidget
item
AutoSize = True
Caption = 'address'
Width = 59
Width = 57
end
item
Caption = 'instruction'
Width = 446
Width = 607
end>
GridLines = True
HideSelection = False
@ -158,19 +158,19 @@ inherited GdbWidget: TGdbWidget
end
object Panel3: TPanel[1]
Left = 4
Height = 26
Top = 596
Height = 28
Top = 594
Width = 664
Align = alBottom
AutoSize = True
BorderSpacing.Around = 4
BevelOuter = bvNone
ClientHeight = 26
ClientHeight = 28
ClientWidth = 664
TabOrder = 1
object btnSendCom: TSpeedButton
Left = 659
Height = 24
Height = 26
Top = 1
Width = 4
Align = alRight
@ -180,7 +180,7 @@ inherited GdbWidget: TGdbWidget
end
object Edit1: TComboBox
Left = 0
Height = 26
Height = 28
Hint = 'enter a custom GDB command or the program input with ">"'
Top = 0
Width = 658
@ -255,10 +255,10 @@ inherited GdbWidget: TGdbWidget
ClientWidth = 670
object lstThreads: TListView
Left = 0
Height = 169
Height = 173
Hint = 'call stack'
Top = 0
Width = 513
Width = 670
Align = alClient
AutoSort = False
AutoWidthLastColumn = True
@ -266,36 +266,36 @@ inherited GdbWidget: TGdbWidget
item
AutoSize = True
Caption = 'id'
Width = 20
Width = 18
end
item
AutoSize = True
Caption = 'state'
Width = 41
Width = 39
end
item
AutoSize = True
Caption = 'core'
Width = 36
Width = 34
end
item
AutoSize = True
Caption = 'function'
Width = 61
end
item
AutoSize = True
Caption = 'address'
Width = 59
end
item
AutoSize = True
Caption = 'address'
Width = 57
end
item
AutoSize = True
Caption = 'filename'
Width = 65
Width = 64
end
item
Caption = 'line'
Width = 229
Width = 397
end>
GridLines = True
ReadOnly = True
@ -311,9 +311,9 @@ inherited GdbWidget: TGdbWidget
ClientWidth = 670
object dbgeeOptsEd: TTIPropertyGrid
Left = 2
Height = 161
Height = 169
Top = 2
Width = 507
Width = 666
Align = alClient
BorderSpacing.Around = 2
CheckboxForBoolean = True
@ -353,7 +353,7 @@ inherited GdbWidget: TGdbWidget
end
object button4: TDexedToolButton[2]
Left = 205
Height = 5
Height = 28
Top = 0
AutoSize = True
Caption = 'button4'

View File

@ -550,6 +550,7 @@ type
procedure killGdb;
procedure updateDebugeeOptionsEditor;
procedure deleteRedirectedIO;
procedure runUntilAsmInstruction(Sender: TObject);
// GDB output processors
procedure gdboutQuiet(sender: TObject);
procedure gdboutJsonize(sender: TObject);
@ -1243,6 +1244,8 @@ end;
{$REGION Common/standard comp --------------------------------------------------}
constructor TGdbWidget.create(aOwner: TComponent);
var
asmBreak: TMenuItem;
begin
inherited;
EntitiesConnector.addObserver(self);
@ -1264,10 +1267,17 @@ begin
fSynchronizedDocuments := TStringList.Create;
TListViewCopyMenu.create(lstCallStack);
TListViewCopyMenu.create(lstAsm);
TListViewCopyMenu.create(lstVariables);
TListViewCopyMenu.create(lstThreads);
with TListViewCopyMenu.create(lstAsm) do
begin
asmBreak := TMenuItem.Create(self);
asmBreak.Caption:= 'Run until instruction';
asmBreak.OnClick:= @runUntilAsmInstruction;
addAdditionalItem(asmBreak);
end;
cpuViewer.DefaultItemHeight := scaleY(22, 96);
dbgeeOptsEd.DefaultItemHeight:= cpuViewer.DefaultItemHeight;
@ -3029,6 +3039,20 @@ begin
HintInfo^.HintStr:= i.SubItems[0];
end;
procedure TGdbWidget.runUntilAsmInstruction(Sender: TObject);
var
a: string;
begin
if fGdbState <> TGdbState.gsPaused then
exit;
a := lstAsm.Selected.Caption;
if a.isNotEmpty then
begin
gdbCommand(format('-break-insert -t *%s', [a]) + #10);
continueDebugging();
end;
end;
procedure TGdbWidget.mnuEvalDerefClick(Sender: TObject);
begin
fEvalKind := gekDerefSelectedVar;