mirror of https://gitlab.com/basile.b/dexed.git
#97, allow to debug the runnable module
This commit is contained in:
parent
c9f325c87f
commit
a4c142d345
|
@ -176,7 +176,7 @@ inherited CEGdbWidget: TCEGdbWidget
|
||||||
inherited toolbar: TCEToolBar
|
inherited toolbar: TCEToolBar
|
||||||
Width = 509
|
Width = 509
|
||||||
object btnStack: TCEToolButton[0]
|
object btnStack: TCEToolButton[0]
|
||||||
Left = 213
|
Left = 225
|
||||||
Hint = 'view call stack'
|
Hint = 'view call stack'
|
||||||
Top = 0
|
Top = 0
|
||||||
Caption = 'btnStack'
|
Caption = 'btnStack'
|
||||||
|
@ -185,7 +185,7 @@ inherited CEGdbWidget: TCEGdbWidget
|
||||||
scaledSeparator = False
|
scaledSeparator = False
|
||||||
end
|
end
|
||||||
object btnReg: TCEToolButton[1]
|
object btnReg: TCEToolButton[1]
|
||||||
Left = 185
|
Left = 197
|
||||||
Hint = 'update CPU registers values'
|
Hint = 'update CPU registers values'
|
||||||
Top = 0
|
Top = 0
|
||||||
Caption = 'btnReg'
|
Caption = 'btnReg'
|
||||||
|
@ -194,7 +194,7 @@ inherited CEGdbWidget: TCEGdbWidget
|
||||||
scaledSeparator = False
|
scaledSeparator = False
|
||||||
end
|
end
|
||||||
object button4: TCEToolButton[2]
|
object button4: TCEToolButton[2]
|
||||||
Left = 169
|
Left = 181
|
||||||
Height = 28
|
Height = 28
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 16
|
Width = 16
|
||||||
|
@ -203,7 +203,7 @@ inherited CEGdbWidget: TCEGdbWidget
|
||||||
scaledSeparator = False
|
scaledSeparator = False
|
||||||
end
|
end
|
||||||
object btnPause: TCEToolButton[3]
|
object btnPause: TCEToolButton[3]
|
||||||
Left = 85
|
Left = 97
|
||||||
Hint = 'pause debugging'
|
Hint = 'pause debugging'
|
||||||
Top = 0
|
Top = 0
|
||||||
Caption = 'btnPause'
|
Caption = 'btnPause'
|
||||||
|
@ -212,7 +212,7 @@ inherited CEGdbWidget: TCEGdbWidget
|
||||||
scaledSeparator = False
|
scaledSeparator = False
|
||||||
end
|
end
|
||||||
object btnStop: TCEToolButton[4]
|
object btnStop: TCEToolButton[4]
|
||||||
Left = 29
|
Left = 41
|
||||||
Hint = 'stop debugging'
|
Hint = 'stop debugging'
|
||||||
Top = 0
|
Top = 0
|
||||||
Caption = 'btnStop'
|
Caption = 'btnStop'
|
||||||
|
@ -221,7 +221,7 @@ inherited CEGdbWidget: TCEGdbWidget
|
||||||
scaledSeparator = False
|
scaledSeparator = False
|
||||||
end
|
end
|
||||||
object btnContinue: TCEToolButton[5]
|
object btnContinue: TCEToolButton[5]
|
||||||
Left = 57
|
Left = 69
|
||||||
Hint = 'continue debugging'
|
Hint = 'continue debugging'
|
||||||
Top = 0
|
Top = 0
|
||||||
Caption = 'btnContinue'
|
Caption = 'btnContinue'
|
||||||
|
@ -229,17 +229,8 @@ inherited CEGdbWidget: TCEGdbWidget
|
||||||
resourceName = 'PLAY'
|
resourceName = 'PLAY'
|
||||||
scaledSeparator = False
|
scaledSeparator = False
|
||||||
end
|
end
|
||||||
object btnStart: TCEToolButton[6]
|
object btnNext: TCEToolButton[6]
|
||||||
Left = 1
|
Left = 125
|
||||||
Hint = 'start debugging'
|
|
||||||
Top = 0
|
|
||||||
Caption = 'btnStart'
|
|
||||||
OnClick = btnStartClick
|
|
||||||
resourceName = 'POWER'
|
|
||||||
scaledSeparator = False
|
|
||||||
end
|
|
||||||
object btnNext: TCEToolButton[7]
|
|
||||||
Left = 113
|
|
||||||
Hint = 'step to next instruction, including in calls'
|
Hint = 'step to next instruction, including in calls'
|
||||||
Top = 0
|
Top = 0
|
||||||
Caption = 'btnNext'
|
Caption = 'btnNext'
|
||||||
|
@ -247,8 +238,8 @@ inherited CEGdbWidget: TCEGdbWidget
|
||||||
resourceName = 'GO_DOWN'
|
resourceName = 'GO_DOWN'
|
||||||
scaledSeparator = False
|
scaledSeparator = False
|
||||||
end
|
end
|
||||||
object btnOver: TCEToolButton[8]
|
object btnOver: TCEToolButton[7]
|
||||||
Left = 141
|
Left = 153
|
||||||
Hint = 'step to the next instruction, excluding calls'
|
Hint = 'step to the next instruction, excluding calls'
|
||||||
Top = 0
|
Top = 0
|
||||||
Caption = 'btnOver'
|
Caption = 'btnOver'
|
||||||
|
@ -256,8 +247,8 @@ inherited CEGdbWidget: TCEGdbWidget
|
||||||
resourceName = 'GO_JUMP'
|
resourceName = 'GO_JUMP'
|
||||||
scaledSeparator = False
|
scaledSeparator = False
|
||||||
end
|
end
|
||||||
object btnVariables: TCEToolButton[9]
|
object btnVariables: TCEToolButton[8]
|
||||||
Left = 241
|
Left = 253
|
||||||
Hint = 'update variables list'
|
Hint = 'update variables list'
|
||||||
Top = 0
|
Top = 0
|
||||||
Caption = 'btnVariables'
|
Caption = 'btnVariables'
|
||||||
|
@ -265,6 +256,16 @@ inherited CEGdbWidget: TCEGdbWidget
|
||||||
resourceName = 'WATCH_WINDOW'
|
resourceName = 'WATCH_WINDOW'
|
||||||
scaledSeparator = False
|
scaledSeparator = False
|
||||||
end
|
end
|
||||||
|
object btnStart: TCEToolButton[9]
|
||||||
|
Left = 1
|
||||||
|
Top = 0
|
||||||
|
Caption = 'btnStart'
|
||||||
|
DropdownMenu = mnuProjRunnable
|
||||||
|
OnClick = btnStartClick
|
||||||
|
Style = tbsDropDown
|
||||||
|
resourceName = 'POWER'
|
||||||
|
scaledSeparator = False
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object Splitter2: TSplitter[1]
|
object Splitter2: TSplitter[1]
|
||||||
|
@ -280,4 +281,19 @@ inherited CEGdbWidget: TCEGdbWidget
|
||||||
left = 56
|
left = 56
|
||||||
top = 64
|
top = 64
|
||||||
end
|
end
|
||||||
|
object mnuProjRunnable: TPopupMenu[3]
|
||||||
|
left = 144
|
||||||
|
top = 64
|
||||||
|
object mnuSelProj: TMenuItem
|
||||||
|
AutoCheck = True
|
||||||
|
Caption = 'Debug project'
|
||||||
|
Checked = True
|
||||||
|
OnClick = mnuSelProjClick
|
||||||
|
end
|
||||||
|
object mnuSelRunnable: TMenuItem
|
||||||
|
AutoCheck = True
|
||||||
|
Caption = 'Debug runnable'
|
||||||
|
OnClick = mnuSelRunnableClick
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -309,18 +309,21 @@ type
|
||||||
btnPause: TCEToolButton;
|
btnPause: TCEToolButton;
|
||||||
btnReg: TCEToolButton;
|
btnReg: TCEToolButton;
|
||||||
btnStack: TCEToolButton;
|
btnStack: TCEToolButton;
|
||||||
btnStart: TCEToolButton;
|
|
||||||
btnStop: TCEToolButton;
|
btnStop: TCEToolButton;
|
||||||
|
btnStart: TCEToolButton;
|
||||||
button4: TCEToolButton;
|
button4: TCEToolButton;
|
||||||
Edit1: TComboBox;
|
Edit1: TComboBox;
|
||||||
GroupBox1: TGroupBox;
|
GroupBox1: TGroupBox;
|
||||||
GroupBox2: TGroupBox;
|
GroupBox2: TGroupBox;
|
||||||
GroupBox3: TGroupBox;
|
GroupBox3: TGroupBox;
|
||||||
lstCallStack: TListView;
|
lstCallStack: TListView;
|
||||||
|
mnuSelProj: TMenuItem;
|
||||||
|
mnuSelRunnable: TMenuItem;
|
||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
Panel3: TPanel;
|
Panel3: TPanel;
|
||||||
btnSendCom: TSpeedButton;
|
btnSendCom: TSpeedButton;
|
||||||
cpuVIewer: TTIPropertyGrid;
|
cpuVIewer: TTIPropertyGrid;
|
||||||
|
mnuProjRunnable: TPopupMenu;
|
||||||
Splitter2: TSplitter;
|
Splitter2: TSplitter;
|
||||||
Splitter3: TSplitter;
|
Splitter3: TSplitter;
|
||||||
Splitter4: TSplitter;
|
Splitter4: TSplitter;
|
||||||
|
@ -336,6 +339,8 @@ type
|
||||||
procedure btnStartClick(Sender: TObject);
|
procedure btnStartClick(Sender: TObject);
|
||||||
procedure btnStopClick(Sender: TObject);
|
procedure btnStopClick(Sender: TObject);
|
||||||
procedure Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
procedure Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
|
procedure mnuSelProjClick(Sender: TObject);
|
||||||
|
procedure mnuSelRunnableClick(Sender: TObject);
|
||||||
protected
|
protected
|
||||||
procedure setToolBarFlat(value: boolean); override;
|
procedure setToolBarFlat(value: boolean); override;
|
||||||
procedure updateLoop; override;
|
procedure updateLoop; override;
|
||||||
|
@ -346,6 +351,7 @@ type
|
||||||
fGdbState: TGdbState;
|
fGdbState: TGdbState;
|
||||||
fSubj: TCEDebugObserverSubject;
|
fSubj: TCEDebugObserverSubject;
|
||||||
fDoc: TCESynMemo;
|
fDoc: TCESynMemo;
|
||||||
|
fDbgRunnable: boolean;
|
||||||
fProj: ICECommonProject;
|
fProj: ICECommonProject;
|
||||||
fJson: TJsonObject;
|
fJson: TJsonObject;
|
||||||
fLog: TStringList;
|
fLog: TStringList;
|
||||||
|
@ -1045,7 +1051,7 @@ begin
|
||||||
if fProj <> project then
|
if fProj <> project then
|
||||||
exit;
|
exit;
|
||||||
fProj := nil;
|
fProj := nil;
|
||||||
if fOutputName.fileExists then
|
if not fDbgRunnable and fOutputName.fileExists then
|
||||||
deleteFile(fOutputName);
|
deleteFile(fOutputName);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -1079,8 +1085,11 @@ end;
|
||||||
|
|
||||||
procedure TCEGdbWidget.docClosing(document: TCESynMemo);
|
procedure TCEGdbWidget.docClosing(document: TCESynMemo);
|
||||||
begin
|
begin
|
||||||
if fDoc = document then
|
if fDoc <> document then
|
||||||
fDoc := nil;
|
exit;
|
||||||
|
fDoc := nil;
|
||||||
|
if fDbgRunnable and fOutputName.fileExists then
|
||||||
|
deleteFile(fOutputName);
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
|
@ -1194,6 +1203,18 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCEGdbWidget.mnuSelProjClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
fDbgRunnable := false;
|
||||||
|
mnuSelRunnable.Checked:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEGdbWidget.mnuSelRunnableClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
fDbgRunnable := true;
|
||||||
|
mnuSelProj.Checked:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCEGdbWidget.disableEditor;
|
procedure TCEGdbWidget.disableEditor;
|
||||||
begin
|
begin
|
||||||
cpuVIewer.ItemIndex:=-1;
|
cpuVIewer.ItemIndex:=-1;
|
||||||
|
@ -1205,15 +1226,28 @@ var
|
||||||
gdb: string;
|
gdb: string;
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
// protect
|
if not fDbgRunnable and (fProj = nil) then
|
||||||
if fProj = nil then
|
exit;
|
||||||
|
if fDbgRunnable and fDoc.isNil then
|
||||||
exit;
|
exit;
|
||||||
if fProj.binaryKind <> executable then
|
if fProj.binaryKind <> executable then
|
||||||
exit;
|
exit;
|
||||||
fExe := fProj.outputFilename;
|
if not fDbgRunnable then
|
||||||
|
fExe := fProj.outputFilename
|
||||||
|
else
|
||||||
|
fExe := stripFileExt(fDoc.fileName) + exeExt;
|
||||||
fOutputName := fExe + '.gdbout';
|
fOutputName := fExe + '.gdbout';
|
||||||
|
FreeAndNil(fOutput);
|
||||||
if not fExe.fileExists then
|
if not fExe.fileExists then
|
||||||
|
begin
|
||||||
|
if fDbgRunnable then
|
||||||
|
dlgOkInfo('Either the runnable is not compiled or it cannot be found' +
|
||||||
|
LineEnding + 'Note that the runnable option "outputFolder" is not supported',
|
||||||
|
'GDB commander')
|
||||||
|
else
|
||||||
|
dlgOkInfo('The project binary is missing, cannot debug', 'GDB commander');
|
||||||
exit;
|
exit;
|
||||||
|
end;
|
||||||
gdb := exeFullName('gdb');
|
gdb := exeFullName('gdb');
|
||||||
if not gdb.fileExists then
|
if not gdb.fileExists then
|
||||||
exit;
|
exit;
|
||||||
|
@ -1263,9 +1297,6 @@ begin
|
||||||
fGdb.OnReadData := @gdboutJsonize;
|
fGdb.OnReadData := @gdboutJsonize;
|
||||||
// launch
|
// launch
|
||||||
gdbCommand('run >' + fExe + '.gdbout');
|
gdbCommand('run >' + fExe + '.gdbout');
|
||||||
FreeAndNil(fOutput);
|
|
||||||
if fOutputName.fileExists then
|
|
||||||
fOutput := TFileStream.Create(fOutputName, 0);
|
|
||||||
setState(gsRunning);
|
setState(gsRunning);
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
@ -1771,9 +1802,17 @@ var
|
||||||
lst: TStringList;
|
lst: TStringList;
|
||||||
lne: string;
|
lne: string;
|
||||||
begin
|
begin
|
||||||
if (fGdbState = gsNone) or not fOptions.showOutput or fOutput.isNil then
|
if (fGdbState = gsNone) or not fOptions.showOutput then
|
||||||
|
exit;
|
||||||
|
if fOutput.isNil and fOutputName.fileExists then
|
||||||
|
try
|
||||||
|
fOutput := TFileStream.Create(fOutputName, 0);
|
||||||
|
except
|
||||||
|
if fOutput.isNotNil then
|
||||||
|
FreeAndNil(fOutput);
|
||||||
|
end;
|
||||||
|
if fOutput.isNil then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
str := TMemoryStream.Create;
|
str := TMemoryStream.Create;
|
||||||
lst := TStringList.Create;
|
lst := TStringList.Create;
|
||||||
try
|
try
|
||||||
|
|
Loading…
Reference in New Issue