llvm-project/lldb/unittests
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
..
API [LLDB] Applying clang-tidy modernize-use-override over LLDB 2022-04-22 13:29:47 -07:00
Breakpoint
Core Implement better path matching in FileSpecList::FindCompatibleIndex(...). 2022-08-08 15:20:38 -07:00
DataFormatter [nfc] [lldb] Prevent needless copies of DataExtractor 2021-08-04 20:35:53 +02:00
Disassembler Move GetControlFlowKind's logic to DisassemblerLLVMC.cpp 2022-07-26 12:05:23 -07:00
Editline Re-land "[lldb] Synchronize output through the IOHandler" 2022-03-15 12:53:46 -07:00
Expression [lldb] LLVM_FALLTHROUGH => [[fallthrough]]. NFC 2022-08-08 11:31:49 -07:00
Host Use value instead of getValue (NFC) 2022-07-15 20:03:13 -07:00
Instruction
Interpreter [LLDB] Applying clang-tidy modernize-use-override over LLDB 2022-04-22 13:29:47 -07:00
Language We don't require users to type out the full context of a function, for 2022-05-12 12:39:28 -07:00
ObjectFile [lldb] Test parsing the symtab with indirect symbols from the shared cache 2022-03-23 21:13:55 -07:00
Platform [lldb] Add a test to prefer exact triple matches in platform selection 2022-07-11 16:35:51 -07:00
Process [lldb] Make Process and subclass constructors protected 2022-08-08 17:34:27 +02:00
ScriptInterpreter Remove Python 2 support from the ScriptInterpreter plugin 2022-04-27 08:26:25 -07:00
Signals Store a by name list of signals with their actions in the Target 2022-05-26 14:50:33 -07:00
Symbol Fix the encoding and decoding of UniqueCStringMap<T> objects when saved to cache files. 2022-04-29 11:31:47 -07:00
SymbolFile Reland "[lldb] Add support for using integral const static data members in the expression evaluator" 2022-07-15 10:52:35 +00:00
Target [lldb] Make Process and subclass constructors protected 2022-08-08 17:34:27 +02:00
TestingSupport Reapply "[cmake] Prefix gtest and gtest_main with "llvm_"." 2022-03-04 13:45:43 -08:00
Thread [lldb] Make Process and subclass constructors protected 2022-08-08 17:34:27 +02:00
UnwindAssembly Update the CFA to use $sp when $fp is restored on arm64 2022-05-04 14:54:17 -07:00
Utility Cache the value for absolute path in FileSpec. 2022-07-28 13:31:41 -07:00
debugserver [lldb] [unittests] Fix TcpListen() call in RNBSocketTest 2021-10-26 21:08:03 +02:00
tools [lld] Don't use Optional::hasValue (NFC) 2022-06-26 19:29:40 -07:00
CMakeLists.txt Reapply "[cmake] Prefix gtest and gtest_main with "llvm_"." 2022-03-04 13:45:43 -08:00
gtest_common.h