[Lldb-commits] [PATCH] D106226: [lldb] Improve error message when "lldb attach" fails

APOORV SACHAN via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Jul 17 14:14:49 PDT 2021


apoos-maximus created this revision.
apoos-maximus requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

lldb attach operation fails when the ptrace() call fails on a traced
process. The error reporting in this scenario could be improved by
including what went wrong and what could be done by the user to resolve
the situation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106226

Files:
  lldb/source/Commands/CommandObjectProcess.cpp


Index: lldb/source/Commands/CommandObjectProcess.cpp
===================================================================
--- lldb/source/Commands/CommandObjectProcess.cpp
+++ lldb/source/Commands/CommandObjectProcess.cpp
@@ -409,6 +409,9 @@
       }
     } else {
       result.AppendErrorWithFormat("attach failed: %s\n", error.AsCString());
+      result.AppendMessage("Could not attach to process. If your uid matches the uid of the target process, \n" 
+                           "check the setting of /proc/sys/kernel/yama/ptrace_scope, \n" 
+                           "or try again as the root user. \n");
     }
 
     if (!result.Succeeded())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106226.359580.patch
Type: text/x-patch
Size: 653 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210717/b7da088a/attachment.bin>


More information about the lldb-commits mailing list