llvm-project/lldb/source/Breakpoint
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
..
Breakpoint.cpp [lldb] Silence GCC warnings about missing returns after fully covered switches. NFC. 2022-04-06 22:50:07 +03:00
BreakpointID.cpp Don't use Optional::hasValue (NFC) 2022-06-20 20:05:16 -07:00
BreakpointIDList.cpp [lld] Don't use Optional::hasValue (NFC) 2022-06-26 19:29:40 -07:00
BreakpointList.cpp [Breakpoint] Remove redundant member initialization (NFC) 2022-02-06 10:54:46 -08:00
BreakpointLocation.cpp [Breakpoint] Remove redundant member initialization (NFC) 2022-02-06 10:54:46 -08:00
BreakpointLocationCollection.cpp Add a repeat command option for "thread backtrace --count N". 2022-02-14 15:48:06 -08:00
BreakpointLocationList.cpp [Breakpoint] Remove redundant member initialization (NFC) 2022-02-06 10:54:46 -08:00
BreakpointName.cpp Convert functions that were returning BreakpointOption * to BreakpointOption &. 2021-06-15 14:34:02 -07:00
BreakpointOptions.cpp [LLDB][NFC][Reliability] Fix uninitialized variables from Coverity scan. Part 3 2022-07-27 10:39:49 -07:00
BreakpointPrecondition.cpp
BreakpointResolver.cpp [lldb] BreakpointResolver::CreateFromStructuredData Gardening (NFC) 2022-02-16 10:38:05 -08:00
BreakpointResolverAddress.cpp Revert "[lldb] Consider binary as module of last resort" 2022-05-23 11:19:48 +05:00
BreakpointResolverFileLine.cpp Implement better path matching in FileSpecList::FindCompatibleIndex(...). 2022-08-08 15:20:38 -07:00
BreakpointResolverFileRegex.cpp Fix bugprone argument comments. 2022-01-09 12:21:02 -08:00
BreakpointResolverName.cpp Re-submit "[lldb] Filter DIEs based on qualified name where possible" 2022-08-04 15:52:27 -07:00
BreakpointResolverScripted.cpp [lldb] Clarify StructuredDataImpl ownership 2021-12-13 21:04:51 +01:00
BreakpointSite.cpp [Breakpoint] Remove redundant member initialization (NFC) 2022-02-06 10:54:46 -08:00
BreakpointSiteList.cpp [Breakpoint] Remove redundant member initialization (NFC) 2022-02-06 10:54:46 -08:00
CMakeLists.txt
Stoppoint.cpp [lldb] Replace default bodies of special member functions with = default; 2021-07-02 11:31:16 -07:00
StoppointCallbackContext.cpp [Breakpoint] Remove redundant member initialization (NFC) 2022-02-06 10:54:46 -08:00
StoppointSite.cpp
Watchpoint.cpp [Breakpoint] Remove redundant member initialization (NFC) 2022-02-06 10:54:46 -08:00
WatchpointList.cpp [Breakpoint] Remove redundant member initialization (NFC) 2022-02-06 10:54:46 -08:00
WatchpointOptions.cpp [Breakpoint] Remove redundant member initialization (NFC) 2022-02-06 10:54:46 -08:00