Skip to content

Commit 15a6df5

Browse files
committed
[lldb/DWARF/test] Freshen up debug_names tests
These tests used "clang -mllvm -accel-tables=Dwarf" as a way to guarantee that clang will emit the debug_names table. Unfortunately, a change it clang made that insufficient (-gpubnames is required now too), which rendered these tests ineffective. Since lldb automatically falls back to the manual index, the tests didn't fail and this change went largely unnoticed. This patch updates the tests to really use debug_names (-gdwarf-5 -gpubnames) is the combination that works now, and it adds additional checks to ensure the section is actually emitted. Fortunately, no regressions crept in while these tests were disabled.
1 parent c24cf97 commit 15a6df5

12 files changed

+70
-35
lines changed

lldb/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ def test(self):
6262
def test_debug_names(self):
6363
"""Test that we are able to find complete types when using DWARF v5
6464
accelerator tables"""
65-
self.do_test(dict(CFLAGS_EXTRAS="-mllvm -accel-tables=Dwarf"))
65+
self.do_test(dict(CFLAGS_EXTRAS="-gdwarf-5 -gpubnames"))

lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33

44
// REQUIRES: lld, zlib
55

6-
// RUN: %clang -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %s
6+
// RUN: %clang -c -o %t.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames %s
77
// RUN: ld.lld %t.o -o %t --compress-debug-sections=zlib
8+
// RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix NAMES
89
// RUN: lldb-test symbols --find=variable --name=foo %t | FileCheck %s
910

11+
// NAMES: Name: .debug_names
12+
1013
// CHECK: Found 1 variables:
1114
int foo;
12-
// ONE-DAG: name = "foo", type = {{.*}} (int), {{.*}} decl = debug-names-compressed.cpp:[[@LINE-1]]
15+
// CHECK-DAG: name = "foo", type = {{.*}} (int), {{.*}} decl = debug-names-compressed.cpp:[[@LINE-1]]
1316

1417
extern "C" void _start() {}

lldb/test/Shell/SymbolFile/DWARF/dwarf5-index-is-used.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// REQUIRES: lld
44

5-
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf -gpubnames
5+
// RUN: %clang %s -c -o %t.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames
66
// RUN: ld.lld %t.o -o %t
77
// RUN: lldb-test symbols %t | FileCheck %s
88

lldb/test/Shell/SymbolFile/DWARF/dwarf5-partial-index.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33

44
// REQUIRES: lld
55

6-
// RUN: %clang %s -g -c -o %t-1.o --target=x86_64-pc-linux -DONE -mllvm -accel-tables=Dwarf
7-
// RUN: %clang %s -g -c -o %t-2.o --target=x86_64-pc-linux -DTWO -mllvm -accel-tables=Dwarf
6+
// RUN: %clang %s -c -o %t-1.o --target=x86_64-pc-linux -DONE -gdwarf-5 -gpubnames
7+
// RUN: llvm-readobj --sections %t-1.o | FileCheck %s --check-prefix NAMES
8+
// RUN: %clang %s -c -o %t-2.o --target=x86_64-pc-linux -DTWO -gdwarf-5 -gno-pubnames
89
// RUN: ld.lld %t-1.o %t-2.o -o %t
910
// RUN: lldb-test symbols --find=variable --name=foo %t | FileCheck %s
1011

