point -fcrash-diagnostics-dir at MOZ_UPLOAD_DIR when compiling with clang in automation

RESOLVED FIXED in Firefox 66

Status

enhancement
RESOLVED FIXED
Last year
6 months ago

People

(Reporter: ted, Assigned: dmajor)

Tracking

Trunk
mozilla66
Dependency tree / graph

Firefox Tracking Flags

(firefox66 fixed)

Details

Attachments

(1 attachment)

When clang crashes it produces a nice set of diagnostic files that it writes to /tmp (this example is from bug 1477216):
[task 2018-07-19T13:02:58.196Z] 13:02:58     INFO -  clang-6.0: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
[task 2018-07-19T13:02:58.196Z] 13:02:58     INFO -  clang-6.0: note: diagnostic msg:
[task 2018-07-19T13:02:58.196Z] 13:02:58     INFO -  ********************
[task 2018-07-19T13:02:58.197Z] 13:02:58     INFO -  PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
[task 2018-07-19T13:02:58.197Z] 13:02:58     INFO -  Preprocessed source(s) and associated run script(s) are located at:
[task 2018-07-19T13:02:58.197Z] 13:02:58     INFO -  clang-6.0: note: diagnostic msg: /tmp/UnifiedBindings22-210e16.cpp
[task 2018-07-19T13:02:58.197Z] 13:02:58     INFO -  clang-6.0: note: diagnostic msg: /tmp/UnifiedBindings22-210e16.sh
[task 2018-07-19T13:02:58.197Z] 13:02:58     INFO -  clang-6.0: note: diagnostic msg:
[task 2018-07-19T13:02:58.197Z] 13:02:58     INFO -  ********************

Someone asked recently if we could scrape clang's output to notice when this happens and save the diagnostic files. I dug into this a little just now and found that someone added a `-fcrash-diagnostics-dir` option just last week to control where these diagnostic files get written: https://reviews.llvm.org/D48601

We should either update clang or cherry-pick that patch and then use `-fcrash-diagnostics-dir=$UPLOAD_DIR` in CI so that when clang crashes it writes the diagnostics directly to a place where they'll get uploaded as artifacts.
This would solve bug 1420336 without writing a wrapper; I like it.
Blocks: 1420336
See Also: → 1479851
Depends on: 1479851
See Also: 1479851
Assignee: nobody → ted
Summary: Update clang or cherry-pick patch for -fcrash-diagnostics-dir, point it at UPLOAD_DIR when compiling with clang → point -fcrash-diagnostics-dir at UPLOAD_DIR when compiling with clang in automation
Summary: point -fcrash-diagnostics-dir at UPLOAD_DIR when compiling with clang in automation → point -fcrash-diagnostics-dir at MOZ_UPLOAD_DIR when compiling with clang in automation
We'll need to pick up 339424 to make this work on clang-cl: https://github.com/llvm-mirror/clang/commit/8c7ddf2e8931f8aeebd6cb80701bd58cdbc31c7a
Feel free to try again with this patch once that happens. Also we could use this for other platforms if we update clang for them. The patch here has commented-out bits for supporting builds on other platforms.
Assignee: ted → nobody
With bug 1492663 landed we could try this again.
Depends on: 1492663
The patch to make this work in the clang-cl frontend didn't make it to 7.0.0, so we'd still need a patch or a move to trunk.
Depends on: 1497605
Depends on: 1512921
No longer depends on: 1497605
Assignee: nobody → ted
That didn't *quite* work for Windows builds:
12:04:44     INFO -    CFLAGS= -fcrash-diagnostics-dir=z:\build\public\build
12:04:54     INFO -  checking whether the C compiler (z:/build/build/src/sccache2/sccache.exe z:/build/build/src/clang/bin/clang-cl.exe -Xclang -std=gnu99 -fms-compatibility-version=19.15.26726  -fcrash-diagnostics-dir=z:\build\public\build  ) works... yes

12:09:34     INFO -  z:/build/build/src/sccache2/sccache.exe z:/build/build/src/clang/bin/clang.exe --driver-mode=cl -Xclang -std=gnu99 -fms-compatibility-version=19.15.26726 -FoTestNANTestingExprC.obj -c  -DNDEBUG=1 -DTRIMMED=1 -Iz:/build/build/src/build/clang-plugin/tests -Iz:/build/build/src/obj-firefox/build/clang-plugin/tests -Iz:/build/build/src/obj-firefox/dist/include -Iz:/build/build/src/obj-firefox/dist/include/nspr -Iz:/build/build/src/obj-firefox/dist/include/nss -MD -FI z:/build/build/src/obj-firefox/mozilla-config.h -DMOZILLA_CLIENT -Qunused-arguments -fcrash-diagnostics-dir=z:buildpublicbuild -nologo -wd4091 -D_HAS_EXCEPTIONS=0 -Gy -Zc:inline -Gw -wd4244 -wd4267 -we4553 -fsyntax-only -Xclang -verify -ferror-limit=0 -std=c11 -Wno-invalid-noreturn -Z7 -Xclang -load -Xclang z:/build/build/src/obj-firefox/build/clang-plugin/clang-plugin.dll -Xclang -add-plugin -Xclang moz-check -O2 -Oy-  -Xclang -MP -Xclang -dependency-file -Xclang .deps/TestNANTestingExprC.obj.pp -Xclang -MT -Xclang TestNANTestingExprC.obj    z:/build/build/src/build/clang-plugin/tests/TestNANTestingExprC.c

We lost some backslashes in the actual command execution:
-fcrash-diagnostics-dir=z:buildpublicbuild

Stealing this - I managed to get around the try failure on Windows.

Assignee: ted → dmajor
Pushed by dmajor@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/31a754e0302d
Point -fcrash-diagnostics-dir at UPLOAD_DIR when compiling with clang in automation r=firefox-build-system-reviewers,chmanchester
Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in before you can comment on or make changes to this bug.