[lld] [llvm] [Symbolizer] Support for Missing Line Numbers. (PR #82240)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 2 16:10:36 PDT 2024
================
@@ -0,0 +1,489 @@
+## Test --skip-line-zero option.
+##
+## This test illustrates the usage of handcrafted assembly to produce the following line table.
+## Address Line Column File ISA Discriminator OpIndex Flags
+## ------------------ ------ ------ ------ --- ------------- ------- -------------
+## 0x00000000000030a0 1 80 1 0 0 0 is_stmt prologue_end
+## 0x00000000000030a6 1 80 1 0 0 0 is_stmt end_sequence
+## 0x0000000000001000 0 68 1 0 0 0 is_stmt prologue_end
+## 0x0000000000001008 2 39 1 0 0 0
+## 0x0000000000001010 3 68 1 0 0 0 is_stmt prologue_end
+## 0x0000000000001012 0 68 1 0 0 0
+## 0x0000000000001017 3 68 1 0 0 0
+## 0x0000000000001019 3 39 1 0 0 0
+## 0x0000000000001020 5 1 2 0 0 0 is_stmt prologue_end
+## 0x0000000000001026 5 1 2 0 0 0 is_stmt end_sequence
+
+# REQUIRES: x86-registered-target
+
+# RUN: rm -rf %t && split-file %s %t && cd %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux --fdebug-prefix-map=%t="" %s -o %t.o
+
+## Check that with '--skip-line-zero', the last non-zero line in the current sequence is displayed.
+## If it fails to find in the current sequence then return the orignal computed line-zero for the queried address.
+# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero 0x1000 | FileCheck --strict-whitespace --match-full-lines --check-prefix=APPROX-FAIL-ACROSS-SEQ %s
+
+# APPROX-FAIL-ACROSS-SEQ:add
+# APPROX-FAIL-ACROSS-SEQ-NEXT:definitions.h:0:68
+
+## Check that with '--skip-line-zero', the last non-zero line in the current sequence is displayed.
+# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero 0x1012 | FileCheck --strict-whitespace --match-full-lines --check-prefix=APPROX-WITHIN-SEQ %s
+
+# APPROX-WITHIN-SEQ:sub
+# APPROX-WITHIN-SEQ-NEXT:definitions.h:3:68 (approximate)
+
+## Check to ensure that '--skip-line-zero' only affects addresses having line-zero when more than one address is specified.
+# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero 0x1012 0x1020 | FileCheck --strict-whitespace --match-full-lines --check-prefixes=APPROX-WITHIN-SEQ,NO-APPROX %s
+
+# NO-APPROX:main
+# NO-APPROX-NEXT:main.c:5:1
+
+## Check to ensure that '--skip-line-zero' with '--verbose' enabled displays correct approximate flag in verbose ouptut.
+# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero --verbose 0x1012 | FileCheck --strict-whitespace --match-full-lines --check-prefix=APPROX-VERBOSE %s
+
+# APPROX-VERBOSE:sub
+# APPROX-VERBOSE-NEXT: Filename: definitions.h
+# APPROX-VERBOSE-NEXT: Function start filename: definitions.h
+# APPROX-VERBOSE-NEXT: Function start line: 3
+# APPROX-VERBOSE-NEXT: Function start address: 0x1010
+# APPROX-VERBOSE-NEXT: Line: 3
+# APPROX-VERBOSE-NEXT: Column: 68
+# APPROX-VERBOSE-NEXT: Approximate: true
+
+## Check to ensure that '--skip-line-zero' with '--output-style=JSON' displays correct approximate flag in JSON output.
+# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero --output-style=JSON 0x1012 | FileCheck --strict-whitespace --match-full-lines --check-prefix=APPROX-JSON %s
+
+# APPROX-JSON:[{"Address":"0x1012","ModuleName":"{{.*}}{{[/|\]+}}test{{[/|\]+}}tools{{[/|\]+}}llvm-symbolizer{{[/|\]+}}Output{{[/|\]+}}approximate-line-handcrafted.s.tmp.o","Symbol":[{"Approximate":true,"Column":68,"Discriminator":0,"FileName":"definitions.h","FunctionName":"sub","Line":3,"StartAddress":"0x1010","StartFileName":"definitions.h","StartLine":3}]}]
+
+#--- definitions.h
----------------
bd1976bris wrote:
I don't think we need this header file for these test cases and I would favor removing is as having only one source file will reduce the size of the generated DWARF.
https://github.com/llvm/llvm-project/pull/82240
More information about the llvm-commits
mailing list