mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-31 11:32:33 +02:00
* Debugger: Fix PID detection on OSX 10.6. Fixes #0014588
git-svn-id: trunk@23192 -
This commit is contained in:
parent
a5e41fe16c
commit
2ccb6663ac
@ -3079,6 +3079,31 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGDBMIDebugger.Init;
|
procedure TGDBMIDebugger.Init;
|
||||||
|
function ParseGDBVersionMI: Boolean;
|
||||||
|
var
|
||||||
|
R: TGDBMIExecResult;
|
||||||
|
S: String;
|
||||||
|
List: TGDBMINameValueList;
|
||||||
|
begin
|
||||||
|
if not ExecuteCommand('-gdb-version', [], [], R)
|
||||||
|
then Exit(False);
|
||||||
|
|
||||||
|
if R.Values = '' then Exit(False);
|
||||||
|
|
||||||
|
List := TGDBMINameValueList.Create(R);
|
||||||
|
|
||||||
|
FGDBVersion := List.Values['version'];
|
||||||
|
S := List.Values['target'];
|
||||||
|
|
||||||
|
FGDBCPU := GetPart('', '-', S);
|
||||||
|
GetPart('-', '-', S); // strip vendor
|
||||||
|
FGDBOS := GetPart(['-'], ['-', ''], S);
|
||||||
|
|
||||||
|
List.Free;
|
||||||
|
|
||||||
|
Result := FGDBVersion <> '';
|
||||||
|
end;
|
||||||
|
|
||||||
procedure ParseGDBVersion;
|
procedure ParseGDBVersion;
|
||||||
var
|
var
|
||||||
R: TGDBMIExecResult;
|
R: TGDBMIExecResult;
|
||||||
@ -3141,7 +3166,7 @@ begin
|
|||||||
// ignore the error on other platforms
|
// ignore the error on other platforms
|
||||||
ExecuteCommand('-gdb-set new-console off', [cfIgnoreError]);
|
ExecuteCommand('-gdb-set new-console off', [cfIgnoreError]);
|
||||||
|
|
||||||
ParseGDBVersion;
|
if not ParseGDBVersionMI then ParseGDBVersion;
|
||||||
CheckGDBVersion;
|
CheckGDBVersion;
|
||||||
|
|
||||||
inherited Init;
|
inherited Init;
|
||||||
@ -4094,8 +4119,7 @@ begin
|
|||||||
and ExecuteCommand('-exec-run', [], R)
|
and ExecuteCommand('-exec-run', [], R)
|
||||||
then begin
|
then begin
|
||||||
// some versions of gdb (OSX) output the PID here
|
// some versions of gdb (OSX) output the PID here
|
||||||
TargetPIDPart := GetPart(['process '],
|
TargetPIDPart := GetPart(['process '], [' local', ']'], R.Values, True);
|
||||||
[' local'], R.Values, True);
|
|
||||||
FTargetPID := StrToIntDef(TargetPIDPart, 0);
|
FTargetPID := StrToIntDef(TargetPIDPart, 0);
|
||||||
R.State := dsNone;
|
R.State := dsNone;
|
||||||
end;
|
end;
|
||||||
@ -4109,6 +4133,16 @@ begin
|
|||||||
FTargetPID := StrToIntDef(TargetPIDPart, 0);
|
FTargetPID := StrToIntDef(TargetPIDPart, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// apple
|
||||||
|
if (FTargetPID = 0)
|
||||||
|
and ExecuteCommand('info pid', [], [cfIgnoreError], R)
|
||||||
|
and (R.State <> dsError)
|
||||||
|
then begin
|
||||||
|
List := TGDBMINameValueList.Create(R);
|
||||||
|
FTargetPID := StrToIntDef(List.Values['process-id'], 0);
|
||||||
|
List.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
if FTargetPID = 0
|
if FTargetPID = 0
|
||||||
then begin
|
then begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
Loading…
Reference in New Issue
Block a user