Debugger, GDBMI: Keep original error when trying alternative filenames.

git-svn-id: trunk@62609 -
This commit is contained in:
martin 2020-02-04 03:04:44 +00:00
parent 797910c4a4
commit 3de674b205

View File

@ -2204,10 +2204,26 @@ end;
function TGDBMIDebuggerChangeFilenameBase.DoChangeFilename: Boolean;
var
R: TGDBMIExecResult;
List: TGDBMINameValueList;
S, FileName: String;
procedure SetErrorMsg;
var
List: TGDBMINameValueList;
begin
if (FErrorMsg = '') or
(pos('no such file', LowerCase(FErrorMsg)) > 0) or
(pos('not exist', LowerCase(FErrorMsg)) < 0)
then begin
List := TGDBMINameValueList.Create(R);
FErrorMsg := DeleteEscapeChars((List.Values['msg']));
List.Free;
end;
Result := False;
end;
begin
Result := False;
FErrorMsg := '';
FContext.ThreadContext := ccNotRequired;
FContext.StackContext := ccNotRequired;
@ -2218,6 +2234,8 @@ begin
{$IFDEF darwin}
if (R.State = dsError) and (FileName <> '')
then begin
SetErrorMsg;
S := FTheDebugger.InternalFilename + '/Contents/MacOS/' + ExtractFileNameOnly(Filename);
S := FTheDebugger.ConvertToGDBPath(S, cgptExeName);
Result := ExecuteCommand('-file-exec-and-symbols %s', [S], R);
@ -2226,6 +2244,8 @@ begin
{$ENDIF}
if (R.State = dsError) and (FileName <> '') then
begin
SetErrorMsg;
FTheDebugger.InternalFilename := Filename + '.elf';
S := FTheDebugger.ConvertToGDBPath(FTheDebugger.FileName, cgptExeName);
Result := ExecuteCommand('-file-exec-and-symbols %s', [S], R);
@ -2234,10 +2254,7 @@ begin
if (R.State = dsError) and (FTheDebugger.FileName <> '')
then begin
List := TGDBMINameValueList.Create(R);
FErrorMsg := DeleteEscapeChars((List.Values['msg']));
List.Free;
Result := False;
SetErrorMsg;
Exit;
end;
end;