mirror of https://gitlab.com/basile.b/dexed.git
fix #106 - GDB commander, add support for the GDB completions
This commit is contained in:
parent
f2d18f718d
commit
064ca95343
12
CHANGELOG.md
12
CHANGELOG.md
|
@ -1,9 +1,21 @@
|
|||
# v3.9.20-dev
|
||||
|
||||
## Enhancements
|
||||
|
||||
- GDB Commander, the `p` custom command and has now the same effect as the toolbar action _evaluate_.
|
||||
- GDB Commander, it's possible to get completions when using the `p` command in the field at the bottom and using
|
||||
the <key>CTRL</key> + <key>SPACE</key> shortcut or the <key>.</key> key.
|
||||
- GDB Commander, added the _useCustomCommandsHistory_ option. If checked the history is used to auto-complete the field at the bottom.
|
||||
This is the previous default but it's now deactivate for a better experience with the GDB completions.
|
||||
|
||||
## Bugs fixed
|
||||
|
||||
- Project groups, dexed projects (.dprj) wrongly seen as makefile projects.
|
||||
|
||||
## Other
|
||||
|
||||
- Dropped support for Lazarus 2.0, 2.2 or newer required.
|
||||
|
||||
# v3.9.19
|
||||
|
||||
## Enhancements
|
||||
|
|
|
@ -81,6 +81,7 @@ Note that even if in most of the cases the results of a custom command are displ
|
|||
|
||||
- Any commands that may cause an execution break is handled by the interpreter (.so library events, fork events, system calls, function finished, etc).
|
||||
- Any variation of the `-stack-list-variables` has for effect to update the variable list.
|
||||
- The `p` command has the same effect when evaluating an expression from the toolbar action. In addition <key>CTRL</key> + <key>SPACE</key> has for effect to get the completions, similarly to the effect of <key>TAB</key> when GDB is used in CLI.
|
||||
|
||||
## Target input stream
|
||||
|
||||
|
@ -115,5 +116,6 @@ Note that if the option _queryInput_ is used then the input stream is not availa
|
|||
- **showOutput**: Displays the target output in [the messages](widgets_messages.html). May be deactivated for a GUI program.
|
||||
- **showRawMiOutput**: For the custom commands or for debugging the widget. When checked the GDB output (after JSON-ization) is displayed in [the messages](widgets_messages.html).
|
||||
- **stopAllThreadsOnBreak**: Sets if all the threads of the target are stopped when the execution breaks. Not applied until next debugging cession.
|
||||
- **useCustomCommandsHistory**: Sets if the command history is used to auto complete while typing a custom command.
|
||||
|
||||
<script>anchors.add();</script>
|
||||
|
|
|
@ -20,28 +20,28 @@ inherited GdbWidget: TGdbWidget
|
|||
ClientWidth = 672
|
||||
object Panel1: TPanel[0]
|
||||
Left = 0
|
||||
Height = 385
|
||||
Height = 386
|
||||
Top = 205
|
||||
Width = 672
|
||||
Align = alClient
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 385
|
||||
ClientHeight = 386
|
||||
ClientWidth = 672
|
||||
TabOrder = 0
|
||||
object GroupBox3: TGroupBox
|
||||
Left = 0
|
||||
Height = 179
|
||||
Height = 180
|
||||
Top = 206
|
||||
Width = 672
|
||||
Align = alClient
|
||||
Caption = 'CPU'
|
||||
ClientHeight = 160
|
||||
ClientHeight = 161
|
||||
ClientWidth = 668
|
||||
TabOrder = 0
|
||||
object cpuViewer: TTIPropertyGrid
|
||||
Left = 0
|
||||
Height = 160
|
||||
Height = 161
|
||||
Hint = 'cpu registers'
|
||||
Top = 0
|
||||
Width = 668
|
||||
|
@ -81,8 +81,8 @@ inherited GdbWidget: TGdbWidget
|
|||
ClientWidth = 670
|
||||
object lstVariables: TListView
|
||||
Left = 2
|
||||
Height = 139
|
||||
Top = 32
|
||||
Height = 140
|
||||
Top = 31
|
||||
Width = 666
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 2
|
||||
|
@ -109,7 +109,7 @@ inherited GdbWidget: TGdbWidget
|
|||
end
|
||||
object varListFlt: TListViewFilterEdit
|
||||
Left = 2
|
||||
Height = 28
|
||||
Height = 27
|
||||
Hint = 'locate variables'
|
||||
Top = 2
|
||||
Width = 666
|
||||
|
@ -158,19 +158,19 @@ inherited GdbWidget: TGdbWidget
|
|||
end
|
||||
object Panel3: TPanel[1]
|
||||
Left = 4
|
||||
Height = 28
|
||||
Top = 594
|
||||
Height = 27
|
||||
Top = 595
|
||||
Width = 664
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 4
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 28
|
||||
ClientHeight = 27
|
||||
ClientWidth = 664
|
||||
TabOrder = 1
|
||||
object btnSendCom: TSpeedButton
|
||||
Left = 659
|
||||
Height = 26
|
||||
Height = 25
|
||||
Top = 1
|
||||
Width = 4
|
||||
Align = alRight
|
||||
|
@ -180,7 +180,7 @@ inherited GdbWidget: TGdbWidget
|
|||
end
|
||||
object Edit1: TComboBox
|
||||
Left = 0
|
||||
Height = 28
|
||||
Height = 27
|
||||
Hint = 'enter a custom GDB command or the program input with ">"'
|
||||
Top = 0
|
||||
Width = 658
|
||||
|
@ -189,8 +189,10 @@ inherited GdbWidget: TGdbWidget
|
|||
AutoCompleteText = [cbactEnabled, cbactEndOfLineComplete, cbactSearchAscending]
|
||||
ItemHeight = 0
|
||||
MaxLength = 128
|
||||
OnKeyDown = Edit1KeyDown
|
||||
OnKeyUp = Edit1KeyUp
|
||||
TabOrder = 0
|
||||
TabStop = False
|
||||
end
|
||||
end
|
||||
object Splitter3: TSplitter[2]
|
||||
|
@ -551,4 +553,8 @@ inherited GdbWidget: TGdbWidget
|
|||
OnClick = mnuEvalCustomClick
|
||||
end
|
||||
end
|
||||
object mnuEvalCompletion: TPopupMenu[8]
|
||||
Left = 288
|
||||
Top = 168
|
||||
end
|
||||
end
|
||||
|
|
|
@ -317,6 +317,7 @@ type
|
|||
fCurrentEvalKind: TGdbEvalKind;
|
||||
fMaxCallStackDepth: integer;
|
||||
fGdbPath: TFilename;
|
||||
fUseCustomCommandsHistory: boolean;
|
||||
procedure setIgnoredSignals(value: TStringList);
|
||||
procedure setCommandsHistory(value: TStringList);
|
||||
procedure setCustomEvalHistory(value: TStringList);
|
||||
|
@ -325,6 +326,7 @@ type
|
|||
procedure cleanInvalidHistoryEntries;
|
||||
published
|
||||
property asmSyntax: TAsmSyntax read fAsmSyntax write fAsmSyntax;
|
||||
property useCustomCommandsHistory: boolean read fUseCustomCommandsHistory write fUseCustomCommandsHistory;
|
||||
property autoDisassemble: boolean read fAutoDisassemble write fAutoDisassemble;
|
||||
property autoDemangle: boolean read fAutoDemangle write fAutoDemangle;
|
||||
property autoGetCallStack: boolean read fAutoGetCallStack write fAutoGetCallStack;
|
||||
|
@ -444,6 +446,7 @@ type
|
|||
PageControl2: TPageControl;
|
||||
mnuNext: TPopupMenu;
|
||||
mnuEval: TPopupMenu;
|
||||
mnuEvalCompletion: TPopupMenu;
|
||||
TabSheet1: TTabSheet;
|
||||
TabSheet2: TTabSheet;
|
||||
TabSheet3: TTabSheet;
|
||||
|
@ -482,6 +485,7 @@ type
|
|||
procedure btnWatchClick(Sender: TObject);
|
||||
procedure dbgeeOptsEdEditorFilter(Sender: TObject;
|
||||
aEditor: TPropertyEditor; var aShow: boolean);
|
||||
procedure Edit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure lstCallStackDblClick(Sender: TObject);
|
||||
procedure lstThreadsDblClick(Sender: TObject);
|
||||
|
@ -567,6 +571,8 @@ type
|
|||
procedure infoAsm(const fname: string);
|
||||
procedure evalStuff(const stuff: string);
|
||||
procedure sendCustomCommand;
|
||||
procedure getGdbCompletions(partial: string);
|
||||
procedure getCompletions();
|
||||
procedure setGpr(reg: TCpuRegister; val: TCpuGprValue);
|
||||
procedure setFpr(reg: TFpuRegister; val: extended);
|
||||
procedure setSsr(reg: TSegRegister; val: TCPUSegValue);
|
||||
|
@ -594,6 +600,7 @@ type
|
|||
procedure removeBreakPoints(const fname: string);
|
||||
function evaluate(const exp: string): string;
|
||||
procedure executeFromShortcut(sender: TObject);
|
||||
procedure itemCompletetionClick(sender: TObject);
|
||||
public
|
||||
constructor create(aOwner: TComponent); override;
|
||||
destructor destroy; override;
|
||||
|
@ -1482,6 +1489,8 @@ begin
|
|||
TGdbEvalKind.gekCustom : mnuEvalCustom.Click();
|
||||
end;
|
||||
|
||||
Edit1.AutoComplete:= fOptions.useCustomCommandsHistory;
|
||||
|
||||
bmp.Free;
|
||||
end;
|
||||
|
||||
|
@ -2393,6 +2402,7 @@ var
|
|||
addr: PtrUint = 0;
|
||||
func:string = '';
|
||||
line: integer = -1;
|
||||
mnuItem: TMenuItem;
|
||||
// registers data
|
||||
number: integer = 0;
|
||||
// signal data
|
||||
|
@ -2572,6 +2582,19 @@ begin
|
|||
updateDebugeeOptionsEditor;
|
||||
killGdb;
|
||||
end;
|
||||
end
|
||||
|
||||
else if fJson.findArray('matches', arr) then
|
||||
begin
|
||||
mnuEvalCompletion.Items.Clear;
|
||||
for i := 0 to arr.Count-1 do
|
||||
begin
|
||||
nme := arr.Strings[i];
|
||||
mnuItem := TMenuItem.Create(mnuEvalCompletion);
|
||||
mnuItem.Caption:= nme;
|
||||
mnuItem.OnClick:= @itemCompletetionClick;
|
||||
mnuEvalCompletion.Items.Add(mnuItem);
|
||||
end;
|
||||
end;
|
||||
|
||||
if fJson.findAny('msg', val) then
|
||||
|
@ -2998,15 +3021,42 @@ begin
|
|||
aShow := aEditor.GetName <> 'filename';
|
||||
end;
|
||||
|
||||
procedure TGdbWidget.btnSendComClick(Sender: TObject);
|
||||
procedure TGdbWidget.getCompletions();
|
||||
var
|
||||
MousePos: TPoint;
|
||||
begin
|
||||
sendCustomCommand;
|
||||
getGdbCompletions(Edit1.Text);
|
||||
waitCommandProcessed();
|
||||
if not mnuEvalCompletion.Items.Count.equals(0) then
|
||||
begin
|
||||
MousePos := Point(Edit1.Left, Edit1.Top + Edit1.Height);
|
||||
MousePos := Edit1.ClientToScreen(MousePos);
|
||||
mnuEvalCompletion.PopUp(MousePos.X, MousePos.Y);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGdbWidget.Edit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
if ((shift = [ssCtrl]) and (Key = Byte(#32))) then
|
||||
getCompletions();
|
||||
end;
|
||||
|
||||
procedure TGdbWidget.Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
if Key = byte(#13) then
|
||||
sendCustomCommand;
|
||||
sendCustomCommand()
|
||||
else if Key = Byte(#190) then
|
||||
getCompletions();
|
||||
end;
|
||||
|
||||
procedure TGdbWidget.itemCompletetionClick(sender: TObject);
|
||||
begin
|
||||
Edit1.Text := (sender as TMenuItem).Caption;
|
||||
end;
|
||||
|
||||
procedure TGdbWidget.btnSendComClick(Sender: TObject);
|
||||
begin
|
||||
sendCustomCommand;
|
||||
end;
|
||||
|
||||
procedure TGdbWidget.lstCallStackDblClick(Sender: TObject);
|
||||
|
@ -3156,6 +3206,11 @@ begin
|
|||
end
|
||||
else fMsg.message('inferior stdin is already closed', nil, amcMisc, amkWarn);
|
||||
end
|
||||
else if (length(cmd) > 3) and cmd.StartsWith('p ') then
|
||||
begin
|
||||
fOptions.currentEvalKind := gekCustom;
|
||||
evalStuff(cmd[3 .. length(cmd)])
|
||||
end
|
||||
else
|
||||
begin
|
||||
fShowFromCustomCommand := true;
|
||||
|
@ -3164,6 +3219,16 @@ begin
|
|||
edit1.Text := '';
|
||||
end;
|
||||
|
||||
procedure TGdbWidget.getGdbCompletions(partial: string);
|
||||
const
|
||||
spec = '-complete "%s"';
|
||||
var
|
||||
cmd : string;
|
||||
begin
|
||||
cmd := format(spec, [partial]);
|
||||
gdbCommand(cmd);
|
||||
end;
|
||||
|
||||
procedure TGdbWidget.setGpr(reg: TCpuRegister; val: TCpuGprValue);
|
||||
const
|
||||
spec = 'set $%s = 0x%X';
|
||||
|
|
Loading…
Reference in New Issue