[all-commits] [llvm/llvm-project] 61bfc7: [lldb] GetSharedModule: Collect old modules in Sma...

Joseph Tremoulet via All-commits all-commits at lists.llvm.org
Fri Oct 30 12:14:53 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 61bfc703c3d36fbefc476cd3829065d983c1c792
      https://github.com/llvm/llvm-project/commit/61bfc703c3d36fbefc476cd3829065d983c1c792
  Author: Joseph Tremoulet <jotrem at microsoft.com>
  Date:   2020-10-30 (Fri, 30 Oct 2020)

  Changed paths:
    M lldb/include/lldb/Core/ModuleList.h
    M lldb/include/lldb/Target/Platform.h
    M lldb/source/Core/ModuleList.cpp
    M lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
    M lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
    M lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
    M lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
    M lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
    M lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
    M lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
    M lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
    M lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
    M lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h
    M lldb/source/Target/Platform.cpp
    M lldb/source/Target/Target.cpp

  Log Message:
  -----------
  [lldb] GetSharedModule: Collect old modules in SmallVector

The various GetSharedModule methods have an optional out parameter for
the old module when a file has changed or been replaced, which the
Target uses to keep its module list current/correct.  We've been using
a single ModuleSP to track "the" old module, and this change switches
to using a SmallVector of ModuleSP, which has a couple benefits:
 - There are multiple codepaths which may discover an old module, and
   this centralizes the code for how to handle multiples in one place,
   in the Target code.  With the single ModuleSP, each place that may
   discover an old module is responsible for how it handles multiples,
   and the current code is inconsistent (some code paths drop the first
   old module, others drop the second).
 - The API will be more natural for identifying old modules in routines
   that work on sets, like ModuleList::ReplaceEquivalent (which I plan
   on updating to report old module(s) in a subsequent change to fix a
   bug).

I'm not convinced we can ever actually run into the case that multiple
old modules are found in the same GetOrCreateModule call, but I think
this change makes sense regardless, in light of the above.

When an old module is reported, Target::GetOrCreateModule calls
m_images.ReplaceModule, which doesn't allow multiple "old" modules; the
new code calls ReplaceModule for the first "old" module, and for any
subsequent old modules it logs the event and calls m_images.Remove.

Reviewed By: jingham

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


  Commit: d20aa7ca422145fb4d07e16c1d0aa7de9e3554ea
      https://github.com/llvm/llvm-project/commit/d20aa7ca422145fb4d07e16c1d0aa7de9e3554ea
  Author: Joseph Tremoulet <jotrem at microsoft.com>
  Date:   2020-10-30 (Fri, 30 Oct 2020)

  Changed paths:
    M lldb/include/lldb/Core/ModuleList.h
    M lldb/source/Core/ModuleList.cpp
    M lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py

  Log Message:
  -----------
  [lldb] Report old modules from ModuleList::ReplaceEquivalent

This allows the Target to update its module list when loading a shared
module replaces an equivalent one.

A testcase is added which hits this codepath -- without the fix, the
target reports libbreakpad.so twice in its module list.

Reviewed By: jingham

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


Compare: https://github.com/llvm/llvm-project/compare/7aac3a904887...d20aa7ca4221


More information about the All-commits mailing list