mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 23:20:26 +02:00
Debugger: Attempt to fix spaces in path for OSx, Issue #0018457
git-svn-id: trunk@31831 -
This commit is contained in:
parent
b580436123
commit
53cbfeeba4
@ -111,10 +111,18 @@ type
|
|||||||
end;
|
end;
|
||||||
PGDBMITargetInfo = ^TGDBMITargetInfo;
|
PGDBMITargetInfo = ^TGDBMITargetInfo;
|
||||||
|
|
||||||
|
TConvertToGDBPathType = (cgptNone, cgptCurDir, cgptExeName);
|
||||||
|
|
||||||
|
TGDBMIDebuggerFilenameEncoding = (
|
||||||
|
gdfeNone, gdfeDefault, gdfeEscSpace, gdfeQuote
|
||||||
|
);
|
||||||
|
|
||||||
{ TGDBMIDebuggerProperties }
|
{ TGDBMIDebuggerProperties }
|
||||||
|
|
||||||
TGDBMIDebuggerProperties = class(TDebuggerProperties)
|
TGDBMIDebuggerProperties = class(TDebuggerProperties)
|
||||||
private
|
private
|
||||||
|
FEncodeCurrentDirPath: TGDBMIDebuggerFilenameEncoding;
|
||||||
|
FEncodeExeFileName: TGDBMIDebuggerFilenameEncoding;
|
||||||
{$IFDEF UNIX}
|
{$IFDEF UNIX}
|
||||||
FConsoleTty: String;
|
FConsoleTty: String;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -133,6 +141,10 @@ type
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
property TimeoutForEval: Integer read FTimeoutForEval write SetTimeoutForEval;
|
property TimeoutForEval: Integer read FTimeoutForEval write SetTimeoutForEval;
|
||||||
property WarnOnTimeOut: Boolean read FWarnOnTimeOut write SetWarnOnTimeOut;
|
property WarnOnTimeOut: Boolean read FWarnOnTimeOut write SetWarnOnTimeOut;
|
||||||
|
property EncodeCurrentDirPath: TGDBMIDebuggerFilenameEncoding
|
||||||
|
read FEncodeCurrentDirPath write FEncodeCurrentDirPath default gdfeDefault;
|
||||||
|
property EncodeExeFileName: TGDBMIDebuggerFilenameEncoding
|
||||||
|
read FEncodeExeFileName write FEncodeExeFileName default gdfeDefault;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TGDBMIDebugger = class;
|
TGDBMIDebugger = class;
|
||||||
@ -376,6 +388,7 @@ type
|
|||||||
procedure QueueExecuteLock;
|
procedure QueueExecuteLock;
|
||||||
procedure QueueExecuteUnlock;
|
procedure QueueExecuteUnlock;
|
||||||
|
|
||||||
|
function ConvertToGDBPath(APath: string; ConvType: TConvertToGDBPathType = cgptNone): string;
|
||||||
function ChangeFileName: Boolean; override;
|
function ChangeFileName: Boolean; override;
|
||||||
function CreateBreakPoints: TDBGBreakPoints; override;
|
function CreateBreakPoints: TDBGBreakPoints; override;
|
||||||
function CreateLocals: TLocalsSupplier; override;
|
function CreateLocals: TLocalsSupplier; override;
|
||||||
@ -1440,17 +1453,48 @@ begin
|
|||||||
then Result := 8;
|
then Result := 8;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ConvertToGDBPath(APath: string): string;
|
function TGDBMIDebugger.ConvertToGDBPath(APath: string; ConvType: TConvertToGDBPathType = cgptNone): string;
|
||||||
// GDB wants forward slashes in its filenames, even on win32.
|
// GDB wants forward slashes in its filenames, even on win32.
|
||||||
|
var
|
||||||
|
esc: TGDBMIDebuggerFilenameEncoding;
|
||||||
begin
|
begin
|
||||||
Result := APath;
|
Result := APath;
|
||||||
// no need to process empty filename
|
// no need to process empty filename
|
||||||
if Result='' then exit;
|
if Result = '' then exit;
|
||||||
|
|
||||||
|
case ConvType of
|
||||||
|
cgptNone: esc := gdfeNone;
|
||||||
|
cgptCurDir:
|
||||||
|
begin
|
||||||
|
esc := TGDBMIDebuggerProperties(GetProperties).FEncodeCurrentDirPath;
|
||||||
|
//TODO: check FGDBOS
|
||||||
|
//Unix/Windows can use gdfeEscSpace, but work without too;
|
||||||
|
if esc = gdfeDefault
|
||||||
|
then esc :=
|
||||||
|
{$IFDEF darwin} gdfeQuote;
|
||||||
|
{$ELSE} gdfeNone;
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
cgptExeName:
|
||||||
|
begin
|
||||||
|
esc := TGDBMIDebuggerProperties(GetProperties).FEncodeExeFileName;
|
||||||
|
if esc = gdfeDefault
|
||||||
|
then esc :=
|
||||||
|
//Unix/Windows can use gdfeEscSpace, but work without too;
|
||||||
|
{$IFDEF darwin} gdfeEscSpace;
|
||||||
|
{$ELSE} gdfeNone;
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{$WARNINGS off}
|
{$WARNINGS off}
|
||||||
if DirectorySeparator <> '/' then
|
if DirectorySeparator <> '/' then
|
||||||
Result := StringReplace(Result, DirectorySeparator, '/', [rfReplaceAll]);
|
Result := StringReplace(Result, DirectorySeparator, '/', [rfReplaceAll]);
|
||||||
{$WARNINGS on}
|
{$WARNINGS on}
|
||||||
|
if esc = gdfeEscSpace
|
||||||
|
then Result := StringReplace(Result, ' ', '\ ', [rfReplaceAll]);
|
||||||
|
if esc = gdfeQuote
|
||||||
|
then Result := '\"' + Result + '\"';
|
||||||
Result := '"' + Result + '"';
|
Result := '"' + Result + '"';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3727,7 +3771,7 @@ begin
|
|||||||
// otherwise on second run within the same gdb session the workingdir
|
// otherwise on second run within the same gdb session the workingdir
|
||||||
// is set to c:\windows
|
// is set to c:\windows
|
||||||
ExecuteCommand('-environment-cd %s', ['.'], []);
|
ExecuteCommand('-environment-cd %s', ['.'], []);
|
||||||
ExecuteCommand('-environment-cd %s', [ConvertToGDBPath(UTF8ToSys(FTheDebugger.WorkingDir))], [cfCheckError]);
|
ExecuteCommand('-environment-cd %s', [FTheDebugger.ConvertToGDBPath(UTF8ToSys(FTheDebugger.WorkingDir), cgptCurDir)], [cfCheckError]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TargetInfo^.TargetFlags := [tfHasSymbols]; // Set until proven otherwise
|
TargetInfo^.TargetFlags := [tfHasSymbols]; // Set until proven otherwise
|
||||||
@ -5311,6 +5355,8 @@ begin
|
|||||||
FTimeoutForEval := -1;
|
FTimeoutForEval := -1;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
FWarnOnTimeOut := True;
|
FWarnOnTimeOut := True;
|
||||||
|
FEncodeCurrentDirPath := gdfeDefault;
|
||||||
|
FEncodeExeFileName := gdfeDefault;
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -5323,6 +5369,8 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
FTimeoutForEval := TGDBMIDebuggerProperties(Source).FTimeoutForEval;
|
FTimeoutForEval := TGDBMIDebuggerProperties(Source).FTimeoutForEval;
|
||||||
FWarnOnTimeOut := TGDBMIDebuggerProperties(Source).FWarnOnTimeOut;
|
FWarnOnTimeOut := TGDBMIDebuggerProperties(Source).FWarnOnTimeOut;
|
||||||
|
FEncodeCurrentDirPath := TGDBMIDebuggerProperties(Source).FEncodeCurrentDirPath;
|
||||||
|
FEncodeExeFileName := TGDBMIDebuggerProperties(Source).FEncodeExeFileName;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -5341,7 +5389,7 @@ var
|
|||||||
Cmd: TGDBMIDebuggerCommandChangeFilename;
|
Cmd: TGDBMIDebuggerCommandChangeFilename;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
S := ConvertToGDBPath(UTF8ToSys(FileName));
|
S := ConvertToGDBPath(UTF8ToSys(FileName), cgptExeName);
|
||||||
|
|
||||||
Cmd := TGDBMIDebuggerCommandChangeFilename.Create(Self, S);
|
Cmd := TGDBMIDebuggerCommandChangeFilename.Create(Self, S);
|
||||||
Cmd.AddReference;
|
Cmd.AddReference;
|
||||||
|
Loading…
Reference in New Issue
Block a user