Skip to content
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

Add mach command to setup remote debugging on Android devices. #21759

Merged
merged 2 commits into from Sep 25, 2018

Conversation

@jdm
Copy link
Member

jdm commented Sep 20, 2018

This removes any need to fiddle with search paths for source files and makes the experience of remote debugging much less frustrating. I've tried this on a Pixel, Pixel 2, and emulator and successfully set breakpoints and investigated variables on all of them. The APP_ABI changes are necessary to prevent ndk-gdb from thinking that the build is arm64 when it's not.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors

This change is Reviewable

@highfive
Copy link

highfive commented Sep 20, 2018

Heads up! This PR modifies the following files:

@jdm
Copy link
Member Author

jdm commented Sep 20, 2018

@highfive highfive assigned paulrouget and unassigned ferjm Sep 20, 2018
@jdm jdm added this to In progress in Mobile developer ergonomics Sep 20, 2018
@paulrouget
Copy link
Contributor

paulrouget commented Sep 21, 2018

I get this error when trying to run mach ndk-gdb (Pixel 2).
Apparently, it's a permission issue on /data/data/.

Did you have to do anything special to work around that?
Did you unlock (root) your phone?

ADB command used: '/Users/paul/git/servo/android-toolchains/sdk/platform-tools/adb -s 710KPNY0363623'
ADB version: Android Debug Bridge version 1.0.40 Version 4797878 Installed as /Users/paul/git/servo/android-toolchains/sdk/platform-tools/adb
Using project directory: support/android/apk/servoapp/src/main/
Found package name: com.mozilla.servo
Selected target activity: 'com.mozilla.servo.MainActivity'
Application ABIs: armeabi-v7a, x86
Device ABIs: arm64-v8a, armeabi-v7a, armeabi
Selecting ABI: armeabi-v7a
Detected pretty printer: none
Found application data directory: /data/data/com.mozilla.servo
App gdbserver not found at /data/data/com.mozilla.servo/lib/gdbserver, uploading.
Copying gdbserver to /data/data/com.mozilla.servo/arm-gdbserver.
ERROR: Failed to copy gdbserver to /data/data/com.mozilla.servo/arm-gdbserver.
@paulrouget
Copy link
Contributor

paulrouget commented Sep 21, 2018

Ignore previous comment. Rebooting fixed my issue.

@paulrouget
Copy link
Contributor

paulrouget commented Sep 21, 2018

Now, I get this error:

ADB command used: '/Users/paul/git/servo/android-toolchains/sdk/platform-tools/adb -s 710KPNY0363623'
ADB version: Android Debug Bridge version 1.0.40 Version 4797878 Installed as /Users/paul/git/servo/android-toolchains/sdk/platform-tools/adb
Using project directory: support/android/apk/servoapp/src/main/
Found package name: com.mozilla.servo
Selected target activity: 'com.mozilla.servo.MainActivity'
Application ABIs: armeabi-v7a, x86
Device ABIs: arm64-v8a, armeabi-v7a, armeabi
Selecting ABI: armeabi-v7a
Detected pretty printer: none
Found application data directory: /data/data/com.mozilla.servo
App gdbserver not found at /data/data/com.mozilla.servo/lib/gdbserver, uploading.
Copying gdbserver to /data/data/com.mozilla.servo/arm-gdbserver.
Uploaded gdbserver to /data/data/com.mozilla.servo/arm-gdbserver
Launching activity com.mozilla.servo/com.mozilla.servo.MainActivity...
Sleeping for 0.25 seconds.
Pulling '/system/bin/linker' to '/Users/paul/git/servo/support/android/apk/obj/local/armeabi-v7a/system/bin/linker'
Pulling '/system/lib/libc.so' to '/Users/paul/git/servo/support/android/apk/obj/local/armeabi-v7a/system/lib/libc.so'
Pulling '/system/lib/libm.so' to '/Users/paul/git/servo/support/android/apk/obj/local/armeabi-v7a/system/lib/libm.so'
Pulling '/system/lib/libdl.so' to '/Users/paul/git/servo/support/android/apk/obj/local/armeabi-v7a/system/lib/libdl.so'
Starting gdbserver...
Redirecting gdbserver output to /var/folders/w0/hblnpnhj7fzg4t4p5ckvfx1m0000gp/T/gdbclient.log
Starting jdb to unblock application.
GNU gdb (GDB) 7.11
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin14.5.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Error: unable to connect to device.
Remote communication error.  Target disconnected.: Connection reset by peer.

