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())


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())
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to