[Lldb-commits] [PATCH] D89124: [lldb-server][linux] Add ability to allocate memory

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 13 08:52:24 PDT 2020


labath marked 12 inline comments as done.
labath added inline comments.


================
Comment at: lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:1362
+
+  NativeThreadLinux &thread = *GetThreadByID(GetID());
+  assert(thread.GetState() == eStateStopped);
----------------
jankratochvil wrote:
> 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
> simplified and deGPLed as: https://people.redhat.com/jkratoch/leader-exit2.C
> Just 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
> But if this bug was fixed then I think this statement could SEGV (unless LLDB will have some internal zombie TID==PID).
> 
Thanks for catching that. I had a vague feeling that it might be possible for the process to outlive its main thread, but I didn't know how. I've changed this to `GetCurrentThread` which should be always present.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89124/new/

https://reviews.llvm.org/D89124



More information about the lldb-commits mailing list