llvm-project/lldb/unittests/Core
Greg Clayton c012408453 Implement better path matching in FileSpecList::FindCompatibleIndex(...).
Currently a FileSpecList::FindFileIndex(...) will only match the specified FileSpec if:
- it has filename and directory and both match exactly
- if has a filename only and any filename in the list matches

Because of this, we modify our breakpoint resolving so it can handle relative paths by doing some extra code that removes the directory from the FileSpec when searching if the path is relative.

This patch is intended to fix breakpoints so they work as users expect them to by adding the following features:
- allow matches to relative paths in the file list to match as long as the relative path is at the end of the specified path at valid directory delimiters
- allow matches to paths to match if the specified path is relative and shorter than the file paths in the list

This allows us to remove the extra logic from BreakpointResolverFileLine.cpp that added support for setting breakpoints with relative paths.

This means we can still set breakpoints with relative paths when the debug info contains full paths. We add the ability to set breakpoints with full paths when the debug info contains relative paths.

Debug info contains "./a/b/c/main.cpp", the following will set breakpoints successfully:
- /build/a/b/c/main.cpp
- a/b/c/main.cpp
- b/c/main.cpp
- c/main.cpp
- main.cpp
- ./c/main.cpp
- ./a/b/c/main.cpp
- ./b/c/main.cpp
- ./main.cpp

This also ensures that we won't match partial directory names, if a relative path is in the list or is used for the match, things must match at the directory level.

The breakpoint resolving code will now use the new FileSpecList::FindCompatibleIndex(...) function to allow this fuzzy matching to work for breakpoints.

Differential Revision: https://reviews.llvm.org/D130401
2022-08-08 15:20:38 -07:00
..
CMakeLists.txt Implement better path matching in FileSpecList::FindCompatibleIndex(...). 2022-08-08 15:20:38 -07:00
CommunicationTest.cpp [lldb] Fix compiler warning in CommunicationTest 2022-01-18 10:31:37 +01:00
DiagnosticEventTest.cpp [lldb] Report debugger diagnostics as events 2022-03-16 08:33:01 -07:00
DumpDataExtractorTest.cpp [lldb] Always use APFloat for FP dumping 2022-07-27 14:30:35 +02:00
FileSpecListTest.cpp Implement better path matching in FileSpecList::FindCompatibleIndex(...). 2022-08-08 15:20:38 -07:00
FormatEntityTest.cpp
MangledTest.cpp [lldb] Fix PR52702 by fixing bool conversion of Mangled 2021-12-29 17:17:52 +08:00
ModuleSpecTest.cpp
RichManglingContextTest.cpp [lldb] Improve RichManglingContext ergonomics (NFC) 2022-02-04 10:17:39 -08:00
SourceLocationSpecTest.cpp Use value_or instead of getValueOr (NFC) 2022-06-19 10:34:41 -07:00
SourceManagerTest.cpp
UniqueCStringMapTest.cpp [lldb/DWARF] Make manual dwarf index deterministic 2022-01-27 10:05:05 +01:00