63 lines · cpp
1// REQUIRES: lld2 3// Test if we build a mixed binary where one .o file has a .debug_names and4// another doesn't have one, that we save a full or partial index cache.5// Previous versions of LLDB would have ManualDWARFIndex.cpp that would save out6// an index cache to the same file regardless of wether the index cache was a7// full DWARF manual index, or just the CUs and TUs that were missing from any8// .debug_names tables. If the user had a .debug_names table and debugged once9// with index caching enabled, then debugged again but set the setting to ignore10// .debug_names ('settings set plugin.symbol-file.dwarf.ignore-file-indexes 1')11// this could cause LLDB to load the index cache from the previous run which12// was incomplete and it only contained the manually indexed DWARF from the run13// where we used .debug_names, but it would now load it as if it were the14// complete DWARF index.15 16// Test that if we don't have .debug_names, that we save a full DWARF index.17// RUN: %clangxx -target x86_64-pc-linux -gsplit-dwarf -gdwarf-5 -DMAIN=1 -c %s -o %t.main.o18// RUN: %clangxx -target x86_64-pc-linux -gsplit-dwarf -gdwarf-5 -DMAIN=0 -c %s -o %t.foo.o19// RUN: ld.lld %t.main.o %t.foo.o -o %t.nonames20// RUN: llvm-dwp %t.main.dwo %t.foo.dwo -o %t.nonames.dwp21// RUN: rm %t.main.dwo %t.foo.dwo22// Run one time with the index cache enabled to populate the index cache. When23// we populate the index cache we have to parse all of the DWARF debug info24// and it is always available.25// RUN: rm -rf %t.lldb-index-cache26// RUN: %lldb \27// RUN: -O 'settings set symbols.enable-lldb-index-cache true' \28// RUN: -O 'settings set symbols.lldb-index-cache-path %t.lldb-index-cache' \29// RUN: -O 'settings set target.preload-symbols true' \30// RUN: %t.nonames -b31 32// Make sure there is a file with "dwarf-index-full" in its filename33// RUN: ls %t.lldb-index-cache | FileCheck %s -check-prefix=FULL34// FULL: {{dwp-index-cache.cpp.tmp.nonames.*-dwarf-index-full-}}35 36// Test that if we have one .o file with .debug_names and one without, that we37// save a partial DWARF index.38// RUN: %clangxx -target x86_64-pc-linux -gsplit-dwarf -gdwarf-5 -DMAIN=1 -c %s -o %t.main.o -gpubnames39// RUN: %clangxx -target x86_64-pc-linux -gsplit-dwarf -gdwarf-5 -DMAIN=0 -c %s -o %t.foo.o40// RUN: ld.lld %t.main.o %t.foo.o -o %t.somenames41// RUN: llvm-dwp %t.main.dwo %t.foo.dwo -o %t.somenames.dwp42// RUN: rm %t.main.dwo %t.foo.dwo43// Run one time with the index cache enabled to populate the index cache. When44// we populate the index cache we have to parse all of the DWARF debug info45// and it is always available.46// RUN: rm -rf %t.lldb-index-cache47// RUN: %lldb \48// RUN: -O 'settings set symbols.enable-lldb-index-cache true' \49// RUN: -O 'settings set symbols.lldb-index-cache-path %t.lldb-index-cache' \50// RUN: -O 'settings set target.preload-symbols true' \51// RUN: %t.somenames -b52 53// Make sure there is a file with "dwarf-index-full" in its filename54// RUN: ls %t.lldb-index-cache | FileCheck %s -check-prefix=PARTIAL55// PARTIAL: {{dwp-index-cache.cpp.tmp.somenames.*-dwarf-index-partial-}}56 57#if MAIN58extern int foo();59int main() { return foo(); }60#else61int foo() { return 0; }62#endif63