[all-commits] [llvm/llvm-project] c2f945: [lldb] Add SBModule::GarbageCollectAllocatedModule...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Mon Aug 17 02:01:00 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c2f9454a16e45e1df09d8ebed6dadbc0da264442
      https://github.com/llvm/llvm-project/commit/c2f9454a16e45e1df09d8ebed6dadbc0da264442
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2020-08-17 (Mon, 17 Aug 2020)

  Changed paths:
    M lldb/bindings/interface/SBModule.i
    M lldb/include/lldb/API/SBModule.h
    M lldb/packages/Python/lldbsuite/test/lldbtest.py
    M lldb/source/API/SBModule.cpp

  Log Message:
  -----------
  [lldb] Add SBModule::GarbageCollectAllocatedModules and clear modules after each test run

Right now the only places in the SB API where lldb:: ModuleSP instances are
destroyed are in SBDebugger::MemoryPressureDetected (where it's just attempted
but not guaranteed) and in SBDebugger::DeleteTarget (which will be removed in
D83933). Tests that directly create an lldb::ModuleSP and never create a target
therefore currently leak lldb::Module instances. This triggers the sanity checks
in lldbtest that make sure that the global module list is empty after a test.

This patch adds SBModule::GarbageCollectAllocatedModules as an explicit way to
clean orphaned lldb::ModuleSP instances. Also we now start calling this method
at the end of each test run and move the sanity check behind that call to make
this work. This way even tests that don't create targets can pass the sanity
check.

This fixes TestUnicodeSymbols.py when D83865 is applied (which makes that the
sanity checks actually fail the test).

Reviewed By: JDevlieghere

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




More information about the All-commits mailing list