This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Add a 'print_module_map' flag which prints modules with UUIDs on Darwin
ClosedPublic

Authored by kubamracek on Dec 4 2016, 8:34 PM.

Details

Summary

This patch add a new sanitizer flag, print_module_map, which enables printing a module map when the process exits, or after each report (for TSan). The output format is very similar to what Crash Reporter produces on Darwin (e.g. the format of module UUIDs). This enables users to use the existing symbol servers to offline symbolicate and aggregate reports.

Diff Detail

Event Timeline

kubamracek updated this revision to Diff 80226.Dec 4 2016, 8:34 PM
kubamracek retitled this revision from to [sanitizer] Add a 'print_module_map' flag which prints modules with UUIDs on Darwin.
kubamracek updated this object.
kubamracek set the repository for this revision to rL LLVM.
kubamracek added a project: Restricted Project.
kubamracek added a subscriber: llvm-commits.
filcab edited edge metadata.Dec 7 2016, 12:33 PM

Is it that valuable that we print after every report?

lib/sanitizer_common/sanitizer_flags.inc
79

You're not honouring the 2 value under ASan.

lib/sanitizer_common/sanitizer_mac.cc
862

Should we add 'X' format conversion to internal_snprintf?

kubamracek updated this revision to Diff 81525.Dec 14 2016, 8:39 PM
kubamracek edited edge metadata.
kubamracek removed rL LLVM as the repository for this revision.

Updating patch, addressing review comments.

Is it that valuable that we print after every report?

It is for TSan, where we just keep the process running and reporting issues. If the user kills the process abnormally, he would never see the UUID list under print_module_map=1.

kubamracek updated this revision to Diff 81526.Dec 14 2016, 8:41 PM

Adding a testcase.

dvyukov accepted this revision.Jan 4 2017, 1:27 AM
dvyukov edited edge metadata.
This revision is now accepted and ready to land.Jan 4 2017, 1:27 AM
This revision was automatically updated to reflect the committed changes.

FYI, produces the following warning when compiled with gcc with some stricter options:

[...]/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_common.h: In function ‘const char* __sanitizer::ModuleArchToString(__sanitizer::ModuleArch)’:
[...]/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_common.h:693:1: warning: control reaches end of non-void function [-Wreturn-type]
 }

FYI, produces the following warning when compiled with gcc with some stricter options:

[...]/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_common.h: In function ‘const char* __sanitizer::ModuleArchToString(__sanitizer::ModuleArch)’:
[...]/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_common.h:693:1: warning: control reaches end of non-void function [-Wreturn-type]
 }

Should get fixed with r291639.