| 933 | } |
| 934 | |
| 935 | void DbgSrcFile::VerifyPath() |
| 936 | { |
| 937 | if (mVerifiedPath) |
| 938 | return; |
| 939 | |
| 940 | if (mLineDataRefs.IsEmpty()) |
| 941 | return; |
| 942 | |
| 943 | if (!::FileExists(mFilePath)) |
| 944 | { |
| 945 | bool didReplace = false; |
| 946 | for (auto& kv : gDebugManager->mSourcePathRemap) |
| 947 | { |
| 948 | if (mFilePath.StartsWith(kv.mKey, StringImpl::CompareKind_OrdinalIgnoreCase)) |
| 949 | { |
| 950 | mFilePath.Remove(0, kv.mKey.mLength); |
| 951 | mFilePath.Insert(0, kv.mValue); |
| 952 | didReplace = true; |
| 953 | } |
| 954 | } |
| 955 | |
| 956 | if (!didReplace) |
| 957 | { |
| 958 | HashSet<DbgModule*> checkedModules; |
| 959 | for (auto& lineDataRef : mLineDataRefs) |
| 960 | { |
| 961 | auto dbgModule = lineDataRef->mCompileUnit->mDbgModule; |
| 962 | if (checkedModules.Add(dbgModule)) |
| 963 | { |
| 964 | if (dbgModule->mDbgFlavor == DbgFlavor_MS) |
| 965 | { |
| 966 | COFF* coff = (COFF*)dbgModule; |
| 967 | |
| 968 | if ((!coff->mOrigPDBPath.IsEmpty()) && (!coff->mOrigPDBPath.Equals(coff->mPDBPath, StringImpl::CompareKind_OrdinalIgnoreCase))) |
| 969 | { |
| 970 | String relFilePath = GetRelativePath(mFilePath, coff->mOrigPDBPath); |
| 971 | String checkActualFilePath = GetAbsPath(relFilePath, coff->mPDBPath); |
| 972 | |
| 973 | if (FileExists(checkActualFilePath)) |
| 974 | { |
| 975 | mFilePath = checkActualFilePath; |
| 976 | break; |
| 977 | } |
| 978 | } |
| 979 | } |
| 980 | } |
| 981 | } |
| 982 | } |
| 983 | } |
| 984 | |
| 985 | mVerifiedPath = true; |
| 986 | } |
| 987 | |
| 988 | const String& DbgSrcFile::GetLocalPath() |
| 989 | { |