[Lldb-commits] [PATCH] D113789: Add the ability to cache information for a module between debugger instances.

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 12 11:54:56 PST 2021


clayborg created this revision.
clayborg added reviewers: jingham, labath, JDevlieghere, wallace, aadsm.
Herald added subscribers: mgorny, emaste.
clayborg requested review of this revision.
Herald added subscribers: lldb-commits, MaskRay.
Herald added a project: LLDB.

Added the ability to cache the finalized symbol tables as a proof of concept and as a way to discuss caching items for a given module to allow subsequent debug sessions to start faster.

Module caching must be enabled by the user before this can be used:

(lldb) settings set symbols.enable-lldb-modules-cache true

There is also a setting that allows the user to specify a module cache directory that defaults to a directory that defaults to being next to the symbols.clang-modules-cache-path directory in a temp directory:

(lldb) settings show symbols.lldb-modules-cache-path

If this setting is enabled, the finalized symbol tables will be serialized and saved to disc so they can be quickly loaded next time you debug.

Each module gets a cache directory in the "symbols.lldb-modules-cache-path" directory. A directory is created in the cache directory that uses the module's basename as a directory and then a hash is created for the module which incorporates the full path to the executable, the architecture, the object name offset and modification time (if any). This allows universal mach-o files to support caching multuple architectures in the same module cache directory. Making the directory based on the this info allows this directory's contents to be deleted and replaced when the file gets updated on disk. This keeps the cache from growing over time during the compile/edit/debug cycle and prevents out of space issues.

If the cache is enabled, the symbol table will be loaded from the cache the next time you debug if the module has not changed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113789

Files:
  lldb/include/lldb/Core/Mangled.h
  lldb/include/lldb/Core/Module.h
  lldb/include/lldb/Core/ModuleList.h
  lldb/include/lldb/Host/FileSystem.h
  lldb/include/lldb/Symbol/ObjectFile.h
  lldb/include/lldb/Symbol/Symbol.h
  lldb/include/lldb/Symbol/Symtab.h
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/source/API/SBDebugger.cpp
  lldb/source/Core/CoreProperties.td
  lldb/source/Core/Mangled.cpp
  lldb/source/Core/Module.cpp
  lldb/source/Core/ModuleList.cpp
  lldb/source/Host/common/FileSystem.cpp
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/source/Symbol/CMakeLists.txt
  lldb/source/Symbol/ObjectFile.cpp
  lldb/source/Symbol/Symbol.cpp
  lldb/source/Symbol/Symtab.cpp
  lldb/test/API/functionalities/module_cache/bsd/Makefile
  lldb/test/API/functionalities/module_cache/bsd/TestModuleCacheBSD.py
  lldb/test/API/functionalities/module_cache/bsd/a.c
  lldb/test/API/functionalities/module_cache/bsd/b.c
  lldb/test/API/functionalities/module_cache/bsd/c.c
  lldb/test/API/functionalities/module_cache/bsd/main.c
  lldb/test/API/functionalities/module_cache/simple_exe/Makefile
  lldb/test/API/functionalities/module_cache/simple_exe/TestModuleCacheSimple.py
  lldb/test/API/functionalities/module_cache/simple_exe/main.c
  lldb/test/API/functionalities/module_cache/universal/Makefile
  lldb/test/API/functionalities/module_cache/universal/TestModuleCacheUniversal.py
  lldb/test/API/functionalities/module_cache/universal/main.c
  lldb/test/API/macosx/universal/main.c
  lldb/unittests/Symbol/CMakeLists.txt
  lldb/unittests/Symbol/SymbolTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113789.386906.patch
Type: text/x-patch
Size: 62435 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211112/8012782f/attachment-0001.bin>


More information about the lldb-commits mailing list