This is an archive of the discontinued LLVM Phabricator instance.

[hwasan] Offline symbolization script.
ClosedPublic

Authored by eugenis on Dec 6 2019, 1:50 PM.

Details

Summary

A script to symbolize hwasan reports after the fact using unstripped
binaries. Supports stack-based reports. Requires llvm-symbolizer
(addr2line is not an option).

Diff Detail

Event Timeline

eugenis created this revision.Dec 6 2019, 1:50 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 6 2019, 1:50 PM
Herald added subscribers: Restricted Project, mgorny. · View Herald Transcript
eugenis updated this revision to Diff 232645.Dec 6 2019, 2:04 PM

removed leftover debug

hctim added inline comments.Dec 6 2019, 2:20 PM
compiler-rt/lib/hwasan/scripts/hwasan_symbolize
2

Should this file be hwasan_symbolize.py?

240

Shouldn't we be getting this from user PATH instead? For me , which llvm-symbolizer returns /usr/local/bin/llvm-symbolizer (which is the default install path for ninja install IIRC).

eugenis updated this revision to Diff 232652.Dec 6 2019, 2:35 PM

look for llvm-symbolizer in PATH

eugenis marked 2 inline comments as done.Dec 6 2019, 2:36 PM
eugenis added inline comments.
compiler-rt/lib/hwasan/scripts/hwasan_symbolize
2

it's installed in bin/, and we don't really want a .py extension there

240

fixed

hctim accepted this revision.Dec 9 2019, 9:21 AM

LGTM with a couple comments

compiler-rt/lib/hwasan/scripts/hwasan_symbolize
120

I think a lot of .*?'s here can be replaced with \s* for stability:

(\s*)#(\d+)\s*(0x[0-9a-f]+)\s*\((.*)\+(0x[0-9a-f]+)\)

185

Nit: extra line

220

Needs to be updated to talk about PATH

248

We'll miss llvm-symbolizer in a user's PATH here.

This revision is now accepted and ready to land.Dec 9 2019, 9:21 AM
eugenis updated this revision to Diff 232937.Dec 9 2019, 1:42 PM
eugenis marked 3 inline comments as done.

address comments

eugenis marked an inline comment as done.Dec 9 2019, 1:45 PM
eugenis added inline comments.
compiler-rt/lib/hwasan/scripts/hwasan_symbolize
120

Not really. The first one needs to accept any prefix, like timestamp in adb logcat.
The second and the third have to be actual whitespace, we print it ourselves.

This revision was automatically updated to reflect the committed changes.