From 0db8c632c570d488a8fbfc901ca1c4976d9581fe Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 18 Jun 2018 13:16:32 +0000 Subject: [PATCH] FpDebug: MacOs, find dwarf info in app bundle git-svn-id: trunk@58307 - --- components/fpdebug/fpimgreaderbase.pas | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/components/fpdebug/fpimgreaderbase.pas b/components/fpdebug/fpimgreaderbase.pas index 95861ccf4c..ba82ee6160 100644 --- a/components/fpdebug/fpimgreaderbase.pas +++ b/components/fpdebug/fpimgreaderbase.pas @@ -4,6 +4,8 @@ unit FpImgReaderBase; {$modeswitch advancedrecords} interface +{$ifdef CD_Cocoa}{$DEFINE MacOS}{$ENDIF} +{$IFDEF Darwin}{$DEFINE MacOS}{$ENDIF} uses {$ifdef windows} @@ -142,12 +144,23 @@ end; { TDbgFileLoader } constructor TDbgFileLoader.Create(AFileName: String); +{$IFDEF MacOS} +var + s: String; +{$ENDIF} begin {$ifdef USE_WIN_FILE_MAPPING} FFileHandle := CreateFile(PChar(AFileName), GENERIC_READ, FILE_SHARE_READ, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); Create(FFileHandle); {$else} FList := TList.Create; + {$IFDEF MacOS} + if (RightStr(AFileName,4) = '.app') then begin + s := ExtractFileName(AFileName); + s := AFileName + PathDelim + 'Contents' + PathDelim + 'MacOs' + PathDelim + copy(s, 1, Length(s) - 4); + if (FileExists(s)) then AFileName := s + end; + {$ENDIF} FStream := TFileStreamUTF8.Create(AFileName, fmOpenRead or fmShareDenyNone); inherited Create; {$endif}