This is an archive of the discontinued LLVM Phabricator instance.

[HWASan] Use less Printf() calls in register dump.
ClosedPublic

Authored by hctim on Mar 13 2019, 1:21 PM.

Details

Summary

Explicitly print 4 registers/line in each iteration during register
dump. Reduces logcat spam as we get a single logcat message per call to
Printf(), even if the output isn't newline-terminated. This brings the
output format in logcat closer to that of the normal textual dump.

Diff Detail

Repository
rL LLVM

Event Timeline

hctim created this revision.Mar 13 2019, 1:21 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 13 2019, 1:21 PM
Herald added subscribers: llvm-commits, Restricted Project, kubamracek. · View Herald Transcript
pcc added inline comments.Mar 13 2019, 4:54 PM
compiler-rt/lib/hwasan/hwasan_report.cpp
468 ↗(On Diff #190486)

I reckon that it may make the code easier to read if we just wrote out all the printf calls, i.e.

Printf("    x0  %016llx  x1  %016llx  x2  %016llx  x3  %016llx\n",
       frame[0], frame[1], frame[2], frame[3]);

and so on. What do you think?

hctim added a comment.Mar 13 2019, 5:00 PM

Agreed for x28-x30, but do you also mean for x0-x27 as well?

pcc added a comment.Mar 13 2019, 5:06 PM

Yes, I meant for all of them.

hctim updated this revision to Diff 190548.Mar 13 2019, 5:24 PM
hctim marked an inline comment as done.

Unrolled all the prints.

pcc accepted this revision.Mar 13 2019, 5:37 PM

LGTM

compiler-rt/lib/hwasan/hwasan_report.cpp
450 ↗(On Diff #190548)

Nit: align to the " on the previous line (same below).

This revision is now accepted and ready to land.Mar 13 2019, 5:37 PM
This revision was automatically updated to reflect the committed changes.