[all-commits] [llvm/llvm-project] 326d23: [lldb] [Process/FreeBSDRemote] Implement thread Ge...

Michał Górny via All-commits all-commits at lists.llvm.org
Tue Nov 3 00:46:39 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 326d235300814e2e38341580bdf04efd226ba83d
      https://github.com/llvm/llvm-project/commit/326d235300814e2e38341580bdf04efd226ba83d
  Author: Michał Górny <mgorny at moritz.systems>
  Date:   2020-11-03 (Tue, 03 Nov 2020)

  Changed paths:
    M lldb/source/Plugins/Process/FreeBSDRemote/NativeThreadFreeBSD.cpp
    M lldb/source/Plugins/Process/FreeBSDRemote/NativeThreadFreeBSD.h

  Log Message:
  -----------
  [lldb] [Process/FreeBSDRemote] Implement thread GetName()

Implement NativeThreadFreeBSD::GetName().  This is based
on the equivalent code in the legacy FreeBSD plugin, except it is
modernized a bit to use llvm::Optional and std::vector for data storage.

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


  Commit: f893b2939781910fd52ad70a30484255a3cf0f6e
      https://github.com/llvm/llvm-project/commit/f893b2939781910fd52ad70a30484255a3cf0f6e
  Author: Michał Górny <mgorny at moritz.systems>
  Date:   2020-11-03 (Tue, 03 Nov 2020)

  Changed paths:
    M lldb/source/Host/freebsd/Host.cpp
    M lldb/source/Host/netbsd/HostNetBSD.cpp

  Log Message:
  -----------
  [lldb] [Host/{free,net}bsd] Fix process matching by name

Fix process matching by name to make 'process attach -n ...' work.

The process finding code has an optimization that defers getting
the process name and executable format after the numeric (PID, UID...)
parameters are tested.  However, the ProcessInstanceInfoMatch.Matches()
method has been matching process name against the incomplete process
information as well, and effectively no process ever matched.

In order to fix this, create a copy of ProcessInstanceInfoMatch, set
it to ignore process name and se this copy for the initial match.
The same fix applies to FreeBSD and NetBSD host code.

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


  Commit: 8e6bcbb41758b3a6c23f1b448fcef6f67fd8c6d0
      https://github.com/llvm/llvm-project/commit/8e6bcbb41758b3a6c23f1b448fcef6f67fd8c6d0
  Author: Michał Górny <mgorny at moritz.systems>
  Date:   2020-11-03 (Tue, 03 Nov 2020)

  Changed paths:
    M lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp

  Log Message:
  -----------
  [lldb] [Process/FreeBSDRemote] Fix attaching via lldb-server

Fix two bugs that caused attaching to a process in a pre-connected
lldb-server to fail.  These are:

1. Prematurely reporting status in NativeProcessFreeBSD::Attach().
   The SetState() call defaulted to notify the process, and LLGS tried
   to send the stopped packet before the process instance was assigned
   to it.  While at it, add an assert for that in LLGS.

2. Duplicate call to ReinitializeThreads() (via SetupTrace()) that
   overwrote the stopped status in threads.  Now SetupTrace() is called
   directly by NativeProcessFreeBSD::Attach() (not the Factory) in place
   of ReinitializeThreads().

This fixes at least commands/process/attach/TestProcessAttach.py
and python_api/hello_world/TestHelloWorld.py.

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


  Commit: 40d26bc4b1854c1e493c500a96a9c9d65a93da59
      https://github.com/llvm/llvm-project/commit/40d26bc4b1854c1e493c500a96a9c9d65a93da59
  Author: Michał Górny <mgorny at moritz.systems>
  Date:   2020-11-03 (Tue, 03 Nov 2020)

  Changed paths:
    M lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
    M lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.h

  Log Message:
  -----------
  [lldb] [Process/FreeBSDRemote] Remove GetSharedLibraryInfoAddress override

Remove the NetBSD-specific override of GetSharedLibraryInfoAddress(),
restoring the generic implementation from NativeProcessELF.

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


  Commit: 952ddc9866dc761e29757c262ce28ca0fa9431ed
      https://github.com/llvm/llvm-project/commit/952ddc9866dc761e29757c262ce28ca0fa9431ed
  Author: Michał Górny <mgorny at moritz.systems>
  Date:   2020-11-03 (Tue, 03 Nov 2020)

  Changed paths:
    M lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp

  Log Message:
  -----------
  [lldb] [Plugins/FreeBSDRemote] Disable GetMemoryRegionInfo()

Disable GetMemoryRegionInfo() in order to unbreak expression parsing.
For some reason, the presence of non-stub function causes LLDB to fail
to detect system libraries correctly.  Through being unable to find
mmap() and allocate memory, this leads to expression parser being
broken.

The issue is non-trivial and it is going to require more time debugging.
On the other hand, the downsides of missing the function are minimal
(2 failing tests), and the benefit of working expression parser
justifies disabling it temporarily.  Furthermore, the old FreeBSD plugin
did not implement it anyway, so it allows us to switch to the new plugin
without major regressions.

The really curious part is that the respective code in the NetBSD plugin
yields very similar results, yet does not seem to break the expression
parser.

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


Compare: https://github.com/llvm/llvm-project/compare/1af3cb5424d5...952ddc9866dc


More information about the All-commits mailing list