Skip to content

Commit 6307628

Browse files
committed
Added a dwarf4 test.
1 parent 90cfa47 commit 6307628

File tree

1 file changed

+44
-9
lines changed

1 file changed

+44
-9
lines changed

lldb/test/Shell/SymbolFile/DWARF/x86/dwp-separate-debug-file.cpp

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// REQUIRES: lld
22

3-
// RUN: %clang -target x86_64-pc-linux -gsplit-dwarf -g -c %s -o %t.o
4-
// RUN: ld.lld %t.o -o %t
5-
// RUN: llvm-dwp %t.dwo -o %t.dwp
6-
// RUN: rm %t.dwo
7-
// RUN: llvm-objcopy --only-keep-debug %t %t.debug
8-
// RUN: llvm-objcopy --strip-all --add-gnu-debuglink=%t.debug %t
9-
// RUN: %lldb %t -o "target variable a" -b | FileCheck %s
3+
// RUN: %clang -target x86_64-pc-linux -gsplit-dwarf -gdwarf-5 -c %s -o %t.dwarf5.o
4+
// RUN: ld.lld %t.dwarf5.o -o %t.dwarf5
5+
// RUN: llvm-dwp %t.dwarf5.dwo -o %t.dwarf5.dwp
6+
// RUN: rm %t.dwarf5.dwo
7+
// RUN: llvm-objcopy --only-keep-debug %t.dwarf5 %t.dwarf5.debug
8+
// RUN: llvm-objcopy --strip-all --add-gnu-debuglink=%t.dwarf5.debug %t.dwarf5
9+
// RUN: %lldb %t.dwarf5 -o "target variable a" -b | FileCheck %s
1010

1111
// Run one time with the index cache enabled to populate the index cache. When
1212
// we populate the index cache we have to parse all of the DWARF debug info
@@ -18,7 +18,7 @@
1818
// RUN: -O 'settings set target.preload-symbols false' \
1919
// RUN: -o "script lldb.target.modules[0].FindTypes('::A').GetTypeAtIndex(0)" \
2020
// RUN: -o "statistics dump" \
21-
// RUN: %t -b | FileCheck %s -check-prefix=CACHE
21+
// RUN: %t.dwarf5 -b | FileCheck %s -check-prefix=CACHE
2222

2323
// Run again after index cache was enabled, which load the index cache. When we
2424
// load the index cache from disk, we don't have any DWARF parsed yet and this
@@ -32,7 +32,42 @@
3232
// RUN: -O 'settings set target.preload-symbols false' \
3333
// RUN: -o "script lldb.target.modules[0].FindTypes('::A').GetTypeAtIndex(0)" \
3434
// RUN: -o "statistics dump" \
35-
// RUN: %t -b | FileCheck %s -check-prefix=CACHED
35+
// RUN: %t.dwarf5 -b | FileCheck %s -check-prefix=CACHED
36+
37+
// Now test with DWARF4
38+
// RUN: %clang -target x86_64-pc-linux -gsplit-dwarf -gdwarf-4 -c %s -o %t.dwarf4.o
39+
// RUN: ld.lld %t.dwarf4.o -o %t.dwarf4
40+
// RUN: llvm-dwp %t.dwarf4.dwo -o %t.dwarf4.dwp
41+
// RUN: rm %t.dwarf4.dwo
42+
// RUN: llvm-objcopy --only-keep-debug %t.dwarf4 %t.dwarf4.debug
43+
// RUN: llvm-objcopy --strip-all --add-gnu-debuglink=%t.dwarf4.debug %t.dwarf4
44+
// RUN: %lldb %t.dwarf4 -o "target variable a" -b | FileCheck %s
45+
46+
// Run one time with the index cache enabled to populate the index cache. When
47+
// we populate the index cache we have to parse all of the DWARF debug info
48+
// and it is always available.
49+
// RUN: rm -rf %T/lldb-index-cache
50+
// RUN: %lldb \
51+
// RUN: -O 'settings set symbols.enable-lldb-index-cache true' \
52+
// RUN: -O 'settings set symbols.lldb-index-cache-path %T/lldb-index-cache' \
53+
// RUN: -O 'settings set target.preload-symbols false' \
54+
// RUN: -o "script lldb.target.modules[0].FindTypes('::A').GetTypeAtIndex(0)" \
55+
// RUN: -o "statistics dump" \
56+
// RUN: %t.dwarf4 -b | FileCheck %s -check-prefix=CACHE
57+
58+
// Run again after index cache was enabled, which load the index cache. When we
59+
// load the index cache from disk, we don't have any DWARF parsed yet and this
60+
// can cause us to try and access information in the .dwp directly without
61+
// parsing the .debug_info, but this caused crashes when the DWO files didn't
62+
// have a backlink to the skeleton compile unit. This test verifies that we
63+
// don't crash and that we can find types when using .dwp files.
64+
// RUN: %lldb \
65+
// RUN: -O 'settings set symbols.enable-lldb-index-cache true' \
66+
// RUN: -O 'settings set symbols.lldb-index-cache-path %T/lldb-index-cache' \
67+
// RUN: -O 'settings set target.preload-symbols false' \
68+
// RUN: -o "script lldb.target.modules[0].FindTypes('::A').GetTypeAtIndex(0)" \
69+
// RUN: -o "statistics dump" \
70+
// RUN: %t.dwarf4 -b | FileCheck %s -check-prefix=CACHED
3671

3772
// CHECK: (A) a = (x = 47)
3873

0 commit comments

Comments
 (0)