Obsolete
Status Update
Comments
an...@google.com <an...@google.com> #3
I believe the problem here is `adb jdwp` (and `adb track-jdwp`) is returning the process id of a wrapper process (several levels away) instead of the actual app process. It happens with any wrap.sh script.
That causes Android Studio to be unable to connect to the process, so both the java and native debuggers don't work, probably profilers as well. I'll also have a look at if it is working in Studio 3.1 or 3.0, maybe we were working around it somehow before.
generic_x86:/ $ ps -ef | grep gpx
u0_a92 27894 1680 0 13:22:02 ? 00:00:00 sh -c /system/bin/logwrapper /data/app/com.gpxblog.exampleasan-Z7rifuIT8Q5BcqNRKeQMSQ==/lib/x86/wrap.sh /system/bin/app_process32 -Xcompiler-option --generate-mini-debug-info /system/bin --application '--nice-name=com.gpxblog.exampleasan' com.android.internal.os.WrapperInit 28 27 'android.app.ActivityThread' 'seq=494'
u0_a92 27908 27894 0 13:22:02 ? 00:00:00 logwrapper /data/app/com.gpxblog.exampleasan-Z7rifuIT8Q5BcqNRKeQMSQ==/lib/x86/wrap.sh /system/bin/app_process32 -Xcompiler-option --generate-mini-debug-info /system/bin --application --nice-name=com.gpxblog.exampleasan com.android.internal.os.WrapperInit 28 27 android.app.ActivityThread seq=494
u0_a92 27909 27908 0 13:22:02 ? 00:00:00 sh /data/app/com.gpxblog.exampleasan-Z7rifuIT8Q5BcqNRKeQMSQ==/lib/x86/wrap.sh /system/bin/app_process32 -Xcompiler-option --generate-mini-debug-info /system/bin --application --nice-name=com.gpxblog.exampleasan com.android.internal.os.WrapperInit 28 27 android.app.ActivityThread seq=494
u0_a92 27912 27909 0 13:22:02 ? 00:00:00 com.gpxblog.exampleasan
shell 28059 27732 1 13:30:53 pts/0 00:00:00 grep gpx
$ adb jdwp
1823
1962
2082
2169
2342
2446
2467
2480
2633
3113
3132
3228
21561
21593
23803
23820
27023
27047
27274
27622
27894
That causes Android Studio to be unable to connect to the process, so both the java and native debuggers don't work, probably profilers as well. I'll also have a look at if it is working in Studio 3.1 or 3.0, maybe we were working around it somehow before.
generic_x86:/ $ ps -ef | grep gpx
u0_a92 27894 1680 0 13:22:02 ? 00:00:00 sh -c /system/bin/logwrapper /data/app/com.gpxblog.exampleasan-Z7rifuIT8Q5BcqNRKeQMSQ==/lib/x86/wrap.sh /system/bin/app_process32 -Xcompiler-option --generate-mini-debug-info /system/bin --application '--nice-name=com.gpxblog.exampleasan' com.android.internal.os.WrapperInit 28 27 'android.app.ActivityThread' 'seq=494'
u0_a92 27908 27894 0 13:22:02 ? 00:00:00 logwrapper /data/app/com.gpxblog.exampleasan-Z7rifuIT8Q5BcqNRKeQMSQ==/lib/x86/wrap.sh /system/bin/app_process32 -Xcompiler-option --generate-mini-debug-info /system/bin --application --nice-name=com.gpxblog.exampleasan com.android.internal.os.WrapperInit 28 27 android.app.ActivityThread seq=494
u0_a92 27909 27908 0 13:22:02 ? 00:00:00 sh /data/app/com.gpxblog.exampleasan-Z7rifuIT8Q5BcqNRKeQMSQ==/lib/x86/wrap.sh /system/bin/app_process32 -Xcompiler-option --generate-mini-debug-info /system/bin --application --nice-name=com.gpxblog.exampleasan com.android.internal.os.WrapperInit 28 27 android.app.ActivityThread seq=494
u0_a92 27912 27909 0 13:22:02 ? 00:00:00 com.gpxblog.exampleasan
shell 28059 27732 1 13:30:53 pts/0 00:00:00 grep gpx
$ adb jdwp
1823
1962
2082
2169
2342
2446
2467
2480
2633
3113
3132
3228
21561
21593
23803
23820
27023
27047
27274
27622
27894
jm...@google.com <jm...@google.com> #4
jm...@google.com <jm...@google.com> #5
27894 seems to be there because it's execing sh, and the art-side jdwp socket doesn't make its end O_CLOEXEC, so the socket just hangs around and adbd doesn't realize that the other end isn't really there.
al...@google.com <al...@google.com> #6
seems that the required -XjdwpProvider:adbconnection doesn't get passed to wrap.sh so no debugging is started (also the socket should be CLOEXEC so that it doesn't hang around in the adb jdwp on userdebug)
gp...@gmail.com <gp...@gmail.com> #7
FWIW, I figured out how to find the version that was working:
https://cdn-images-1.medium.com/max/1600/1*4SnydQQhUEppcAhNFFpX2A.png
The title bar says 2.3.3
That's from when I wrote the article:
https://virtualrealitypop.com/oreo-ndk-secrets-7d075a9b084
Admittedly, I'm not entirely certain if that was being run on a phone that had asan_device_setup already installed system wide. I was updating that script to work in Windows a month or so prior and have lots of phones. However, it was with a wrap script.
Hope it helps!
The title bar says 2.3.3
That's from when I wrote the article:
Admittedly, I'm not entirely certain if that was being run on a phone that had asan_device_setup already installed system wide. I was updating that script to work in Windows a month or so prior and have lots of phones. However, it was with a wrap script.
Hope it helps!
al...@google.com <al...@google.com> #8
I'm pretty sure that the AndroidStudio version doesn't matter and this is all to do with the android version you are using.
gp...@gmail.com <gp...@gmail.com> #9
In that case, it was from the first OTA release of "O" on the Pixel XL.
I do remember it working in larger projects on my Pixel 2 XL and March 28th 2018's most recent OTA as that's the date that I confirmed one no longer needed root to use the project and updated the blog post with that information.
Other than that the most information I can point out is: when it did work, there were two PID's created for the app. One was the launch PID that seemed to be zombie until the debug session finished (it looked related the shell script), and lldb attached to the actual app PID.
I do remember it working in larger projects on my Pixel 2 XL and March 28th 2018's most recent OTA as that's the date that I confirmed one no longer needed root to use the project and updated the blog post with that information.
Other than that the most information I can point out is: when it did work, there were two PID's created for the app. One was the launch PID that seemed to be zombie until the debug session finished (it looked related the shell script), and lldb attached to the actual app PID.
ap...@google.com <ap...@google.com> #10
Project: platform/art
Branch: master
commit 54f535a3b43186727ff84fb4d604f6c57473d8ce
Author: Alex Light <allight@google.com>
Date: Mon Jun 04 14:14:19 2018
Pass SOCK_CLOEXEC to adb socket.
We were not passing CLOEXEC to the adb-socket in adbconnection. This
could lead to extra (unusable) jdwp PIDs in adb jdwp in some
circumstances.
Test: Build an app with wrap.sh.
adb jdwp on a userdebug device.
Ensure pid of wrap.sh is not present in list.
Bug: 109505014
Change-Id: Icd41bf037666d6abe35897681aed98b00fb290ac
M adbconnection/adbconnection.cc
https://android-review.googlesource.com/699305
https://goto.google.com/android-sha1/54f535a3b43186727ff84fb4d604f6c57473d8ce
Branch: master
commit 54f535a3b43186727ff84fb4d604f6c57473d8ce
Author: Alex Light <allight@google.com>
Date: Mon Jun 04 14:14:19 2018
Pass SOCK_CLOEXEC to adb socket.
We were not passing CLOEXEC to the adb-socket in adbconnection. This
could lead to extra (unusable) jdwp PIDs in adb jdwp in some
circumstances.
Test: Build an app with wrap.sh.
adb jdwp on a userdebug device.
Ensure pid of wrap.sh is not present in list.
Bug: 109505014
Change-Id: Icd41bf037666d6abe35897681aed98b00fb290ac
M adbconnection/adbconnection.cc
al...@google.com <al...@google.com> #11
Actually this is android-studio.
It did help me find several semi-related issues with adbconnection though.
Back over to andrewford@
Relying on ddms (adb jdwp) to get the pid for the native debugger isn't going to work for anything using wrap.sh because the jdwp is only setup if the wrap.sh actually requests it. Procedure varies by api level, for >=Q and O one must put '-Xcompiler-option --debuggable' between $1 and $2 in the arguments passed to wrap.sh, P needs '-XjdwpProvider:adbconnection -Xcompiler-option --debuggable' without the patches here.
It did help me find several semi-related issues with adbconnection though.
Back over to andrewford@
Relying on ddms (adb jdwp) to get the pid for the native debugger isn't going to work for anything using wrap.sh because the jdwp is only setup if the wrap.sh actually requests it. Procedure varies by api level, for >=Q and O one must put '-Xcompiler-option --debuggable' between $1 and $2 in the arguments passed to wrap.sh, P needs '-XjdwpProvider:adbconnection -Xcompiler-option --debuggable' without the patches here.
ap...@google.com <ap...@google.com> #12
Project: platform/art
Branch: master
commit 5ebdc88a8469cb2bb9188c18b379ca486d338728
Author: Alex Light <allight@google.com>
Date: Mon Jun 04 16:42:30 2018
Add missing ',' in default jdwp argument list
We were incorrectly missing a ',' in the default jdwp argument list.
This meant that a manual -XjdwpProvider:adbconnection will fail due to
failing to parse the argument string.
Test: run app with wrap.sh that adds '-XjdwpProvider:adbconnection -Xcompiler-option --debuggable'
Attach debugger
Bug: 109505014
Change-Id: Id09e04cd92c2f89a4bcdf95b05071bacd509b286
M adbconnection/adbconnection.cc
https://android-review.googlesource.com/699353
https://goto.google.com/android-sha1/5ebdc88a8469cb2bb9188c18b379ca486d338728
Branch: master
commit 5ebdc88a8469cb2bb9188c18b379ca486d338728
Author: Alex Light <allight@google.com>
Date: Mon Jun 04 16:42:30 2018
Add missing ',' in default jdwp argument list
We were incorrectly missing a ',' in the default jdwp argument list.
This meant that a manual -XjdwpProvider:adbconnection will fail due to
failing to parse the argument string.
Test: run app with wrap.sh that adds '-XjdwpProvider:adbconnection -Xcompiler-option --debuggable'
Attach debugger
Bug: 109505014
Change-Id: Id09e04cd92c2f89a4bcdf95b05071bacd509b286
M adbconnection/adbconnection.cc
ap...@google.com <ap...@google.com> #13
Project: platform/art
Branch: master
commit 5af3f503f3ad5a24dc1acac3070f7dcda4b6593d
Author: Alex Light <allight@google.com>
Date: Mon Jun 04 16:17:56 2018
Make adbconnection start automatically for debuggable apps (on target)
With wrap.sh it is required that apps that wish to be debuggable
declare that explicitly by adding the '-Xcompiler-option --debuggable'
options. When we switched to the new debugger implementation we
accidentally added a requirement that you pass
-XjdwpProvider:adbconnection. This removes that requirement and
returns to the earlier state.
Bug: 109505014
Test: Build program with wrap.sh that adds -Xcompiler-option --debuggable
Attach debugger to program.
Change-Id: I9416ed3b156776439f5bfec032fee3f11fe4eb3c
M cmdline/cmdline_parser_test.cc
M runtime/jdwp_provider.h
M runtime/runtime.cc
M runtime/runtime_options.def
https://android-review.googlesource.com/699354
https://goto.google.com/android-sha1/5af3f503f3ad5a24dc1acac3070f7dcda4b6593d
Branch: master
commit 5af3f503f3ad5a24dc1acac3070f7dcda4b6593d
Author: Alex Light <allight@google.com>
Date: Mon Jun 04 16:17:56 2018
Make adbconnection start automatically for debuggable apps (on target)
With wrap.sh it is required that apps that wish to be debuggable
declare that explicitly by adding the '-Xcompiler-option --debuggable'
options. When we switched to the new debugger implementation we
accidentally added a requirement that you pass
-XjdwpProvider:adbconnection. This removes that requirement and
returns to the earlier state.
Bug: 109505014
Test: Build program with wrap.sh that adds -Xcompiler-option --debuggable
Attach debugger to program.
Change-Id: I9416ed3b156776439f5bfec032fee3f11fe4eb3c
M cmdline/cmdline_parser_test.cc
M runtime/jdwp_provider.h
M runtime/runtime.cc
M runtime/runtime_options.def
ap...@google.com <ap...@google.com> #14
Project: platform/art
Branch: master
commit b2926c0cdbd30af7529b90fe20b24010f844ccc1
Author: Andreas Gampe <agampe@google.com>
Date: Wed Jun 06 05:49:44 2018
Revert "Make adbconnection start automatically for debuggable apps (on target)"
This reverts commit 5af3f503f3ad5a24dc1acac3070f7dcda4b6593d.
Reason for revert: Breaks target tests
Bug: 109505014
Change-Id: I43877a11c615637a152954e0c0d0b2b0f18bcc9e
Test: none
M cmdline/cmdline_parser_test.cc
M runtime/jdwp_provider.h
M runtime/runtime.cc
M runtime/runtime_options.def
https://android-review.googlesource.com/700224
https://goto.google.com/android-sha1/b2926c0cdbd30af7529b90fe20b24010f844ccc1
Branch: master
commit b2926c0cdbd30af7529b90fe20b24010f844ccc1
Author: Andreas Gampe <agampe@google.com>
Date: Wed Jun 06 05:49:44 2018
Revert "Make adbconnection start automatically for debuggable apps (on target)"
This reverts commit 5af3f503f3ad5a24dc1acac3070f7dcda4b6593d.
Reason for revert: Breaks target tests
Bug: 109505014
Change-Id: I43877a11c615637a152954e0c0d0b2b0f18bcc9e
Test: none
M cmdline/cmdline_parser_test.cc
M runtime/jdwp_provider.h
M runtime/runtime.cc
M runtime/runtime_options.def
ap...@google.com <ap...@google.com> #15
Project: platform/art
Branch: master
commit 7b39a39258311ad6c3da5934746a186c185c3f4f
Author: Alex Light <allight@google.com>
Date: Wed Jun 06 14:18:24 2018
Revert^2 "Make adbconnection start automatically for debuggable apps (on target)"
This reverts commit b2926c0cdbd30af7529b90fe20b24010f844ccc1.
We were trying to start with adbconnection but that was not always
available on devices. This could cause tests to fail.
Bug: 109505014
Reason for revert: Fixed issue causing target tests to sometimes fail.
Test: ./test.py --target
Change-Id: I0bb9cd2dce87145a8a9c372e2f015e36a3276369
M cmdline/cmdline_parser_test.cc
M runtime/jdwp_provider.h
M runtime/runtime.cc
M runtime/runtime_options.def
M test/etc/run-test-jar
https://android-review.googlesource.com/700424
https://goto.google.com/android-sha1/7b39a39258311ad6c3da5934746a186c185c3f4f
Branch: master
commit 7b39a39258311ad6c3da5934746a186c185c3f4f
Author: Alex Light <allight@google.com>
Date: Wed Jun 06 14:18:24 2018
Revert^2 "Make adbconnection start automatically for debuggable apps (on target)"
This reverts commit b2926c0cdbd30af7529b90fe20b24010f844ccc1.
We were trying to start with adbconnection but that was not always
available on devices. This could cause tests to fail.
Bug: 109505014
Reason for revert: Fixed issue causing target tests to sometimes fail.
Test: ./test.py --target
Change-Id: I0bb9cd2dce87145a8a9c372e2f015e36a3276369
M cmdline/cmdline_parser_test.cc
M runtime/jdwp_provider.h
M runtime/runtime.cc
M runtime/runtime_options.def
M test/etc/run-test-jar
ap...@google.com <ap...@google.com> #16
Project: platform/art
Branch: master
commit fb57a6528d73e6ddbccf3049f08f6fa400e6dcd1
Author: Nicolas Geoffray <ngeoffray@google.com>
Date: Fri Jun 08 09:40:19 2018
Revert "Revert^2 "Make adbconnection start automatically for debuggable apps (on target)""
This reverts commit 7b39a39258311ad6c3da5934746a186c185c3f4f.
Fails jdwp tests on target.
Bug: 109505014
Change-Id: Ib8a278bc8c8137e1f1397e3e881d652504fea96f
M cmdline/cmdline_parser_test.cc
M runtime/jdwp_provider.h
M runtime/runtime.cc
M runtime/runtime_options.def
M test/etc/run-test-jar
https://android-review.googlesource.com/702204
https://goto.google.com/android-sha1/fb57a6528d73e6ddbccf3049f08f6fa400e6dcd1
Branch: master
commit fb57a6528d73e6ddbccf3049f08f6fa400e6dcd1
Author: Nicolas Geoffray <ngeoffray@google.com>
Date: Fri Jun 08 09:40:19 2018
Revert "Revert^2 "Make adbconnection start automatically for debuggable apps (on target)""
This reverts commit 7b39a39258311ad6c3da5934746a186c185c3f4f.
Fails jdwp tests on target.
Bug: 109505014
Change-Id: Ib8a278bc8c8137e1f1397e3e881d652504fea96f
M cmdline/cmdline_parser_test.cc
M runtime/jdwp_provider.h
M runtime/runtime.cc
M runtime/runtime_options.def
M test/etc/run-test-jar
ap...@google.com <ap...@google.com> #17
Project: platform/art
Branch: master
commit baac7e44445286bb2a048ff24a14a65c537dd9b9
Author: Alex Light <allight@google.com>
Date: Fri Jun 08 15:30:11 2018
"Revert^4 "Make adbconnection start automatically for debuggable apps (on target)"
Needed to tell run-jdwp-tests.sh not to load adbconnection since it
might not be present.
This reverts commit fb57a6528d73e6ddbccf3049f08f6fa400e6dcd1.
Reason for revert: Added -XjdwpProvider:none to run-jdwp-tests.sh
Bug: 109505014
Test: ./art/tools/run-libjdwp-tests.sh
Change-Id: I43941f7048ae5b64c6cbe7a8e7c273d47596192c
M cmdline/cmdline_parser_test.cc
M runtime/jdwp_provider.h
M runtime/runtime.cc
M runtime/runtime_options.def
M test/etc/run-test-jar
M tools/run-jdwp-tests.sh
https://android-review.googlesource.com/702364
https://goto.google.com/android-sha1/baac7e44445286bb2a048ff24a14a65c537dd9b9
Branch: master
commit baac7e44445286bb2a048ff24a14a65c537dd9b9
Author: Alex Light <allight@google.com>
Date: Fri Jun 08 15:30:11 2018
"Revert^4 "Make adbconnection start automatically for debuggable apps (on target)"
Needed to tell run-jdwp-tests.sh not to load adbconnection since it
might not be present.
This reverts commit fb57a6528d73e6ddbccf3049f08f6fa400e6dcd1.
Reason for revert: Added -XjdwpProvider:none to run-jdwp-tests.sh
Bug: 109505014
Test: ./art/tools/run-libjdwp-tests.sh
Change-Id: I43941f7048ae5b64c6cbe7a8e7c273d47596192c
M cmdline/cmdline_parser_test.cc
M runtime/jdwp_provider.h
M runtime/runtime.cc
M runtime/runtime_options.def
M test/etc/run-test-jar
M tools/run-jdwp-tests.sh
ch...@google.com <ch...@google.com> #18
We don't currently have the bandwidth to work on this directly. We also need to step back and look at the bigger picture for fixing this. The support in Studio for adding wrap.sh needs to be improved (from basically nothing).
[Deleted User] <[Deleted User]> #19
delete
ja...@socialpoint.es <ja...@socialpoint.es> #20
After reading Steven Winston comment about being able to debug on android studio 2.3.3 I just decided to give it a try. It didn't work on the default c++ project when adding the wrap.sh script (with just $@). I was using android studio 2.3.3 + API level 26 + ndk r17c, for armeabiv7a, on windows 10. My guess is that Steven managed to debug with a device with the asan_device_setup already applied and no wrap.sh.
Hope this helps.
Hope this helps.
ar...@google.com <ar...@google.com>
gp...@gmail.com <gp...@gmail.com> #21
Is this truly obsolete? I can test it again.
Description
Here's a project setup for running ASAN:
NB: This seems to effect AS 3.2 Canary 16. I have a memory of lldb attaching and working in AS 3.1.2 but don't remember the exact version that it last worked in and thus can't easily label it a regression.