#97, show messages when dbg not possible + prevent file error with new unsaved projs

This commit is contained in:
Basile Burg 2016-11-10 12:03:14 +01:00
parent 36e4da966e
commit 2ccc064e62
No known key found for this signature in database
GPG Key ID: 1868039F415CB8CF
1 changed files with 28 additions and 16 deletions

View File

@ -1126,15 +1126,15 @@ end;
procedure TCEGdbWidget.executeFromShortcut(sender: TObject); procedure TCEGdbWidget.executeFromShortcut(sender: TObject);
begin begin
case TMenuItem(sender).Tag of case TMenuItem(sender).Tag of
0: btnStart.Click; 0: begin showWidget; btnStart.Click; end;
1: btnStop.Click; 1: btnStop.Click;
2: btnPause.Click; 2: btnPause.Click;
3: btnContinue.Click; 3: btnContinue.Click;
4: btnNext.Click; 4: btnNext.Click;
5: btnOver.Click; 5: btnOver.Click;
6: btnReg.Click; 6: begin showWidget; btnReg.Click; end;
7: btnStack.Click; 7: begin showWidget; btnStack.Click; end;
8: btnVariables.Click; 8: begin showWidget; btnVariables.Click; end;
end; end;
end; end;
{$ENDREGION} {$ENDREGION}
@ -1352,9 +1352,15 @@ var
b: TPersistentBreakPoint; b: TPersistentBreakPoint;
begin begin
if not fDbgRunnable and (fProj = nil) then if not fDbgRunnable and (fProj = nil) then
begin
dlgOkInfo('No project to debug', 'GDB commander');
exit; exit;
end;
if fDbgRunnable and fDoc.isNil then if fDbgRunnable and fDoc.isNil then
begin
dlgOkInfo('No runnable to debug', 'GDB commander');
exit; exit;
end;
if fProj.binaryKind <> executable then if fProj.binaryKind <> executable then
exit; exit;
if not fDbgRunnable then if not fDbgRunnable then
@ -1362,15 +1368,7 @@ begin
else else
fExe := fDoc.fileName.stripFileExt + exeExt; fExe := fDoc.fileName.stripFileExt + exeExt;
// //
fOutputName := fExe + '.inferiorout'; if (fExe = '/') or not fExe.fileExists then
fInputName := fExe + '.inferiorin';
FreeAndNil(fInput);
if fInputName.fileExists then
deletefile(fInputName);
fInput:= TFileStream.Create(fInputName, fmCreate or fmShareExclusive);
FreeAndNil(fOutput);
//
if not fExe.fileExists then
begin begin
if fDbgRunnable then if fDbgRunnable then
dlgOkInfo('Either the runnable is not compiled or it cannot be found' + dlgOkInfo('Either the runnable is not compiled or it cannot be found' +
@ -1380,9 +1378,21 @@ begin
dlgOkInfo('The project binary is missing, cannot debug', 'GDB commander'); dlgOkInfo('The project binary is missing, cannot debug', 'GDB commander');
exit; exit;
end; end;
//
fOutputName := fExe + '.inferiorout';
fInputName := fExe + '.inferiorin';
FreeAndNil(fInput);
if fInputName.fileExists then
deletefile(fInputName);
fInput:= TFileStream.Create(fInputName, fmCreate or fmShareExclusive);
FreeAndNil(fOutput);
//
gdb := exeFullName('gdb'); gdb := exeFullName('gdb');
if not gdb.fileExists then if not gdb.fileExists then
begin
dlgOkInfo('Cannot debug, GDB is missing', 'GDB commander');
exit; exit;
end;
subjDebugStart(fSubj, self as ICEDebugger); subjDebugStart(fSubj, self as ICEDebugger);
// gdb process // gdb process
killGdb; killGdb;
@ -1892,6 +1902,7 @@ begin
if val.isNotNil and (val.JSONType = jtArray) then if val.isNotNil and (val.JSONType = jtArray) then
begin begin
i := ValueListEditor1.Row; i := ValueListEditor1.Row;
ValueListEditor1.BeginUpdate;
ValueListEditor1.Clear; ValueListEditor1.Clear;
arr := TJSONArray(val); arr := TJSONArray(val);
for i := 0 to arr.Count-1 do for i := 0 to arr.Count-1 do
@ -1911,6 +1922,7 @@ begin
end; end;
if (i <> -1) and (i <= ValueListEditor1.RowCount) then if (i <> -1) and (i <= ValueListEditor1.RowCount) then
ValueListEditor1.Row:=i; ValueListEditor1.Row:=i;
ValueListEditor1.EndUpdate;
end; end;
if fOptions.showGdbOutput or fShowFromCustomCommand then if fOptions.showGdbOutput or fShowFromCustomCommand then
@ -1934,8 +1946,8 @@ begin
fLog.Clear; fLog.Clear;
fGdb.getFullLines(fLog); fGdb.getFullLines(fLog);
for str in fLog do //for str in fLog do
fMsg.message(str, nil, amcMisc, amkAuto); // fMsg.message(str, nil, amcMisc, amkAuto);
if flog.Text.isEmpty then if flog.Text.isEmpty then
exit; exit;
@ -2016,7 +2028,7 @@ end;
procedure TCEGdbWidget.infoVariables; procedure TCEGdbWidget.infoVariables;
begin begin
gdbCommand('-stack-list-variables 1'); gdbCommand('-stack-list-variables --skip-unavailable --all-values');
end; end;
procedure TCEGdbWidget.btnStartClick(Sender: TObject); procedure TCEGdbWidget.btnStartClick(Sender: TObject);