This is an archive of the discontinued LLVM Phabricator instance.

[llvm-symbolizer] Print out non-address lines verbatim.
ClosedPublic

Authored by aizatsky on Jan 4 2016, 4:15 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

aizatsky updated this revision to Diff 43940.Jan 4 2016, 4:15 PM
aizatsky retitled this revision from to [llvm-symbolizer] Print out non-address lines verbatim..
aizatsky updated this object.
aizatsky updated this revision to Diff 43942.Jan 4 2016, 4:23 PM

nits & test

aizatsky added a project: Restricted Project.
aizatsky added a subscriber: llvm-commits.
samsonov edited edge metadata.Jan 6 2016, 10:20 AM

Out of curiosity, why do you need this? What is addr2line behavior for non-address lines?

tools/llvm-symbolizer/llvm-symbolizer.cpp
93 ↗(On Diff #43942)

Argument should at least be const char*, and go before output parameters. Or make it a StringRef.

aizatsky updated this revision to Diff 44275.Jan 7 2016, 3:35 PM
aizatsky marked an inline comment as done.
aizatsky edited edge metadata.

review

Out of curiosity, why do you need this?

To be able to pipe a complicate output through symbolizer. E.g. fuzzers can print out coverage addresses.

What is addr2line behavior for non-address lines?

I don't think addr2line behavior is relevant here. This is not addr2line, right?

addr2line is not smart at all:

$ echo "hello" | addr2line -e /usr/bin/addr2line
??:0

samsonov accepted this revision.Jan 7 2016, 3:50 PM
samsonov edited edge metadata.

LGTM, but please address comments.

tools/llvm-symbolizer/llvm-symbolizer.cpp
92 ↗(On Diff #44275)

Pass StringRef by value.

100 ↗(On Diff #44275)

So, once we have StringRef, let's use its methods instead of a C string functions.
We have a bunch of them: startswith, drop_front, ltrim, find_first_not_of etc.
This can be done in a follow-up commit, but please do so.

170 ↗(On Diff #44275)

Reduce the indentation:

if (!parseCommand(...)) {
  outs() << InputString;
  continue;
}
// existing code
This revision is now accepted and ready to land.Jan 7 2016, 3:50 PM
aizatsky updated this revision to Diff 44286.Jan 7 2016, 3:56 PM
aizatsky marked an inline comment as done.
aizatsky edited edge metadata.

review

thanks. submitting.

tools/llvm-symbolizer/llvm-symbolizer.cpp
100 ↗(On Diff #44275)

I suggest we do this later. I don't see a point in this rewrite now.

This revision was automatically updated to reflect the committed changes.