-
Notifications
You must be signed in to change notification settings - Fork 258
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] wrap.sh prevents debugger from attaching #933
Comments
the ART folks seem to consider this working as intended, so i'm working on at least getting the documentation fixed to include the workaround. in the meantime, here's what the workaround looks like:
(you'll need to add your lines back in there, of course!) |
Thank you. I will try that tomorrow. |
Ok, took me more than a day to focus on this again :) Few minor issues though after making it work for me.
03-25 12:55:35.656 29330 29330 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** Nevertheless, thank you for your work. |
|
5.1 Turns out option: "log_path=stdout" is not compatible with your solution. |
@eugenis for 1 and 5. for 4 instead of shelling out to getprop you probably just want to call the bionic system property APIs directly (see |
|
Thanks @enh your script works like a charm. Maybe the scripts in folder #!/system/bin/sh
cmd=$1
shift
HERE="$(cd "$(dirname "$0")" && pwd)"
export ASAN_OPTIONS=abort_on_error=true,debug=true,print_stats=true,log_path=stderr,verbosity=true,detect_stack_use_after_return=true,print_stats=true
export LD_PRELOAD=$HERE/libclang_rt.asan-aarch64-android.so
os_version=$(getprop ro.build.version.sdk)
if [ "$os_version" -eq "27" ]; then
cmd="$cmd -Xrunjdwp:transport=dt_android_adb,suspend=n,server=y -Xcompiler-option --debuggable $@"
elif [ "$os_version" -eq "28" ]; then
cmd="$cmd -XjdwpProvider:adbconnection -XjdwpOptions:suspend=n,server=y -Xcompiler-option --debuggable $@"
else
cmd="$cmd -XjdwpProvider:adbconnection $@"
fi
exec $cmd
|
Hello, I stuck with the wrap.sh until I read this thread. It is very useful, I understand the step what I need to do. Here is my wrap.sh
|
@enh-google anything else you want to do on the docs here? |
i think we should update the script https://android.googlesource.com/platform/ndk.git/+/refs/heads/master/wrap.sh/asan.sh to take care of the various API level differences automatically, but i'm not sure if you want to +2 that change without me testing it on a device :-) |
yes, apparently new API levels also need
i've sent out a documentation change for review internally, so the public docs should be updated soon. |
Just as an FYI with https://android-review.googlesource.com/c/platform/art/+/1526559 on 'S'+ builds (after 210202) will not require the |
The ASan documentation still has this issue. This seems to work:
|
I spent a couple of days to investigate why ASAN started not working since last time I used and scratching my head, and finally found ^. Thank you @nrbrook and I hope this gets fixed in the NDK distributions. |
It is regarding android/ndk#933
https://android-review.googlesource.com/c/platform/ndk/+/2107184 I haven't actually gone through the test step there. Will start attempting that now. Probably overdue for updating that sample anyway... |
Reclassifying this as a bug again since there is something for us to ship now. This bug will be sort of perpetual if the properties needed to keep jdwp working keep changing though :( |
can we write a CTS test for this? whether we can or not, it's probably worth bringing this up with ART anyway, so they know that changes here cause real disruption for app developers... |
That's what I was going to ask you :) |
also a question for the LON folks, i think, since i don't even know why they'd ever change this stuff in the first place --- seems certain to cause breakage. |
Includes the fix from android/ndk#933. Should probably figure out how to write a gradle task to do this automatically.
Tested the fix (my sample project has been updated) and merged into master (which will become r26). Leaving this open until I talk to the art folks though. |
There are tests for wrap.sh test that might be expanded to cover this. Specifically found in cts/tests/tests/wrap. |
Since it's our only planned release for the next year, I'm pulling this change into r25. |
Bug: android/ndk#933 Test: Attached debugger to https://github.com/DanAlbert/asan-cmake-example Change-Id: I7c98473e88e31707a50aa8702a3975c94db9ea6b
Bug: android/ndk#933 Test: Attached debugger to https://github.com/DanAlbert/asan-cmake-example (cherry picked from commit faf3d43) (cherry picked from commit 8b297540d0b3b621a18438d8c506421620b7e5aa) (cherry picked from commit 26ba819) Merged-In: I7c98473e88e31707a50aa8702a3975c94db9ea6b Change-Id: Ide5db8dc4a24f0b398324e10e8834176ea8608b2
NDK latest version (19.2.5345600)
gradle/externalNativeBuild/ndkBuild
host OS: Windows 10
compiler: clang
abi checked: arm*, x86*
stl c++_shared
NDK API level 26
device API level: 26-28 (emulator, Nexus 5X)
ASAN used with build + wrap.sh bundled
When wrap.sh is bundled with the apk, the AS debugger (native)/adb does not see any debuggable processes on the device. Therefore no debugging session can be started.
When wrap.sh is not bundled with the apk (just libclang_rt.asan-*.so), debugging session starts with no problem.
I use standard contents (generated by ndk-build) for wrap.sh:
#!/system/bin/sh
HERE="$(cd "$(dirname "$0")" && pwd)"
export ASAN_OPTIONS=log_to_syslog=false,allow_user_segv_handler=1
export LD_PRELOAD=$HERE/libclang_rt.asan-i686-android.so
$@
The text was updated successfully, but these errors were encountered: