1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00
llvm-mirror/test/tools/llvm-symbolizer/print_context.c
Ben Dunbobbin a74f81f967 [llvm-symbolizer] improve test and fix doc example after recent --print-source-context-lines behaviour change
I believe that after https://reviews.llvm.org/D102355 the behaviour of --print-source-context-lines has changed.

Before: --print-source-context-lines=3 prints 4 lines.
After: --print-source-context-lines=3 prints 3 lines.

Adjust the example in the docs for this change and make the testing a little more robust.

Differential Revision: https://reviews.llvm.org/D104114
2021-06-16 13:38:22 +01:00

30 lines
678 B
C

#include <stdio.h>
int inc(int a) {
return a + 1;
}
int main() {
printf("%p\n", inc);
return 0;
}
// RUN: rm -rf %t && mkdir -p %t
// RUN: cp %s %t/
// RUN: cp %p/Inputs/print_context.o %t
// RUN: cd %t
// RUN: llvm-symbolizer -obj=%t/print_context.o 0x0 -print-source-context-lines=5 | FileCheck %s
// Inputs/print_context.o built with plain -g -c from this source file
// Specifying -Xclang -fdebug-compilation-dir -Xclang . to make the debug info
// location independent.
// CHECK: inc
// CHECK-NEXT: print_context.c:3
// CHECK-NEXT: 1 : #include
// CHECK-NEXT: 2 :
// CHECK-NEXT: 3 >: int inc
// CHECK-NEXT: 4 : return
// CHECK-NEXT: 5 : }
// CHECK-NOT: 6