Bug ID 47826
Summary Cannot attach to a process with exited leader thread (TID==PID)
Product lldb
Version unspecified
Hardware PC
OS Linux
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter jan.kratochvil@redhat.com
CC jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
There does not need to exist a thread with TID equal to the process PID. That
TID could already exit while other TIDs of that PID may be still running.
[https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=432b4d03ad0f23970315e9f9dec080ab4a9ab94b](https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=432b4d03ad0f23970315e9f9dec080ab4a9ab94b)
simplified and deGPLed as: [https://people.redhat.com/jkratoch/leader-exit2.C](https://people.redhat.com/jkratoch/leader-exit2.C)
Currently LLDB server cannot attach to such TID as:
lldb-server g --attach >TID< :1234
ptrace(PTRACE_ATTACH, >PID<) = -1 EPERM (Operation not permitted)
write(2, "error: failed to attach to pid >TID<: Operation not permitted\n",
64) = 64
02295e6d1a1559f0689aeca09d98f468e3f29d9a = 2020-10-12