mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-28 06:36:05 +00:00

Warnings have been added for three cases (PR41905): (1) missing debug info, (2) the source file cannot be found, (3) the debug info points at a line beyond the end of the file. (1) is probably less useful. This was brought up once on http://lists.llvm.org/pipermail/llvm-dev/2020-April/141264.html and two internal users mentioned it to me that it was annoying. (I personally find the warning confusing, too.) Users specify --source to get additional information if sources happen to be available. If sources are not available, it should be obvious as the output will have no interleaved source lines. The warning can be especially annoying when using llvm-objdump -S on a bunch of files. This patch drops the warning when there is no debug info. (If LLVMSymbolizer::symbolizeCode returns an `Error`, there will still be an error. There is currently no test for an `Error` return value. The only code path is probably a broken symbol table, but we probably already emit a warning in that case) `source-interleave-prefix.test` has an inappropriate "malformed" test - the test simply has no .debug_* because new llc does not produce debug info when the filename is empty (invalid). I have tried tampering the header of .debug_info/.debug_line but llvm-symbolizer does not warn. This patch does not intend to add the missing test coverage. Differential Revision: https://reviews.llvm.org/D88715
14 lines
690 B
Plaintext
14 lines
690 B
Plaintext
## Test that if an object has no debug information, only the disassembly is
|
|
## printed when --source is specified, and that we do not emit a warning.
|
|
|
|
# RUN: sed -e "s,SRC_COMPDIR,%/p/Inputs,g" %p/Inputs/source-interleave.ll > %t.ll
|
|
# RUN: llc -o %t.o -filetype=obj -mtriple=x86_64-pc-linux %t.ll
|
|
# RUN: llvm-objcopy --strip-debug %t.o %t2.o
|
|
|
|
# RUN: llvm-objdump --source %t.o | FileCheck %s --check-prefixes=CHECK,SOURCE
|
|
# RUN: llvm-objdump --source %t2.o 2>&1 | FileCheck %s --check-prefixes=CHECK --implicit-check-not='main()' --implicit-check-not=warning:
|
|
|
|
# CHECK: 0000000000000010 <main>:
|
|
# SOURCE-NEXT: ; int main() {
|
|
# CHECK-NEXT: 10: 55 pushq %rbp
|