From 94b5d0f481d42d2b4920b2fffc15bb948a35b221 Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Mon, 25 Jan 2016 08:17:25 -0700 Subject: [PATCH] Bug 1238611 - Use PIE version of gdbserver for JimDB (arm only); r=jmaher --- .../linux32/jimdb-arm-pie.manifest | 10 ++++++++ .../linux64/jimdb-arm-pie.manifest | 10 ++++++++ .../macosx64/jimdb-arm-pie.manifest | 10 ++++++++ .../mozrunner/devices/android_device.py | 25 ++++++++++++++++--- 4 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 testing/config/tooltool-manifests/linux32/jimdb-arm-pie.manifest create mode 100644 testing/config/tooltool-manifests/linux64/jimdb-arm-pie.manifest create mode 100644 testing/config/tooltool-manifests/macosx64/jimdb-arm-pie.manifest diff --git a/testing/config/tooltool-manifests/linux32/jimdb-arm-pie.manifest b/testing/config/tooltool-manifests/linux32/jimdb-arm-pie.manifest new file mode 100644 index 000000000000..7c250d7ba18f --- /dev/null +++ b/testing/config/tooltool-manifests/linux32/jimdb-arm-pie.manifest @@ -0,0 +1,10 @@ +[ +{ +"size": 1961068, +"visibility": "public", +"digest": "84ae9acfff4428d6ec167f1378d34972eb836d39b7aeeb94f5fd490eb6ca75043902cecd5e85ffd1d2de99313a7e0f80889897cbd1d52fa8b939d6dfb17167c8", +"algorithm": "sha512", +"filename": "jimdb-arm-pie-linux_x86.tar.bz2", +"unpack": true +} +] diff --git a/testing/config/tooltool-manifests/linux64/jimdb-arm-pie.manifest b/testing/config/tooltool-manifests/linux64/jimdb-arm-pie.manifest new file mode 100644 index 000000000000..a9fab389b002 --- /dev/null +++ b/testing/config/tooltool-manifests/linux64/jimdb-arm-pie.manifest @@ -0,0 +1,10 @@ +[ +{ +"size": 2020690, +"visibility": "public", +"digest": "a057e96cc087d6108ae6b5cfa9829101628172bb58807257301224f552158f72a87bcfa85eb09991b5e7487a8154690a352bae63f599b8a4f3f02f346961fe8e", +"algorithm": "sha512", +"filename": "jimdb-arm-pie-linux_x64.tar.bz2", +"unpack": true +} +] diff --git a/testing/config/tooltool-manifests/macosx64/jimdb-arm-pie.manifest b/testing/config/tooltool-manifests/macosx64/jimdb-arm-pie.manifest new file mode 100644 index 000000000000..5ad8c0ebdac1 --- /dev/null +++ b/testing/config/tooltool-manifests/macosx64/jimdb-arm-pie.manifest @@ -0,0 +1,10 @@ +[ +{ +"size": 1878317, +"visibility": "public", +"digest": "bb15c6060582701dd1f10b2a82e38185f30dc072299e54829965d57c7772f002cd45dafe3889a63412d2b72fb56e4a07280a8b9a4d00c756eaf059da74bfe18f", +"algorithm": "sha512", +"filename": "jimdb-arm-pie-mac_x64.tar.bz2", +"unpack": true +} +] diff --git a/testing/mozbase/mozrunner/mozrunner/devices/android_device.py b/testing/mozbase/mozrunner/mozrunner/devices/android_device.py index 7f424504a526..9ad9246714a8 100644 --- a/testing/mozbase/mozrunner/mozrunner/devices/android_device.py +++ b/testing/mozbase/mozrunner/mozrunner/devices/android_device.py @@ -180,7 +180,7 @@ def verify_android_device(build_obj, install=False, xre=False, debugger=False): if debugger: # Optionally set up JimDB. See https://wiki.mozilla.org/Mobile/Fennec/Android/GDB. - build_platform = _get_build_platform(build_obj.substs) + build_platform = _get_device_platform(build_obj.substs) jimdb_path = os.path.join(EMULATOR_HOME_DIR, 'jimdb-%s' % build_platform) jimdb_utils_path = os.path.join(jimdb_path, 'utils') gdb_path = os.path.join(jimdb_path, 'bin', 'gdb') @@ -693,9 +693,28 @@ def _get_host_platform(): plat = 'linux32' return plat -def _get_build_platform(substs): +def _get_device_platform(substs): + # PIE executables are required when SDK level >= 21 - important for gdbserver + adb_path = _find_sdk_exe(substs, 'adb', False) + if not adb_path: + adb_path = 'adb' + dm = DeviceManagerADB(autoconnect=False, adbPath=adb_path, retryLimit=1) + sdk_level = None + try: + cmd = ['getprop', 'ro.build.version.sdk'] + _log_debug(cmd) + output = dm.shellCheckOutput(cmd, timeout=10) + if output: + sdk_level = int(output) + except: + _log_warning("unable to determine Android sdk level") + pie = '' + if sdk_level and sdk_level >= 21: + pie = '-pie' if substs['TARGET_CPU'].startswith('arm'): - return 'arm' + return 'arm%s' % pie + if sdk_level and sdk_level >= 21: + _log_warning("PIE gdbserver is not yet available for x86: you may not be able to debug on this platform") return 'x86' def _update_gdbinit(substs, path):