Closed
Bug 1238611
Opened 10 years ago
Closed 10 years ago
mach run --debug on Android 6.0 yields: "gdbserver" output: error: only position independent executables (PIE) are supported.
Categories
(Firefox for Android Graveyard :: JimDB, defect)
Firefox for Android Graveyard
JimDB
Tracking
(firefox47 fixed)
RESOLVED
FIXED
Firefox 47
Tracking | Status | |
---|---|---|
firefox47 | --- | fixed |
People
(Reporter: gbrown, Assigned: gbrown)
References
Details
Attachments
(2 files)
4.48 KB,
patch
|
jmaher
:
review+
|
Details | Diff | Splinter Review |
2.90 KB,
patch
|
jmaher
:
review+
|
Details | Diff | Splinter Review |
I can run an Android 6.0 arm emulator, install and run Firefox on it without trouble, but I cannot run JimDB:
$ ./mach run --debug
0:03.46 /home/gbrown/.mozbuild/android-device/jimdb-arm/bin/gdb -q --args
Fennec GDB utilities
(see utils/gdbinit and utils/gdbinit.local on how to configure settings)
1. Debug Fennec (default)
2. Debug Fennec with env vars and args
3. Debug using jdb
4. Debug content Mochitest
5. Debug compiled-code unit test
6. Debug Fennec with pid
Enter option from above: 1
New ADB device is "emulator-5554"
Using device emulator-5554
Using object directory: /home/gbrown/objdirs/droid
Set sysroot to "/home/gbrown/.mozbuild/android-device/jimdb-arm/lib/emulator-5554".
Updated solib-search-path.
Ignoring BHM signal.
Using package org.mozilla.fennec_gbrown.
Launching org.mozilla.fennec_gbrown... Done
Attaching to pid 1119... as non-root... in pkg dir... as root... in pkg dir... using intent...
"gdbserver" output:
error: only position independent executables (PIE) are supported.
"run-as" output:
run-as: exec failed for /data/local/tmp/gdbserver: Permission denied
"run-as pkg" output:
error: only position independent executables (PIE) are supported.
"su -c" output:
su: invalid uid/gid '-c'
"su -c pkg" output:
su: invalid uid/gid '-c'
"am start" output:
--------- beginning of main
/home/gbrown/.mozbuild/android-device/jimdb-arm/bin/../utils/gdbinit:141: Error in sourced command file:
failed to run gdbserver
: No such file or directory.
(gdb)
I assume the same problem exists on any Lollipop+ device.
I guess we need a PIE build of gdbserver.
Comment 3•10 years ago
|
||
I assume Jim is referring to using the gdbserver that comes with the NDK. I need to work on it some more. In the mean time, you can use the updated gdbserver package in your jimdb from here: https://people.mozilla.org/~nchen/jimdb/gdbserver-arm.tar.bz2
Flags: needinfo?(snorp)
![]() |
Assignee | |
Comment 4•10 years ago
|
||
(In reply to James Willcox (:snorp) (jwillcox@mozilla.com) from comment #3)
> In the mean time, you can use the updated
> gdbserver package in your jimdb from here:
> https://people.mozilla.org/~nchen/jimdb/gdbserver-arm.tar.bz2
I quickly tested against 4.3 and 6.0 emulators and this worked fine for me. I'll need to update the jimdb packages on tooltool.
In the meantime, overwriting ~/.mozbuild/android-device/jimdb-arm/bin/gdbserver with the version in https://people.mozilla.org/~nchen/jimdb/gdbserver-arm.tar.bz2 should allow running via 'mach run --debug'.
Assignee: nobody → gbrown
![]() |
Assignee | |
Comment 5•10 years ago
|
||
PIE doesn't work on Android < 4.1; I'll need to take that into account too.
http://stackoverflow.com/questions/30498776/position-independent-executables-and-android-lollipop
![]() |
Assignee | |
Comment 6•10 years ago
|
||
On newer Androids (sdk level >= 21), native executables must be in PIE format. On these devices, the gdbserver included in our jimdb archives cannot be used. Unfortunately, PIE executables will not work on older Androids: We need to support both, and make a selection based on Android version.
This patch updates the 'mach run --debug' command support to detect sdk level >= 21 and then use different tooltool archives containing PIE executables.
There were 6 jimdb archive varieties:
- linux 32 - arm
- linux 32 - x86
- linux 64 - arm
- linux 64 - x86
- macosx - arm
- macosx - x86
This patch adds support for 3 more:
- linux 32 - arm - pie
- linux 64 - arm - pie
- macosx - arm - pie
We still need:
- linux 32 - x86 - pie
- linux 64 - x86 - pie
- macosx - x86 - pie
but I cannot find an x86 PIE format gdbserver anywhere. I intend to leave this bug open and add x86 PIE support when it becomes available.
Attachment #8711215 -
Flags: review?(jmaher)
Comment 7•10 years ago
|
||
Comment on attachment 8711215 [details] [diff] [review]
use pie versions of gdbserver when sdk level >= 21
Review of attachment 8711215 [details] [diff] [review]:
-----------------------------------------------------------------
I would like the error handling to be better, otherwise this looks good.
::: testing/mozbase/mozrunner/mozrunner/devices/android_device.py
@@ +704,5 @@
> + cmd = ['getprop', 'ro.build.version.sdk']
> + _log_debug(cmd)
> + output = dm.shellCheckOutput(cmd, timeout=10)
> + if output:
> + sdk_level = int(output)
if we get an exception here we return x86 from this- that doesn't seem right.
Attachment #8711215 -
Flags: review?(jmaher) → review+
![]() |
Assignee | |
Comment 8•10 years ago
|
||
I should guard against ValueError and perhaps other exceptions - I'll update on landing. If the Android version cannot be determined, I think the best I can do here is warn and guess.
![]() |
Assignee | |
Updated•10 years ago
|
Keywords: leave-open
Comment 10•10 years ago
|
||
bugherder |
Comment 11•10 years ago
|
||
(In reply to Geoff Brown [:gbrown] from comment #6)
> but I cannot find an x86 PIE format gdbserver anywhere. I intend to leave
> this bug open and add x86 PIE support when it becomes available.
I'm new to Fennec and just encountered the same issue. It seems the prebuilt gdbserver from AOSP [1] works to me on a Android M x86 emulator. Is that what you're looking for?
[1] https://android.googlesource.com/platform/prebuilts/misc/+/android-6.0.0_r26/android-x86/gdbserver
![]() |
Assignee | |
Comment 12•10 years ago
|
||
(In reply to Samael Wang [:freesamael][:sawang] from comment #11)
> Is that what you're looking for?
Yes! Thank you very much!
I'll use that to complete this bug.
![]() |
Assignee | |
Updated•10 years ago
|
Keywords: leave-open
![]() |
Assignee | |
Comment 13•10 years ago
|
||
This adds 3 new tooltool manifests for x86-pie jimdb archives on linux-32/linux-64/macosx-64, completing PIE support for JimDB. Each of the archives is derived from the corresponding non-PIE archive, patched with the new version of gdbserver that works on Android 6.0. The patch also removes the earlier warning for x86 + PIE and allows for the x86-pie platforms.
jmaher -- This will be a pain to verify unless you have an x86 build of Fennec and an Android 6.0 x86 device to test on. I'd be happy with a visual review of the manifests and your rubber-stamp. (I verified on Linux 64 with the Android 6 x86 emulator.)
Attachment #8719893 -
Flags: review?(jmaher)
Updated•10 years ago
|
Attachment #8719893 -
Flags: review?(jmaher) → review+
Comment 14•10 years ago
|
||
Comment 15•10 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox47:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 47
Updated•5 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•