brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.3 KiB · f625fda Raw
187 lines · cpp
1// REQUIRES: lld, python2 3// Now test with DWARF54// RUN: %clangxx -target x86_64-pc-linux -gsplit-dwarf -gdwarf-5 -c %s -o %t.dwarf5.o5// RUN: ld.lld %t.dwarf5.o -o %t.dwarf56// RUN: llvm-dwp %t.dwarf5.dwo -o %t.dwarf5.dwp7// RUN: rm %t.dwarf5.dwo8// RUN: llvm-objcopy --only-keep-debug %t.dwarf5 %t.dwarf5.debug9// RUN: llvm-objcopy --strip-all --add-gnu-debuglink=%t.dwarf5.debug %t.dwarf510// RUN: %lldb \11// RUN:   -O "log enable dwarf split" \12// RUN:   -o "target variable a" \13// RUN:   -b %t.dwarf5 | FileCheck %s14 15// Run one time with the index cache enabled to populate the index cache. When16// we populate the index cache we have to parse all of the DWARF debug info17// and it is always available.18// RUN: rm -rf %t.lldb-index-cache19// RUN: %lldb \20// RUN:   -O 'settings set symbols.enable-lldb-index-cache true' \21// RUN:   -O 'settings set symbols.lldb-index-cache-path %t.lldb-index-cache' \22// RUN:   -O 'settings set target.preload-symbols false' \23// RUN:   -o "script lldb.target.modules[0].FindTypes('::A').GetTypeAtIndex(0)" \24// RUN:   -o "statistics dump" \25// RUN:   %t.dwarf5 -b | FileCheck %s -check-prefix=CACHE26 27// Run again after index cache was enabled, which load the index cache. When we28// load the index cache from disk, we don't have any DWARF parsed yet and this29// can cause us to try and access information in the .dwp directly without30// parsing the .debug_info, but this caused crashes when the DWO files didn't31// have a backlink to the skeleton compile unit. This test verifies that we32// don't crash and that we can find types when using .dwp files.33// RUN: %lldb \34// RUN:   -O 'settings set symbols.enable-lldb-index-cache true' \35// RUN:   -O 'settings set symbols.lldb-index-cache-path %t.lldb-index-cache' \36// RUN:   -O 'settings set target.preload-symbols false' \37// RUN:   -o "script lldb.target.modules[0].FindTypes('::A').GetTypeAtIndex(0)" \38// RUN:   -o "statistics dump" \39// RUN:   %t.dwarf5 -b | FileCheck %s -check-prefix=CACHED40 41// Make sure that if we load the "%t.dwarf5.debug" file, that we can find and42// load the .dwo file from the .dwp when it is "%t.dwarf5.dwp"43// RUN: %lldb %t.dwarf5.debug -o "b main" -b | FileCheck %s -check-prefix=DEBUG44 45// Make sure that if we load the "%t.dwarf5" file, that we can find and46// load the .dwo file from the .dwp when it is "%t.dwarf5.debug.dwp"47// RUN: mv %t.dwarf5.dwp %t.dwarf5.debug.dwp48// RUN: %lldb %t.dwarf5 -o "b main" -b | FileCheck %s -check-prefix=DEBUG49 50// Make sure that if we load the "%t.dwarf5.debug" file, that we can find and51// load the .dwo file from the .dwp when it is "%t.dwarf5.debug.dwp"52// RUN: %lldb %t.dwarf5.debug -o "b main" -b | FileCheck %s -check-prefix=DEBUG53 54// Make sure that if we remove the .dwp file we see an appropriate error.55// RUN: rm %t.dwarf5.debug.dwp56// RUN: %lldb \57// RUN:   -O "log enable dwarf split" \58// RUN:   -o "b main" \59// RUN:   -b %t.dwarf5 2>&1 | FileCheck %s -check-prefix=NODWP60 61// RUN: %lldb \62// RUN:   -O "log enable dwarf split" \63// RUN:   -o "b main" \64// RUN:   -b %t.dwarf5.debug 2>&1 | FileCheck %s -check-prefix=NODWP65 66// Now test with DWARF467// RUN: %clangxx -target x86_64-pc-linux -gsplit-dwarf -gdwarf-4 -c %s -o %t.dwarf4.o68// RUN: ld.lld %t.dwarf4.o -o %t.dwarf469// RUN: llvm-dwp %t.dwarf4.dwo -o %t.dwarf4.dwp70// RUN: rm %t.dwarf4.dwo71// RUN: llvm-objcopy --only-keep-debug %t.dwarf4 %t.dwarf4.debug72// RUN: llvm-objcopy --strip-all --add-gnu-debuglink=%t.dwarf4.debug %t.dwarf473// RUN: %lldb \74// RUN:   -O "log enable dwarf split" \75// RUN:   -o "target variable a" \76// RUN:   -b %t.dwarf4 | FileCheck %s77 78// Run one time with the index cache enabled to populate the index cache. When79// we populate the index cache we have to parse all of the DWARF debug info80// and it is always available.81// RUN: rm -rf %t.lldb-index-cache82// RUN: %lldb \83// RUN:   -O 'settings set symbols.enable-lldb-index-cache true' \84// RUN:   -O 'settings set symbols.lldb-index-cache-path %t.lldb-index-cache' \85// RUN:   -O 'settings set target.preload-symbols false' \86// RUN:   -o "script lldb.target.modules[0].FindTypes('::A').GetTypeAtIndex(0)" \87// RUN:   -o "statistics dump" \88// RUN:   %t.dwarf4 -b | FileCheck %s -check-prefix=CACHE89 90// Run again after index cache was enabled, which load the index cache. When we91// load the index cache from disk, we don't have any DWARF parsed yet and this92// can cause us to try and access information in the .dwp directly without93// parsing the .debug_info, but this caused crashes when the DWO files didn't94// have a backlink to the skeleton compile unit. This test verifies that we95// don't crash and that we can find types when using .dwp files.96// RUN: %lldb \97// RUN:   -O 'settings set symbols.enable-lldb-index-cache true' \98// RUN:   -O 'settings set symbols.lldb-index-cache-path %t.lldb-index-cache' \99// RUN:   -O 'settings set target.preload-symbols false' \100// RUN:   -o "script lldb.target.modules[0].FindTypes('::A').GetTypeAtIndex(0)" \101// RUN:   -o "statistics dump" \102// RUN:   %t.dwarf4 -b | FileCheck %s -check-prefix=CACHED103 104// Make sure that if we load the "%t.dwarf4.debug" file, that we can find and105// load the .dwo file from the .dwp when it is "%t.dwarf4.dwp"106// RUN: %lldb %t.dwarf4.debug -o "b main" -b | FileCheck %s -check-prefix=DEBUG107 108// Make sure that if we load the "%t.dwarf4" file, that we can find and109// load the .dwo file from the .dwp when it is "%t.dwarf4.debug.dwp"110// RUN: mv %t.dwarf4.dwp %t.dwarf4.debug.dwp111// RUN: %lldb %t.dwarf4 -o "b main" -b | FileCheck %s -check-prefix=DEBUG112 113// Make sure that if we load the "%t.dwarf4.debug" file, that we can find and114// load the .dwo file from the .dwp when it is "%t.dwarf4.debug.dwp"115// RUN: %lldb %t.dwarf4.debug -o "b main" -b | FileCheck %s -check-prefix=DEBUG116 117// Make sure that if we remove the .dwp file we see an appropriate error.118// RUN: rm %t.dwarf4.debug.dwp119// RUN: %lldb \120// RUN:   -O "log enable dwarf split" \121// RUN:   -o "b main" \122// RUN:   -b %t.dwarf4 2>&1 | FileCheck %s -check-prefix=NODWP123 124// RUN: %lldb \125// RUN:   -O "log enable dwarf split" \126// RUN:   -o "b main" \127// RUN:   -b %t.dwarf4.debug 2>&1 | FileCheck %s -check-prefix=NODWP128 129// Test if we have a GNU build ID in our main executable and in our debug file,130// and we have a .dwp file that doesn't, that we can still load our .dwp file.131// RUN: %clangxx -target x86_64-pc-linux -gsplit-dwarf -gdwarf-5 -c %s -o %t.o132// RUN: ld.lld %t.o --build-id=md5 -o %t133// RUN: llvm-dwp %t.dwo -o %t.dwp134// RUN: rm %t.dwo135// RUN: llvm-objcopy --only-keep-debug %t %t.debug136// RUN: llvm-objcopy --strip-all --add-gnu-debuglink=%t.debug %t137// RUN: %lldb \138// RUN:   -O "log enable dwarf split" \139// RUN:   -o "target variable a" \140// RUN:   -b %t | FileCheck %s141 142// Now move the .debug and .dwp file into another directory so that we can use143// the target.debug-file-search-paths setting to search for the files.144// RUN: mkdir -p %t-debug-info-dir145// RUN: mv %t.dwp %t-debug-info-dir146// RUN: mv %t.debug %t-debug-info-dir147// RUN: %lldb \148// RUN:   -O "log enable dwarf split" \149// RUN:   -O "setting set target.debug-file-search-paths '%t-debug-info-dir'" \150// RUN:   -o "target variable a" \151// RUN:   -b %t | FileCheck %s152// RUN:153 154// Now move the .debug and .dwp file into another directory so that we can use155// the target.debug-file-search-paths setting to search for the files.156// CHECK: Searching for DWP using:157// CHECK: Found DWP file:158// CHECK: (A) a = (x = 47)159 160// CACHE: script lldb.target.modules[0].FindTypes('::A').GetTypeAtIndex(0)161// CACHE: struct A {162// CACHE-NEXT: int x;163// CACHE-NEXT: }164// CACHE: "totalDebugInfoIndexSavedToCache": 1165 166// CACHED: script lldb.target.modules[0].FindTypes('::A').GetTypeAtIndex(0)167// CACHED: struct A {168// CACHED-NEXT: int x;169// CACHED-NEXT: }170// CACHED: "totalDebugInfoIndexLoadedFromCache": 1171 172// Make sure debug information was loaded by verifying that the173// DEBUG: Breakpoint 1: where = dwp-separate-debug-file.cpp.tmp.dwarf{{[45]}}{{(\.debug)?}}`main + {{[0-9]+}} at dwp-separate-debug-file.cpp:{{[0-9]+}}:{{[0-9]+}}, address = {{0x[0-9a-fA-F]+}}174 175// Make sure if we load the stripped binary or the debug info file with no .dwp176// nor any .dwo files that we are not able to fine the .dwp or .dwo files.177// NODWP: Searching for DWP using:178// NODWP: Searching for DWP using:179// NODWP: Unable to locate for DWP file for:180// NODWP: unable to locate separate debug file (dwo, dwp). Debugging will be degraded.181 182struct A {183  int x = 47;184};185A a;186int main() {}187