[Lldb-commits] [PATCH] D121631: Introduce new symbol on-demand for debug info

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 14 14:49:06 PDT 2022


clayborg added a comment.

I have been working with Jeffrey on this feature and wanted to explain our thoughts a bit.

We wanted to solve the issue of having too much debug information in your project and having debugging being slowed down by all of this information. Much of this information is not required at all times and a few global debug info queries can end up pulling in all of the debug information and causing performance issues.

Our solution was to create a SymbolFileOnDemand class that will own the actual SymbolFile subclass as a member variable. This SymbolFileOnDemand class can then pick and choose when the "turn on" the debug information for each module depending on what kind of queries are sent to these objects.

As Jeffrey said the main triggers for enabling debug information are:

- set a file and line breakpoint in the module. We always allow these queries to access the line tables in the debug information, and if a source file and line breakpoint are found, then debug info is turned on and all queries to SymbolFileOnDemand will be passed directly to the subclass (SymbolFileDWARF for example).
- if a stack trace has stack frames with a PC value that is in a library, then we turn on debug info. We do this by seeing when we get a "resolve this lldb_private::Address into a symbol context with debug info". We assume anyone that has resolved a section offset address (lldb_private::Address) and then asks for a symbol context to be resolved is knowing they want debug info from this module
- a call to FindFunctions will enable debug info if we find a match in the symbol table, so this on demand symbol feature will work better if users don't strip their binaries
- a call to find global variables, which will enable debug info if we find a symbol that matches. Again, this demand symbol feature will work better if users don't strip their binaries

Our goal here is to allow users to have all the debug information they want, but try to only use the debug information that we need and stem the costs of global lookups in debug information when we can. We want this feature to not require any additional settings to work well other than enabling it, but we also realize we can add settings in the future to say "always load debug info for these modules" or "never load debug info for these modules.

Since most users in IDE settings will set file and line breakpoints during debugging, we are hoping this feature "just works" for most users. Since any stack frames in any threads that are being displayed in the IDE will cause the debug info to be loaded for those modules, the most relevant code to the user will always have debug info enabled.



================
Comment at: include/lldb/Symbol/SymbolFileOnDemand.h:1-2
+//===-- SymbolFileOnDemand.h --------------------------------------*- C++
+//-*-===//
+//
----------------
Make this on the same line and avoid the wrapping


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121631/new/

https://reviews.llvm.org/D121631



More information about the lldb-commits mailing list