[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
Wed Jul 21 16:11:16 PDT 2021
apoos-maximus added a comment.
In D106226#2891107 <https://reviews.llvm.org/D106226#2891107>, @teemperor wrote:
> Also I wonder how we could make sure we emit this diagnostic in cases where the ptrace_scope is actually the reason for the failed attach. The proper way to check this seems to be checking the errno after we call ptrace and then propagate the error all the way back to lldb from lldb-server. From the lldb side I don't think we have any way of knowing why the attach actually failed so we would emit this error speculatively which doesn't seem ideal.
In D106226#2891565 <https://reviews.llvm.org/D106226#2891565>, @rupprecht wrote:
> Can we have LLDB read the value of /proc/sys/kernel/yama/ptrace_scope, and only print the error if the file exists and is not 0?
Reading the value of `/proc/sys/kernel/yama/ptrace_scope` is possible even when running as a non-root user, so user permissions would not pose a problem here.
[apoos_maximus at host]$ sysctl kernel.yama.ptrace_scope
kernel.yama.ptrace_scope = 1
[apoos_maximus at host]$ cat /proc/sys/kernel/yama/ptrace_scope
1
I will check into the ptrace-API to see if there is a direct way for this, else look into some other kernel call through which we can read this value.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106226/new/
https://reviews.llvm.org/D106226
More information about the lldb-commits
mailing list