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

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 12 12:54:24 PDT 2020


jankratochvil accepted this revision.
jankratochvil added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:1362
+
+  NativeThreadLinux &thread = *GetThreadByID(GetID());
+  assert(thread.GetState() == eStateStopped);
----------------
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).



================
Comment at: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp:1237
+                              lldb_rdx_x86_64, lldb_r10_x86_64, lldb_r8_x86_64,
+                              lldb_r9_x86_64};
+    return SyscallData{Syscall, Args, lldb_rax_x86_64};
----------------
static const ... (4x)


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