12+
// NAMES: Name: .debug_names
13+
1114
// CHECK: Found 2 variables:
1215
#ifdef ONE
1316
namespace one {

lldb/test/Shell/SymbolFile/DWARF/find-basic-function.cpp

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

3-
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable
3+
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -gno-pubnames
44
// RUN: ld.lld %t.o -o %t
55
// RUN: lldb-test symbols --name=foo --find=function --function-flags=base %t | \
66
// RUN: FileCheck --check-prefix=BASE %s
@@ -21,29 +21,32 @@
2121
// RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \
2222
// RUN: FileCheck --check-prefix=METHOD %s
2323
// RUN: lldb-test symbols --name=foo --find=function --function-flags=full %t | \
24-
// RUN: FileCheck --check-prefix=FULL-APPLE %s
24+
// RUN: FileCheck --check-prefix=FULL-INDEXED %s
2525
// RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full %t | \
2626
// RUN: FileCheck --check-prefix=FULL-MANGLED %s
2727
// RUN: lldb-test symbols --name=foo --context=context --find=function --function-flags=base %t | \
2828
// RUN: FileCheck --check-prefix=CONTEXT %s
2929
// RUN: lldb-test symbols --name=not_there --find=function %t | \
3030
// RUN: FileCheck --check-prefix=EMPTY %s
3131

32-
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf
32+
// RUN: %clang %s -c -o %t.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames
3333
// RUN: ld.lld %t.o -o %t
34+
// RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix NAMES
3435
// RUN: lldb-test symbols --name=foo --find=function --function-flags=base %t | \
3536
// RUN: FileCheck --check-prefix=BASE %s
3637
// RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \
3738
// RUN: FileCheck --check-prefix=METHOD %s
3839
// RUN: lldb-test symbols --name=foo --find=function --function-flags=full %t | \
39-
// RUN: FileCheck --check-prefix=FULL %s
40+
// RUN: FileCheck --check-prefix=FULL-INDEXED %s
4041
// RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full %t | \
4142
// RUN: FileCheck --check-prefix=FULL-MANGLED %s
4243
// RUN: lldb-test symbols --name=foo --context=context --find=function --function-flags=base %t | \
4344
// RUN: FileCheck --check-prefix=CONTEXT %s
4445
// RUN: lldb-test symbols --name=not_there --find=function %t | \
4546
// RUN: FileCheck --check-prefix=EMPTY %s
4647

48+
// NAMES: Name: .debug_names
49+
4750
// BASE: Found 4 functions:
4851
// BASE-DAG: name = "foo()", mangled = "_Z3foov"
4952
// BASE-DAG: name = "foo(int)", mangled = "_Z3fooi"
@@ -55,14 +58,14 @@
5558
// METHOD-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi"
5659
// METHOD-DAG: name = "ffbar()::sbaz::foo()", mangled = "_ZZ5ffbarvEN4sbaz3fooEv"
5760

58-
// FULL-APPLE: Found 7 functions:
59-
// FULL-APPLE-DAG: name = "foo()", mangled = "_Z3foov"
60-
// FULL-APPLE-DAG: name = "foo(int)", mangled = "_Z3fooi"
61-
// FULL-APPLE-DAG: name = "bar::foo()", mangled = "_ZN3bar3fooEv"
62-
// FULL-APPLE-DAG: name = "bar::baz::foo()", mangled = "_ZN3bar3baz3fooEv"
63-
// FULL-APPLE-DAG: name = "sbar::foo()", mangled = "_ZN4sbar3fooEv"
64-
// FULL-APPLE-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi"
65-
// FULL-APPLE-DAG: name = "ffbar()::sbaz::foo()", mangled = "_ZZ5ffbarvEN4sbaz3fooEv"
61+
// FULL-INDEXED: Found 7 functions:
62+
// FULL-INDEXED-DAG: name = "foo()", mangled = "_Z3foov"
63+
// FULL-INDEXED-DAG: name = "foo(int)", mangled = "_Z3fooi"
64+
// FULL-INDEXED-DAG: name = "bar::foo()", mangled = "_ZN3bar3fooEv"
65+
// FULL-INDEXED-DAG: name = "bar::baz::foo()", mangled = "_ZN3bar3baz3fooEv"
66+
// FULL-INDEXED-DAG: name = "sbar::foo()", mangled = "_ZN4sbar3fooEv"
67+
// FULL-INDEXED-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi"
68+
// FULL-INDEXED-DAG: name = "ffbar()::sbaz::foo()", mangled = "_ZZ5ffbarvEN4sbaz3fooEv"
6669

6770
// FULL: Found 0 functions:
6871

lldb/test/Shell/SymbolFile/DWARF/find-basic-namespace.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// REQUIRES: lld
22

3-
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable
3+
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -gno-pubnames
44
// RUN: ld.lld %t.o -o %t
55
// RUN: lldb-test symbols --name=foo --find=namespace %t | \
66
// RUN: FileCheck --check-prefix=FOO %s
@@ -17,15 +17,18 @@
1717
// RUN: lldb-test symbols --name=not_there --find=namespace %t | \
1818
// RUN: FileCheck --check-prefix=EMPTY %s
1919

20-
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf
20+
// RUN: %clang %s -c -o %t.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames
2121
// RUN: ld.lld %t.o -o %t
22+
// RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix NAMES
2223
// RUN: lldb-test symbols --name=foo --find=namespace %t | \
2324
// RUN: FileCheck --check-prefix=FOO %s
2425
// RUN: lldb-test symbols --name=foo --find=namespace --context=context %t | \
2526
// RUN: FileCheck --check-prefix=CONTEXT %s
2627
// RUN: lldb-test symbols --name=not_there --find=namespace %t | \
2728
// RUN: FileCheck --check-prefix=EMPTY %s
2829

30+
// NAMES: Name: .debug_names
31+
2932
// FOO: Found namespace: foo
3033

3134
// CONTEXT: Found namespace: bar::foo

lldb/test/Shell/SymbolFile/DWARF/find-basic-type.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// REQUIRES: lld
22

3-
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable
3+
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -gno-pubnames
44
// RUN: ld.lld %t.o -o %t
55
// RUN: lldb-test symbols --name=foo --find=type %t | \
66
// RUN: FileCheck --check-prefix=NAME %s
@@ -17,15 +17,18 @@
1717
// RUN: lldb-test symbols --name=not_there --find=type %t | \
1818
// RUN: FileCheck --check-prefix=EMPTY %s
1919

20-
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf
20+
// RUN: %clang %s -c -o %t.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames
2121
// RUN: ld.lld %t.o -o %t
22+
// RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix NAMES
2223
// RUN: lldb-test symbols --name=foo --find=type %t | \
2324
// RUN: FileCheck --check-prefix=NAME %s
2425
// RUN: lldb-test symbols --name=foo --context=context --find=type %t | \
2526
// RUN: FileCheck --check-prefix=CONTEXT %s
2627
// RUN: lldb-test symbols --name=not_there --find=type %t | \
2728
// RUN: FileCheck --check-prefix=EMPTY %s
2829

30+
// NAMES: Name: .debug_names
31+
2932
// EMPTY: Found 0 types:
3033
// NAME: Found 4 types:
3134
// CONTEXT: Found 1 types:

lldb/test/Shell/SymbolFile/DWARF/find-basic-variable.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// REQUIRES: lld
22

3-
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable
3+
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -gno-pubnames
44
// RUN: ld.lld %t.o -o %t
55
// RUN: lldb-test symbols --name=foo --find=variable --context=context %t | \
66
// RUN: FileCheck --check-prefix=CONTEXT %s
@@ -21,8 +21,9 @@
2121
// RUN: lldb-test symbols --name=not_there --find=variable %t | \
2222
// RUN: FileCheck --check-prefix=EMPTY %s
2323
//
24-
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf
24+
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames
2525
// RUN: ld.lld %t.o -o %t
26+
// RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix NAMES
2627
// RUN: lldb-test symbols --name=foo --find=variable --context=context %t | \
2728
// RUN: FileCheck --check-prefix=CONTEXT %s
2829
// RUN: lldb-test symbols --name=foo --find=variable %t | \
@@ -32,6 +33,8 @@
3233
// RUN: lldb-test symbols --name=not_there --find=variable %t | \
3334
// RUN: FileCheck --check-prefix=EMPTY %s
3435

36+
// NAMES: Name: .debug_names
37+
3538
// EMPTY: Found 0 variables:
3639
// NAME: Found 4 variables:
3740
// CONTEXT: Found 1 variables:

lldb/test/Shell/SymbolFile/DWARF/find-function-regex.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
// REQUIRES: lld
22

3-
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable
3+
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -gno-pubnames
44
// RUN: ld.lld %t.o -o %t
55
// RUN: lldb-test symbols --name=f.o --regex --find=function %t | FileCheck %s
66
//
77
// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx
88
// RUN: lldb-test symbols --name=f.o --regex --find=function %t | FileCheck %s
99

10-
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf
10+
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames
1111
// RUN: ld.lld %t.o -o %t
12+
// RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix NAMES
1213
// RUN: lldb-test symbols --name=f.o --regex --find=function %t | FileCheck %s
1314

15+
// NAMES: Name: .debug_names
16+
1417
// CHECK: Found 3 functions:
1518
// CHECK-DAG: name = "foo()", mangled = "_Z3foov"
1619
// CHECK-DAG: name = "ffo()", mangled = "_Z3ffov"

lldb/test/Shell/SymbolFile/DWARF/find-method.cpp

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

3-
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable
3+
// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -gno-pubnames
44
// RUN: ld.lld %t.o -o %t
55
// RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \
66
// RUN: FileCheck %s
@@ -9,6 +9,14 @@
99
// RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \
1010
// RUN: FileCheck %s
1111

12+
// RUN: %clang %s -c -o %t.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames
13+
// RUN: ld.lld %t.o -o %t
14+
// RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix NAMES
15+
// RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \
16+
// RUN: FileCheck %s
17+
18+
// NAMES: Name: .debug_names
19+
1220
// CHECK-DAG: name = "A::foo()", mangled = "_ZN1A3fooEv"
1321
// CHECK-DAG: name = "B::foo()", mangled = "_ZN1B3fooEv"
1422
// CHECK-DAG: name = "C::foo()", mangled = "_ZN1C3fooEv"

lldb/test/Shell/SymbolFile/DWARF/find-variable-dwo.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
// REQUIRES: lld
22

3-
// RUN: %clang %s -g -gsplit-dwarf -c -emit-llvm -o - --target=x86_64-pc-linux -DONE | \
4-
// RUN: llc -accel-tables=Dwarf -filetype=obj -split-dwarf-file=%t-1.dwo -o %t-1.o
3+
// RUN: %clang %s -gdwarf-5 -gpubnames -gsplit-dwarf -c -emit-llvm -o - --target=x86_64-pc-linux -DONE | \
4+
// RUN: llc -filetype=obj -split-dwarf-file=%t-1.dwo -o %t-1.o
55
// RUN: llvm-objcopy --split-dwo=%t-1.dwo %t-1.o
6-
// RUN: %clang %s -g -gsplit-dwarf -c -emit-llvm -o - --target=x86_64-pc-linux -DTWO | \
7-
// RUN: llc -accel-tables=Dwarf -filetype=obj -split-dwarf-file=%t-2.dwo -o %t-2.o
6+
// RUN: %clang %s -gdwarf-5 -gpubnames -gsplit-dwarf -c -emit-llvm -o - --target=x86_64-pc-linux -DTWO | \
7+
// RUN: llc -filetype=obj -split-dwarf-file=%t-2.dwo -o %t-2.o
88
// RUN: llvm-objcopy --split-dwo=%t-2.dwo %t-2.o
99
// RUN: ld.lld %t-1.o %t-2.o -o %t
10+
// RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix NAMES
1011
// RUN: lldb-test symbols --name=foo --find=variable %t | FileCheck %s
1112

13+
// NAMES: Name: .debug_names
14+
1215
// CHECK: Found 2 variables:
1316
#ifdef ONE
1417
namespace one {

lldb/test/Shell/SymbolFile/DWARF/find-variable-file.cpp

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

3-
// RUN: %clang -g -c -o %t-1.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable %s
4-
// RUN: %clang -g -c -o %t-2.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable %S/Inputs/find-variable-file-2.cpp
3+
// RUN: %clang -g -c -o %t-1.o --target=x86_64-pc-linux -gno-pubnames %s
4+
// RUN: %clang -g -c -o %t-2.o --target=x86_64-pc-linux -gno-pubnames %S/Inputs/find-variable-file-2.cpp
55
// RUN: ld.lld %t-1.o %t-2.o -o %t
66
// RUN: lldb-test symbols --file=find-variable-file.cpp --find=variable %t | \
77
// RUN: FileCheck --check-prefix=ONE %s
@@ -18,14 +18,17 @@
1818
// RUN: lldb-test symbols --file=find-variable-file-2.cpp --find=variable %t | \
1919
// RUN: FileCheck --check-prefix=TWO %s
2020

21-
// RUN: %clang -g -c -o %t-1.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %s
22-
// RUN: %clang -g -c -o %t-2.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %S/Inputs/find-variable-file-2.cpp
21+
// RUN: %clang -c -o %t-1.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames %s
22+
// RUN: %clang -c -o %t-2.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames %S/Inputs/find-variable-file-2.cpp
2323
// RUN: ld.lld %t-1.o %t-2.o -o %t
24+
// RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix NAMES
2425
// RUN: lldb-test symbols --file=find-variable-file.cpp --find=variable %t | \
2526
// RUN: FileCheck --check-prefix=ONE %s
2627
// RUN: lldb-test symbols --file=find-variable-file-2.cpp --find=variable %t | \
2728
// RUN: FileCheck --check-prefix=TWO %s
2829

30+
// NAMES: Name: .debug_names
31+
2932
// ONE: Found 1 variables:
3033
namespace one {
3134
int foo;

0 commit comments

Comments
 (0)