This is an archive of the discontinued LLVM Phabricator instance.

[Sanitizers] Make abort_on_error common flag.
ClosedPublic

Authored by samsonov on Aug 25 2015, 1:28 PM.

Details

Summary

Teach all sanitizers to call abort() instead of _exit() after printing
an error report, if requested. This behavior is the default on Mac OS.

Diff Detail

Repository
rL LLVM

Event Timeline

samsonov updated this revision to Diff 33112.Aug 25 2015, 1:28 PM
samsonov retitled this revision from to [Sanitizers] Make abort_on_error common flag..
samsonov updated this object.
samsonov added reviewers: kcc, kubamracek.
samsonov added a subscriber: llvm-commits.
kcc accepted this revision.Aug 25 2015, 2:43 PM
kcc edited edge metadata.

LGTM

This revision is now accepted and ready to land.Aug 25 2015, 2:43 PM

Thank you!

Kuba, could you take a look if this change works on Mac as expected?

kubamracek edited edge metadata.Aug 26 2015, 4:09 AM

Alexey, there are two test failures with this change. The test sanitizer_common/TestCases/Darwin/abort_on_error.cc fails with

Undefined symbols for architecture i386:
  "__sanitizer::Die()", referenced from:
      _main in abort_on_error-4d1da3.o
ld: symbol(s) not found for architecture i386

because __sanitizer::Die() is not an exported symbol. The second failure is in sanitizer_common/TestCases/options-include.cc:

Exit Code: 1
Error: Abort trap: 6

This is because the test overrides %tool_options without inheriting the default ones (like we do with %env_asan_opts in ASan lit tests). Therefore the test crashes on OS X instead of just quitting with a non-zero exit code.

samsonov updated this revision to Diff 33238.Aug 26 2015, 1:23 PM
samsonov edited edge metadata.

Speculatively fix test failures on Mac OS.

Kuba, could you please check if the updated version works for you?

%env_tool_opts='' not --crash %run %t doesn't work because it expands to env ASAN_OPTIONS=abort_on_error=0:'' not --crash .... How about introducing something like:

config.substitutions.append( ('%env_tool_opts_var_name', tool_options))

and then using it with %env_tool_opts_var_name='' not --crash %run %t? With that, all the tests pass (on OS X).

Kuba

Thank you! I'll follow this suggestion and submit the CL shortly.

This revision was automatically updated to reflect the committed changes.