This is an archive of the discontinued LLVM Phabricator instance.

[ASan] Make asan report decoration more efficient
Needs RevisionPublic

Authored by amontanez on Nov 19 2018, 4:11 PM.

Details

Summary

ASan's report decoration doesn't maintain any state regarding terminal color output. When printing shadow bytes, one printed byte involves two color changes, even if subsequent bytes are the same color. This patch ensures a decorator only changes the terminal output color when printing a byte of a different color. This significantly reduces the number of characters in the output when printing shadow bytes without changing how the output looks.

Diff Detail

Event Timeline

amontanez created this revision.Nov 19 2018, 4:11 PM
Herald added subscribers: Restricted Project, llvm-commits, kubamracek. · View Herald TranscriptNov 19 2018, 4:11 PM

No tests need update?

vitalybuka added inline comments.Nov 19 2018, 4:30 PM
compiler-rt/lib/asan/asan_descriptions.h
48

what was changed here?
Did you use arc tool?

60

lets keep same name

const char *Default() {
  last_byte = 0;
  return __sanitizer::SanitizerCommonDecorator::Default();
}
122

u8 last_byte = 0;

122

maybe instead of last byte just track "const char * last_decoration"?

  • Fixed diff issues.
  • Tracking last decoration as opposed to last byte.
  • Changed Reset() to be Default().
amontanez marked 2 inline comments as done.EditedNov 20 2018, 10:44 AM

No tests need update?

I don't think text decoration was tested in any way. Adding an integration test would be reasonable, I'll look into that.

vitalybuka requested changes to this revision.Nov 29 2018, 2:50 PM

Removing from my "Ready To Review" list assuming you are working on test.

This revision now requires changes to proceed.Nov 29 2018, 2:50 PM