Skip to content

Commit 3483740

Browse files
authored
Reland "Symbolize line zero as if no source info is available (llvm#124846)" (llvm#133798)
This land commits 23aca2f and 1b15a89. llvm#128619 makes symbolizer to always use debug info when available so we can reland this chagnge.
1 parent 5d1f27f commit 3483740

File tree

8 files changed

+17
-18
lines changed

8 files changed

+17
-18
lines changed

llvm/lib/DebugInfo/DWARF/DWARFContext.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1870,7 +1870,7 @@ DWARFContext::getInliningInfoForAddress(object::SectionedAddress Address,
18701870
LineTable->getFileLineInfoForAddress(
18711871
{Address.Address, Address.SectionIndex}, Spec.ApproximateLine,
18721872
CU->getCompilationDir(), Spec.FLIKind, Frame);
1873-
} else {
1873+
} else if (CallLine != 0) {
18741874
// Otherwise, use call file, call line and call column from
18751875
// previous DIE in inlined chain.
18761876
if (LineTable)

llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,8 @@ bool DWARFDebugLine::LineTable::getFileLineInfoForAddress(
15391539
return false;
15401540
// Take file number and line/column from the row.
15411541
const auto &Row = Rows[RowIndex];
1542-
if (!getFileNameByIndex(Row.File, CompDir, Kind, Result.FileName))
1542+
if (Row.Line == 0 ||
1543+
!getFileNameByIndex(Row.File, CompDir, Kind, Result.FileName))
15431544
return false;
15441545
Result.Line = Row.Line;
15451546
Result.Column = Row.Column;

llvm/test/tools/llvm-symbolizer/skip-line-zero.s

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
## Check that without '--skip-line-zero', line zero is displayed for a line-table entry which has no source correspondence.
2121
# RUN: llvm-symbolizer --obj=%t.o -f=none 0x16d4 | FileCheck --strict-whitespace --match-full-lines --check-prefix=DISABLE %s
2222

23-
# DISABLE:main.c:0:0
23+
# DISABLE:??:0:0
2424

2525
## Check that the '--skip-line-zero' does not cross sequence boundaries.
2626
## If it fails to find in the current sequence then line zero is returned for the queried address.
2727
# RUN: llvm-symbolizer --obj=%t.o -f=none --skip-line-zero 0x16c0 | FileCheck --strict-whitespace --match-full-lines --check-prefix=FAIL-ACROSS-SEQ %s
2828

29-
# FAIL-ACROSS-SEQ:main.c:0:0
29+
# FAIL-ACROSS-SEQ:??:0:0
3030

3131
## Check that with '--skip-line-zero', the last non-zero line in the current sequence is displayed.
3232
# RUN: llvm-symbolizer --obj=%t.o -f=none --skip-line-zero 0x1717 | FileCheck --strict-whitespace --match-full-lines --check-prefix=WITHIN-SEQ %s

llvm/test/tools/llvm-symbolizer/sym-verbose.test

+2-3
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,12 @@ CHECK-NEXT: Column: 0
5050

5151
CHECK: 0x4005ad
5252
CHECK-NEXT: foo
53-
CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c
53+
CHECK-NEXT: Filename: ??
5454
CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c
5555
CHECK-NEXT: Function start line: 4
5656
CHECK-NEXT: Function start address: 0x400590
5757
CHECK-NEXT: Line: 0
58-
CHECK-NEXT: Column: 30
59-
CHECK-NEXT: Discriminator: 4
58+
CHECK-NEXT: Column: 0
6059
CHECK-NEXT: main
6160
CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c
6261
CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c

offload/test/sanitizer/kernel_crash_many.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -37,36 +37,36 @@ int main(void) {
3737
// CHECK: Kernel 1: {{.*}} (__omp_offloading_{{.*}}_main_l22)
3838
// CHECK: launchKernel
3939
// NDEBG: main
40-
// DEBUG: main {{.*}}kernel_crash_many.c:
40+
// DEBUG: main {{.*}}kernel_crash_many.c
4141
//
4242
// CHECK: Kernel 2: {{.*}} (__omp_offloading_{{.*}}_main_l22)
4343
// CHECK: launchKernel
4444
// NDEBG: main
45-
// DEBUG: main {{.*}}kernel_crash_many.c:
45+
// DEBUG: main {{.*}}kernel_crash_many.c
4646
//
4747
// CHECK: Kernel 3: {{.*}} (__omp_offloading_{{.*}}_main_l22)
4848
// CHECK: launchKernel
4949
// NDEBG: main
50-
// DEBUG: main {{.*}}kernel_crash_many.c:
50+
// DEBUG: main {{.*}}kernel_crash_many.c
5151
//
5252
// CHECK: Kernel 4: {{.*}} (__omp_offloading_{{.*}}_main_l22)
5353
// CHECK: launchKernel
5454
// NDEBG: main
55-
// DEBUG: main {{.*}}kernel_crash_many.c:
55+
// DEBUG: main {{.*}}kernel_crash_many.c
5656
//
5757
// CHECK: Kernel 5: {{.*}} (__omp_offloading_{{.*}}_main_l22)
5858
// CHECK: launchKernel
5959
// NDEBG: main
60-
// DEBUG: main {{.*}}kernel_crash_many.c:
60+
// DEBUG: main {{.*}}kernel_crash_many.c
6161
//
6262
// CHECK: Kernel 6: {{.*}} (__omp_offloading_{{.*}}_main_l22)
6363
// CHECK: launchKernel
6464
// NDEBG: main
65-
// DEBUG: main {{.*}}kernel_crash_many.c:
65+
// DEBUG: main {{.*}}kernel_crash_many.c
6666
//
6767
// CHECK: Kernel 7: {{.*}} (__omp_offloading_{{.*}}_main_l22)
6868
// CHECK: launchKernel
6969
// NDEBG: main
70-
// DEBUG: main {{.*}}kernel_crash_many.c:
70+
// DEBUG: main {{.*}}kernel_crash_many.c
7171
//
7272
// CHECK-NOT: Kernel {{[[0-9]]+}}:

offload/test/sanitizer/kernel_trap.c

-1
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,4 @@ int main(void) {
3939
// CHECK: OFFLOAD ERROR: Kernel 'omp target in main @ 30 (__omp_offloading_{{.*}}_main_l30)'
4040
// CHECK: OFFLOAD ERROR: execution interrupted by hardware trap instruction
4141
// TRACE: launchKernel
42-
// TRACE: main
4342
// clang-format on

offload/test/sanitizer/kernel_trap.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ int main(void) {
4747
// TRACE: launchKernel
4848
// NDEBG: cxx_function_name<S>(int, S*)
4949
// NDEBG: main
50-
// DEBUG: cxx_function_name<S>(int, S*) {{.*}}kernel_trap.cpp:
51-
// DEBUG: main {{.*}}kernel_trap.cpp:
50+
// DEBUG: cxx_function_name<S>(int, S*) {{.*}}kernel_trap.cpp
51+
// DEBUG: main {{.*}}kernel_trap.cpp
5252
// clang-format on

offload/test/sanitizer/kernel_trap_many.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ int main(void) {
3232
// TRACE: OFFLOAD ERROR: execution interrupted by hardware trap instruction
3333
// TRACE: launchKernel
3434
// NDEBG: main
35-
// DEBUG: main {{.*}}kernel_trap_many.c:
35+
// DEBUG: main {{.*}}kernel_trap_many.c

0 commit comments

Comments
 (0)