[llvm] dbc07ef - [llvm-symbolizer] improve test and fix doc example after recent --print-source-context-lines behaviour change

Ben Dunbobbin via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 16 05:40:55 PDT 2021


Author: Ben Dunbobbin
Date: 2021-06-16T13:38:22+01:00
New Revision: dbc07ef5ca53531e8ee6c54ec3c3f04bddef267d

URL: https://github.com/llvm/llvm-project/commit/dbc07ef5ca53531e8ee6c54ec3c3f04bddef267d
DIFF: https://github.com/llvm/llvm-project/commit/dbc07ef5ca53531e8ee6c54ec3c3f04bddef267d.diff

LOG: [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

Added: 
    

Modified: 
    llvm/docs/CommandGuide/llvm-symbolizer.rst
    llvm/test/tools/llvm-symbolizer/print_context.c

Removed: 
    


################################################################################
diff  --git a/llvm/docs/CommandGuide/llvm-symbolizer.rst b/llvm/docs/CommandGuide/llvm-symbolizer.rst
index 0a0ad16dca2af..e64211dd78099 100644
--- a/llvm/docs/CommandGuide/llvm-symbolizer.rst
+++ b/llvm/docs/CommandGuide/llvm-symbolizer.rst
@@ -359,7 +359,7 @@ OPTIONS
 
   .. code-block:: console
 
-    $ llvm-symbolizer --obj=test.elf 0x400490 --print-source-context-lines=2
+    $ llvm-symbolizer --obj=test.elf 0x400490 --print-source-context-lines=3
     baz()
     /tmp/test.cpp:11:0
     10  :   volatile int k = 42;

diff  --git a/llvm/test/tools/llvm-symbolizer/print_context.c b/llvm/test/tools/llvm-symbolizer/print_context.c
index 5b80054416d68..94a1108bd9b38 100644
--- a/llvm/test/tools/llvm-symbolizer/print_context.c
+++ b/llvm/test/tools/llvm-symbolizer/print_context.c
@@ -20,9 +20,10 @@ int main() {
 // location independent.
 
 // CHECK: inc
-// CHECK: print_context.c:3
-// CHECK: 1  : #include
-// CHECK: 2  :
-// CHECK: 3 >: int inc
-// CHECK: 4  :   return
-// CHECK: 5  : }
+// 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


        


More information about the llvm-commits mailing list