-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] bad debug-info line numbering with arm64 Clang in NDK r20 #1004
Comments
Chromium is passing https://chromium-review.googlesource.com/c/chromium/src/+/1492044 |
With NDK r20's Clang (5220042 based on r346389c), I think GlobalISel is off by default, except for ARM64 with -O0. It can be turned on for other configurations using
With https://reviews.llvm.org/D41362, https://reviews.llvm.org/D42276 |
https://reviews.llvm.org/D63286 is the upstream patch for this. I can talk to Nick about ensuring this is in our next toolchain update. |
I uploaded https://android-review.googlesource.com/c/platform/ndk/+/982883 to turn off -fno-experimental-isel until upstream is fixed. I think this can go into r20b. (Maybe I should reupload that patch for ndk-release-r20 and leave master alone?) |
Patch should go into master as well just in case (also helps any canary users). |
For ARM64 -O0, Clang uses the GlobalISel instruction selector, which can generate debug info with bad line number info. Pass -fno-experimental-isel to turn off GlobalISel until the upstream LLVM issue is fixed. Bug: android/ndk#1004 Test: checkbuild.py && run_tests.py Change-Id: I0aa92a8c57ce1cebd38ccc3d14dd3147477bc4b0
@nickdesaulniers - this is the bug/patch we should ensure is in the next update. |
The |
For ARM64 -O0, Clang uses the GlobalISel instruction selector, which can generate debug info with bad line number info. Pass -fno-experimental-isel to turn off GlobalISel until the upstream LLVM issue is fixed. Bug: android/ndk#1004 Test: checkbuild.py && run_tests.py Change-Id: I0aa92a8c57ce1cebd38ccc3d14dd3147477bc4b0 (cherry picked from commit 2808734)
Master has r365631, and the fix was r363331. This commit cleans up all the now unnecessary |
The bug has been fixed in Clang. Test: ./checkbuild.py && ./run_tests.py Bug: android/ndk#1004 Change-Id: I3612ca050dec72327a4ac1f9936e85242a88bd90
* Update ndk from branch 'ndk-release-r20' to 3ade53487d9afa3b03d109d6497ebb38588f95ca - Merge "Pass -fno-experimental-isel to avoid Clang bug" into ndk-release-r20 - Pass -fno-experimental-isel to avoid Clang bug For ARM64 -O0, Clang uses the GlobalISel instruction selector, which can generate debug info with bad line number info. Pass -fno-experimental-isel to turn off GlobalISel until the upstream LLVM issue is fixed. Bug: android/ndk#1004 Test: checkbuild.py && run_tests.py Change-Id: I0aa92a8c57ce1cebd38ccc3d14dd3147477bc4b0 (cherry picked from commit 2808734be2f4bb0f10f81203901022b1288358d9)
I'm filing this bug to track the upstream LLVM bug, https://bugs.llvm.org/show_bug.cgi?id=40887.
Clang sometimes hoists instructions loading a symbol's address to the start of a function, then marks them with the line number of their first reference. The effect is that:
AFAICT, the issue only affects arm64, not the other NDK architectures (arm32, x86-32, or x86-64).
The issue affects:
Unaffected:
With r19c on the same test case, I still see symbol references that are hoisted to the start of the function, but they're marked with the line number of the function's opening curly brace.
If I add
-fno-experimental-isel
to the CFLAGS, then the instructions aren't hoisted anymore, and the problem stops reproducing.Example function:
(create a new NDK C++ project in Android Studio and replace native-lib.cpp with this file)
Set a breakpoint on the "foo()" call, then step-into repeatedly. lldb advances through lines in this order: 10, 11, 14, 17, 20, 10, 13, 16, 19, 22.
Restart. Set a breakpoint on lines 11, 14, 17, and 20, then run. The debugger hits all four lines.
The text was updated successfully, but these errors were encountered: