[all-commits] [llvm/llvm-project] e64cc7: [lldb-server/linux] Use waitpid(-1) to collect inf...

Pavel Labath via All-commits all-commits at lists.llvm.org
Thu Mar 30 03:48:53 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e64cc756819d567f453467bf7cc16599ad296fdd
      https://github.com/llvm/llvm-project/commit/e64cc756819d567f453467bf7cc16599ad296fdd
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2023-03-30 (Thu, 30 Mar 2023)

  Changed paths:
    M lldb/include/lldb/Host/common/NativeProcessProtocol.h
    M lldb/source/Host/common/NativeProcessProtocol.cpp
    M lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp
    M lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.h
    M lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
    M lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
    M lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
    M lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
    M lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
    M lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.h
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
    M lldb/tools/lldb-server/lldb-gdbserver.cpp

  Log Message:
  -----------
  [lldb-server/linux] Use waitpid(-1) to collect inferior events

This is a follow-up to D116372, which had a rather unfortunate side
effect of making the processing of a single SIGCHLD quadratic in the
number of threads -- which does not matter for simple applications, but
can get really bad for applications with thousands of threads.

This patch fixes the problem by implementing the other possibility
mentioned in the first patch -- doing waitpid(-1) centrally and then
routing the events to the correct process instance. The "uncollected"
threads are held in the process factory class -- which I've renamed to
Manager for this purpose, as it now does more than creating processes.

Differential Revision: https://reviews.llvm.org/D146977




More information about the All-commits mailing list