[Lldb-commits] [lldb] [lldb] Fix SIGSEGV in `GetPtraceScope()` in `Procfs.cpp` (PR #142224)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 2 02:13:17 PDT 2025


================
@@ -74,7 +74,7 @@ lldb_private::process_linux::GetAvailableLogicalCoreIDs() {
 llvm::Expected<int> lldb_private::process_linux::GetPtraceScope() {
   ErrorOr<std::unique_ptr<MemoryBuffer>> ptrace_scope_file =
       getProcFile("sys/kernel/yama/ptrace_scope");
-  if (!*ptrace_scope_file)
+  if (!ptrace_scope_file)
----------------
labath wrote:

I don't think we do. The default for functions returning `Expected/ErrorOr<some_ptr<Foo>>` is that they return a valid object in the non-error case. If they aren't they should very explicitly document what it means to "successfully return nothing"

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


More information about the lldb-commits mailing list