[Lldb-commits] [PATCH] D92223: [lldb] Add support for looking up static const members

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 16 14:41:47 PDT 2021


jankratochvil added a comment.

Based on https://reviews.llvm.org/D92643#inline-925368 where the DIE traversal cannot performance-reasonably implement `target variable -r` I am returning here whether the `.debug_names` index could not be rather extended/improved. LLDB would fall back to `ManualDWARFIndex` if the on-disk index version is lower than what LLDB knows. For example GDB `.gdb_index` is now at version 8, GDB has also a use-deprecated-index-sections <https://sourceware.org/gdb/current/onlinedocs/gdb/Index-Files.html> setting.

In D92223#2422184 <https://reviews.llvm.org/D92223#2422184>, @labath wrote:

> I am also worried about the increase to the manual index size, as this would mean that every occurrence of the DW_TAG_member would be placed in the index, whereas now we only place the one which has a location (which is normally just in a single compile unit).

Only occurences which define (not declare) a static const member would be stored. I have measured it using https://people.redhat.com/jkratoch/lldb-staticconst.patch tested on a sample file `bin/clang-13` being built `-O0 -g -fno-lto` using:

  time cmake ../llvm-monorepo/llvm/ -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_LINKER=lld -DLLVM_ENABLE_PROJECTS="lldb;clang;lld" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_USE_SPLIT_DWARF=OFF -DCMAKE_CXX_FLAGS="-gdwarf-5 -gpubnames" -DCMAKE_C_FLAGS="-gdwarf-5 -gpubnames" -GNinja;ninja ...;llvm-objcopy -R .debug_names bin/clang-13

And it **increases the index size by 1.4%** (by number of `DW_IDX_die_offset` entries, 14964676+210528). I find such increase worth the static const members effective access. The question is whether `bin/clang-13` is a good sample binary.
That sure assumes an upstream DWARF discussion+update of the `.debug_names` format (and then there is the Apple index).

The static const members could be (based on a DWARF discussion) stored also only for one CU but I do not think it is needed given the size increase is not significant.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92223



More information about the lldb-commits mailing list