On the phone, it says "Waiting for debugger".

I then have to restart to prevent the Failed to copy gdbserver error described in #21759 (comment)

@jdm
Copy link
Member Author

jdm commented Sep 21, 2018

Per #21768, try downloading the NDK 18 and using that when invoking the new machine command.

@jdm
Copy link
Member Author

jdm commented Sep 24, 2018

@paulrouget Ping re: last comment. It would be great to get this into master so I can stop cherry-picking it between branches.

@paulrouget
Copy link
Contributor

paulrouget commented Sep 25, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Sep 25, 2018

📌 Commit f84923f has been approved by paulrouget

@bors-servo
Copy link
Contributor

bors-servo commented Sep 25, 2018

Testing commit f84923f with merge 48df7e5...

bors-servo added a commit that referenced this pull request Sep 25, 2018
Add mach command to setup remote debugging on Android devices.

This removes any need to fiddle with search paths for source files and makes the experience of remote debugging much less frustrating. I've tried this on a Pixel, Pixel 2, and emulator and successfully set breakpoints and investigated variables on all of them. The APP_ABI changes are necessary to prevent ndk-gdb from thinking that the build is arm64 when it's not.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21759)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Sep 25, 2018

💔 Test failed - mac-rel-css2

@jdm
Copy link
Member Author

jdm commented Sep 25, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Sep 25, 2018

Testing commit f84923f with merge 151ad25...

bors-servo added a commit that referenced this pull request Sep 25, 2018
Add mach command to setup remote debugging on Android devices.

This removes any need to fiddle with search paths for source files and makes the experience of remote debugging much less frustrating. I've tried this on a Pixel, Pixel 2, and emulator and successfully set breakpoints and investigated variables on all of them. The APP_ABI changes are necessary to prevent ndk-gdb from thinking that the build is arm64 when it's not.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21759)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Sep 25, 2018

💔 Test failed - android

@jdm
Copy link
Member Author

jdm commented Sep 25, 2018

@bors-servo retry

  • network issues
@bors-servo
Copy link
Contributor

bors-servo commented Sep 25, 2018

🔒 Merge conflict

@bors-servo
Copy link
Contributor

bors-servo commented Sep 25, 2018

The latest upstream changes (presumably #21730) made this pull request unmergeable. Please resolve the merge conflicts.

@jdm jdm force-pushed the jdm:ndkgdb branch from f84923f to 5edf4e1 Sep 25, 2018
@jdm
Copy link
Member Author

jdm commented Sep 25, 2018

@bors-servo r=paulrouget

@bors-servo
Copy link
Contributor

bors-servo commented Sep 25, 2018

📌 Commit 5edf4e1 has been approved by paulrouget

@bors-servo
Copy link
Contributor

bors-servo commented Sep 25, 2018

Testing commit 5edf4e1 with merge 391d67f...

bors-servo added a commit that referenced this pull request Sep 25, 2018
Add mach command to setup remote debugging on Android devices.

This removes any need to fiddle with search paths for source files and makes the experience of remote debugging much less frustrating. I've tried this on a Pixel, Pixel 2, and emulator and successfully set breakpoints and investigated variables on all of them. The APP_ABI changes are necessary to prevent ndk-gdb from thinking that the build is arm64 when it's not.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21759)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Sep 25, 2018

💔 Test failed - mac-rel-wpt2

@jdm
Copy link
Member Author

jdm commented Sep 25, 2018

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Sep 25, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Sep 25, 2018

💔 Test failed - windows-msvc-dev

@jdm
Copy link
Member Author

jdm commented Sep 25, 2018

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Sep 25, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Sep 25, 2018

@bors-servo bors-servo merged commit 5edf4e1 into servo:master Sep 25, 2018
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@atouchet atouchet moved this from In progress to Done in Mobile developer ergonomics Sep 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.