This is an archive of the discontinued LLVM Phabricator instance.

[asan] Reify ErrorGeneric
ClosedPublic

Authored by filcab on Sep 14 2016, 5:56 AM.

Details

Summary

Finish work on PR30351 (last one, after D24551, D24552, and D24554 land)

Also replace the old ReportData structure/variable with the current_error_ static
member of the ScopedInErrorReport class.

This has the following side-effects:

  • Move ASAN_ON_ERROR(); call to the start of the destructor, instead of in StartReporting().
    • We only generate the error structure after the ScopedInErrorReport constructor finishes, so we can't call ASAN_ON_ERROR() during the constructor. I think this makes more sense, since we end up never running two of the ASAN_ON_ERROR() callback. This also works the same way as error reporting, since we end up having a lock around it. Otherwise we could end up with the ASAN_ON_ERROR() call for error 1, then the ASAN_ON_ERROR() call for error 2, and then lock the mutex for reporting error 1.
  • The __asan_get_report_* functions will be able to, in the future, provide information about other errors that aren't a "generic error". But we might want to rethink that API, since it's too restricted. Ideally we teach lldb about the current_error_ member of ScopedInErrorReport.

Diff Detail

Repository
rL LLVM

Event Timeline

filcab updated this revision to Diff 71331.Sep 14 2016, 5:56 AM
filcab retitled this revision from to [asan] Reify ErrorGeneric.
filcab updated this object.
filcab added reviewers: vitalybuka, kcc, eugenis.
filcab added a subscriber: llvm-commits.
filcab updated this revision to Diff 71333.Sep 14 2016, 6:01 AM

Only reset current_error_ if halt_on_error_ == false.

This way, if we're aborting, we'll still have the actual error in
current_error_. When halt_on_error_ == true, we want to reset before unlocking.

vitalybuka accepted this revision.Sep 20 2016, 1:52 PM
vitalybuka edited edge metadata.

LGTM
BTW. arc patch D24555 does not work.

lib/asan/asan_descriptions.h
230 ↗(On Diff #71333)

Maybe better to extract special address kind for odr?

lib/asan/asan_report.cc
430 ↗(On Diff #71333)

Why all these only for Generic?
Is this pre-existed behavior?

This revision is now accepted and ready to land.Sep 20 2016, 1:52 PM
This revision was automatically updated to reflect the committed changes.