summaryrefslogtreecommitdiff
path: root/lldb/source/Utility/FileSpecList.cpp
AgeCommit message (Collapse)Author
2025-11-20[lldb] Eliminate SupportFileSP nullptr derefs (#168624)Jonas Devlieghere
This patch fixes and eliminates the possibility of SupportFileSP ever being nullptr. The support file was originally treated like a value type, but became a polymorphic type and therefore has to be stored and passed around as a pointer. To avoid having all the callers check the validity of the pointer, I introduced the invariant that SupportFileSP is never null and always default constructed. However, without enforcement at the type level, that's fragile and indeed, we already identified two crashes where someone accidentally broke that invariant. This PR introduces a NonNullSharedPtr to prevent that. NonNullSharedPtr is a smart pointer wrapper around std::shared_ptr that guarantees the pointer is never null. If default-constructed, it creates a default-constructed instance of the contained type. Note that I'm using private inheritance because you shouldn't inherit from standard library classes due to the lack of virtual destructor. So while the new abstraction looks like a `std::shared_ptr`, it is in fact **not** a shared pointer. Given that our destructor is trivial, we could use public inheritance, but currently there's no need for it. rdar://164989579
2024-08-15[lldb] Realpath symlinks for breakpoints (#102223)royitaqi
Improve the chance of resolving file/line breakpoints by realpath'ing the support files before doing a second match attempt, with some conditions applied. A working [hello-world example](https://github.com/royitaqi/lldb_demos/blob/main/realpath/README.md). See [patch](https://github.com/llvm/llvm-project/pull/102223) for more info about problem/motivation, details of the feature, new settings, telemetries and tests.
2024-01-16[lldb] Store SupportFile as shared_ptr (NFC)Jonas Devlieghere
2024-01-04Add support for inline DWARF source files. (#75880)Adrian Prantl
LLVM supports DWARF 5 linetable extension to store source files inline in DWARF. This is particularly useful for compiler-generated source code. This implementation tries to materialize them as temporary files lazily, so SBAPI clients don't need to be aware of them. rdar://110926168
2023-12-16[lldb] Use StringRef::{starts,ends}_with (NFC)Kazu Hirata
This patch replaces uses of StringRef::{starts,ends}with with StringRef::{starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20. I'm planning to deprecate and eventually remove StringRef::{starts,ends}with.
2023-10-19[lldb] Remove FileSpecList::GetFilesMatchingPartialPath (NFC)Jonas Devlieghere
This function is unused and unimplemented.
2023-10-19[lldb] Remove FileSpecList::GetFileSpecPointerAtIndex (NFC)Jonas Devlieghere
There's only one use and it eventually converts the pointer into a reference. Simplify things and always use references.
2023-05-04[lldb] Move Core/FileSpecList -> Utility/FileSpecList (NFC)Jonas Devlieghere
There's no reason for FileSpecList to live in lldb/Core while FileSpec lives in lldb/Utility. Move FileSpecList next to FileSpec.