1 | // REQUIRES: lld |
2 | |
3 | // Test if we build a mixed binary where one .o file has a .debug_names and |
4 | // 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 out |
6 | // an index cache to the same file regardless of wether the index cache was a |
7 | // full DWARF manual index, or just the CUs and TUs that were missing from any |
8 | // .debug_names tables. If the user had a .debug_names table and debugged once |
9 | // with index caching enabled, then debugged again but set the setting to ignore |
10 | // .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 which |
12 | // was incomplete and it only contained the manually indexed DWARF from the run |
13 | // where we used .debug_names, but it would now load it as if it were the |
14 | // complete DWARF index. |
15 | |
16 | // Test that if we don't have .debug_names, that we save a full DWARF index. |
17 | // RUN: %clang -target x86_64-pc-linux -gsplit-dwarf -gdwarf-5 -DMAIN=1 -c %s -o %t.main.o |
18 | // RUN: %clang -target x86_64-pc-linux -gsplit-dwarf -gdwarf-5 -DMAIN=0 -c %s -o %t.foo.o |
19 | // RUN: ld.lld %t.main.o %t.foo.o -o %t.nonames |
20 | // RUN: llvm-dwp %t.main.dwo %t.foo.dwo -o %t.nonames.dwp |
21 | // RUN: rm %t.main.dwo %t.foo.dwo |
22 | // Run one time with the index cache enabled to populate the index cache. When |
23 | // we populate the index cache we have to parse all of the DWARF debug info |
24 | // and it is always available. |
25 | // RUN: rm -rf %t.lldb-index-cache |
26 | // 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 -b |
31 | |
32 | // Make sure there is a file with "dwarf-index-full" in its filename |
33 | // RUN: ls %t.lldb-index-cache | FileCheck %s -check-prefix=FULL |
34 | // 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 we |
37 | // save a partial DWARF index. |
38 | // RUN: %clang -target x86_64-pc-linux -gsplit-dwarf -gdwarf-5 -DMAIN=1 -c %s -o %t.main.o -gpubnames |
39 | // RUN: %clang -target x86_64-pc-linux -gsplit-dwarf -gdwarf-5 -DMAIN=0 -c %s -o %t.foo.o |
40 | // RUN: ld.lld %t.main.o %t.foo.o -o %t.somenames |
41 | // RUN: llvm-dwp %t.main.dwo %t.foo.dwo -o %t.somenames.dwp |
42 | // RUN: rm %t.main.dwo %t.foo.dwo |
43 | // Run one time with the index cache enabled to populate the index cache. When |
44 | // we populate the index cache we have to parse all of the DWARF debug info |
45 | // and it is always available. |
46 | // RUN: rm -rf %t.lldb-index-cache |
47 | // 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 -b |
52 | |
53 | // Make sure there is a file with "dwarf-index-full" in its filename |
54 | // RUN: ls %t.lldb-index-cache | FileCheck %s -check-prefix=PARTIAL |
55 | // PARTIAL: {{dwp-index-cache.cpp.tmp.somenames.*-dwarf-index-partial-}} |
56 | |
57 | #if MAIN |
58 | extern int foo(); |
59 | int main() { return foo(); } |
60 | #else |
61 | int foo() { return 0; } |
62 | #endif |
63 | |