[PATCH] D104114: [llvm-symbolizer] improve test and fix doc example after recent --print-source-context-lines behaviour change
ben via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 11 05:50:13 PDT 2021
bd1976llvm created this revision.
Herald added a subscriber: rupprecht.
Herald added a reviewer: jhenderson.
bd1976llvm requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.
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.
A note in passing: This option is a bit confusing. I feel it would be better to follow existing conventions e.g.:
--print-source-context-lines=1 prints 1 line before and after as well as the matching line.
--print-source-context-after=1 prints 1 line after the matching line as well as the matching line.
--print-source-context-before=1 prints 1 line before the matching line as well as the matching line.
Maybe -C/-A/-B are available to match grep because the current option is quite long?
https://reviews.llvm.org/D104114
Files:
llvm/docs/CommandGuide/llvm-symbolizer.rst
llvm/test/tools/llvm-symbolizer/print_context.c
Index: llvm/test/tools/llvm-symbolizer/print_context.c
===================================================================
--- llvm/test/tools/llvm-symbolizer/print_context.c
+++ llvm/test/tools/llvm-symbolizer/print_context.c
@@ -20,9 +20,10 @@
// 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
Index: llvm/docs/CommandGuide/llvm-symbolizer.rst
===================================================================
--- llvm/docs/CommandGuide/llvm-symbolizer.rst
+++ llvm/docs/CommandGuide/llvm-symbolizer.rst
@@ -359,7 +359,7 @@
.. 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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104114.351419.patch
Type: text/x-patch
Size: 1099 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210611/fbc9e2fe/attachment.bin>
More information about the llvm-commits
mailing list