aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/README.md
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2022-06-21 17:06:52 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-06-29 21:03:49 +0000
commit3c36449dd4c66f7415f0a23b7908f5496b0dd743 (patch)
tree74824ae005bb6874221040c4b7a9fbc4bdf7900e /compiler_wrapper/README.md
parentd31ac0b99b083f51dbb88031e8329f336d0a666b (diff)
downloadtoolchain-utils-3c36449dd4c66f7415f0a23b7908f5496b0dd743.tar.gz
compiler_wrapper: add autocrash logic
As outlined in the attached bug, we want to be able to crash the compiler based on a handful of heuristics. Crashing Clang helps get us self-contained reproducers fairly easily. This CL provides (off-by-default) functionality to do the above. The expectation is that a SWE will hack at it to make it work as they need to. BUG=b:236736327 TEST=Installed the new wrapper; observed autocrashes. Change-Id: I76ec753ec37baa5e9b6dab92668081fa7c605725 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3714885 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: George Burgess <gbiv@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'compiler_wrapper/README.md')
-rw-r--r--compiler_wrapper/README.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/compiler_wrapper/README.md b/compiler_wrapper/README.md
index 0228e27d..bb63798a 100644
--- a/compiler_wrapper/README.md
+++ b/compiler_wrapper/README.md
@@ -73,3 +73,31 @@ Generated wrappers are stored here:
`/usr/bin/clang_host_wrapper`
- Gcc host wrapper:
`/usr/x86_64-pc-linux-gnu/gcc-bin/10.2.0/host_wrapper`
+
+## Using the compiler wrapper to crash arbitrary compilations
+
+When Clang crashes, its output can be extremely useful. Often, it will provide
+the user with a stack trace, and messages like:
+
+```
+clang-15: unable to execute command: Illegal instruction
+clang-15: note: diagnostic msg: /tmp/clang_crash_diagnostics/foo-5420d2.c
+clang-15: note: diagnostic msg: /tmp/clang_crash_diagnostics/foo-5420d2.sh
+```
+
+Where the artifacts at `/tmp/clang_crash_diagnostics/foo-*` are a full,
+self-contained reproducer of the inputs that caused the crash in question.
+Often, such a reproducer is very valuable to have even for cases where a crash
+_doesn't_ happen (e.g., maybe Clang is now emitting an error where it used to
+not do so, and we want to bisect upstream LLVM with that info). Normally,
+collecting and crafting such a reproducer is a multi-step process, and can be
+error-prone; compile commands may rely on env vars, they may be done within
+`chroot`s, they may rely on being executed in a particular directory, they may
+rely on intermediate state, etc.
+
+Because of the usefulness of these crash reports, our wrapper supports crashing
+Clang even on files that ordinarily don't cause Clang to crash. For various
+reasons (b/236736327), this support currently requires rebuilding and
+redeploying the wrapper in order to work. That said, this could be a valuable
+tool for devs interested in creating a self-contained reproducer without having
+to manually reproduce the environment in which a particular build was performed.