This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by bd1976llvm on Jun 11 2021, 5:50 AM.

Details

Summary

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-after-lines=1 prints 1 line after the matching line as well as the matching line.
--print-source-before-lines=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?

Diff Detail

Event Timeline

bd1976llvm created this revision.Jun 11 2021, 5:50 AM
bd1976llvm requested review of this revision.Jun 11 2021, 5:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 11 2021, 5:50 AM
jhenderson accepted this revision.Jun 11 2021, 6:10 AM

LGTM.

Maybe -C/-A/-B are available to match grep because the current option is quite long?

We can't adopt new short options from tools other than GNU addr2line, as the command-line syntax of llvm-symbolizer is intended to be compatible (i.e. all addr2line options should be present in llvm-symbolizer). If addr2line were to add one or more of these options with a different meaning, we'd end up with an incompatibility. Also, -C is already used for symbol demangling.

This revision is now accepted and ready to land.Jun 11 2021, 6:10 AM
bd1976llvm edited the summary of this revision. (Show Details)Jun 11 2021, 6:56 AM
bd1976llvm edited the summary of this revision. (Show Details)