[Lldb-commits] [lldb] [lldb] Realpath symlinks for breakpoints (PR #102223)

via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 6 21:57:09 PDT 2024


================
@@ -108,52 +113,85 @@ size_t SupportFileList::FindFileIndex(size_t start_idx,
                          });
 }
 
-size_t SupportFileList::FindCompatibleIndex(size_t start_idx,
-                                            const FileSpec &file_spec) const {
-  const size_t num_files = m_files.size();
-  if (start_idx >= num_files)
-    return UINT32_MAX;
+enum IsCompatibleResult {
+  kNoMatch = 0,
+  kOnlyFileMatch = 1,
+  kCompatible = 2,
+};
 
+IsCompatibleResult IsCompatible(const FileSpec &curr_file,
+                                const FileSpec &file_spec) {
   const bool file_spec_relative = file_spec.IsRelative();
   const bool file_spec_case_sensitive = file_spec.IsCaseSensitive();
   // When looking for files, we will compare only the filename if the directory
   // argument is empty in file_spec
   const bool full = !file_spec.GetDirectory().IsEmpty();
 
+  // Always start by matching the filename first
+  if (!curr_file.FileEquals(file_spec))
----------------
royitaqi wrote:

To be exact, it's not only symlinked **directories**, but also symlinked **files** which have the same basename. I will try to make it clear in documentation.

https://github.com/llvm/llvm-project/pull/102223


More information about the lldb-commits mailing list