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