Kaydet (Commit) d6dcc382 authored tarafından Christian Lohmaier's avatar Christian Lohmaier Kaydeden (comit) Tomaž Vajngerl

make ndk-gdb work again

it hardcodes so much :-(

Change-Id: Id86c2bcbf5936f3ab292e87210b967e2331c9435
(cherry picked from commit 78cf4ca4)
üst 3f2bf113
...@@ -5,9 +5,11 @@ ...@@ -5,9 +5,11 @@
/source/assets_strippedUI/ /source/assets_strippedUI/
/source/build/ /source/build/
/source/captures/ /source/captures/
/source/jni/Application.mk
/source/jniLibs/ /source/jniLibs/
/source/jniLibs_debug/ /source/jniLibs_debug/
/source/liboSettings.gradle /source/liboSettings.gradle
/source/libs/*/gdb.setup
/source/local.properties /source/local.properties
/source/native-code.cxx /source/native-code.cxx
/source/obj/ /source/obj/
......
...@@ -198,16 +198,25 @@ Building with all symbols is also possible but the linking is currently ...@@ -198,16 +198,25 @@ Building with all symbols is also possible but the linking is currently
slow (around 10 to 15 minutes) and you need lots of memory (around 16GB + some slow (around 10 to 15 minutes) and you need lots of memory (around 16GB + some
swap). swap).
You also want to avoid --with-android-package-name (or when you use
that, you must set it to "org.libreoffice"), otherwise ndk-gdb will complain:
ERROR: Could not extract package's data directory. Are you sure that
your installed application is debuggable?
When you have all this, install the .apk to the device, and: When you have all this, install the .apk to the device, and:
cd android/source cd android/source
<android-ndk-r10d>/ndk-gdb --adb=<android-sdk-linux>/platform-tools/adb --start <ndk-bundle>/ndk-gdb --adb=<android-sdk-linux>/platform-tools/adb [--start]
In case you used --with-android-package-name, add --package=your.package.name
to the invocation
If you get the error
ERROR: Could not find gdb.setup under ./libs/
(and an empty "Compatible device ABI:" when run with --verbose), you need to fix
the quoting in the ndk-gdb script:
@@ -574 +574 @@
-adb_var_shell BCFILES run-as $PACKAGE_NAME /system/bin/sh -c "ls lib/*.bc"
+adb_var_shell BCFILES run-as $PACKAGE_NAME /system/bin/sh -c \"ls lib/*.bc\"
Pretty printers aren't loaded automatically due to the single shared Pretty printers aren't loaded automatically due to the single shared
object, but you can still load them manually. E.g. to have a pretty-printer for object, but you can still load them manually. E.g. to have a pretty-printer for
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/main" android:icon="@drawable/main"
android:label="@string/app_name" android:label="@string/app_name"
android:debuggable="true"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:largeHeap="false"> android:largeHeap="false">
...@@ -94,7 +95,7 @@ ...@@ -94,7 +95,7 @@
</activity> </activity>
<!-- Document Browser Activity --> <!-- Document Browser Activity -->
<activity android:name=".ui.LibreOfficeUIActivity" <activity android:name="org.libreoffice.ui.LibreOfficeUIActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/BrowserTheme"> android:theme="@style/BrowserTheme">
<intent-filter> <intent-filter>
......
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application android:debuggable="false" tools:replace="android:debuggable"/>
</manifest>
<!-- vim: shiftwidth=4 softtabstop=4 expandtab:
-->
...@@ -24,7 +24,6 @@ dependencies { ...@@ -24,7 +24,6 @@ dependencies {
]) ])
compile files("${liboInstdir}/${liboShareJavaFolder}/unoil.jar") compile files("${liboInstdir}/${liboShareJavaFolder}/unoil.jar")
compile files("${liboWorkdir}/UnpackedTarball/owncloud_android_lib/bin/owncloud-android-library.jar") compile files("${liboWorkdir}/UnpackedTarball/owncloud_android_lib/bin/owncloud-android-library.jar")
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1' compile 'com.android.support:appcompat-v7:23.0.1'
} }
...@@ -39,18 +38,24 @@ android { ...@@ -39,18 +38,24 @@ android {
// ToDo move to conventional layout, so stuff can be stripped down. // ToDo move to conventional layout, so stuff can be stripped down.
sourceSets { sourceSets {
main.manifest.srcFile 'AndroidManifest.xml' main.manifest.srcFile 'AndroidManifest.xml'
// override the debuggable flag that needs to be in AndroidManifest.xml
// since ndk-gdb awks for the literal string in there :-/
release.manifest.srcFile 'ReleaseManifest.xml'
main.assets.srcDirs = ['assets'] main.assets.srcDirs = ['assets']
main.res.srcDirs = ['res'] main.res.srcDirs = ['res']
main.java.srcDirs = ['../Bootstrap/src', 'src/java'] main.java.srcDirs = ['../Bootstrap/src', 'src/java']
main.jniLibs.srcDirs = ['jniLibs'] main.jniLibs.srcDirs = ['jniLibs']
main.jni.srcDirs = [] // don't attempt to build native-lib via gradle main.jni.srcDirs = [] // don't attempt to build native-lib via gradle
// gdbserver stuff from separate dir // gdbserver for debugvariant
debug.jniLibs.srcDirs "jniLibs_debug" debug.jniLibs.srcDirs "jniLibs_debug"
// the configuration data that might be stripped or not // the configuration data that might be stripped or not
fullUI.assets.srcDirs 'assets_fullUI' fullUI.assets.srcDirs 'assets_fullUI'
strippedUI.assets.srcDirs 'assets_strippedUI' strippedUI.assets.srcDirs 'assets_strippedUI'
} }
// defaults for Manifest lintOptions {
// ndk-gdb looks for the literal value in the pre-processed manifest :-(
disable 'HardcodedDebugMode'
}
defaultConfig { defaultConfig {
minSdkVersion 14 minSdkVersion 14
// openssl on x86 makes the native-code.so contain text-relocations, // openssl on x86 makes the native-code.so contain text-relocations,
...@@ -197,16 +202,24 @@ task createStrippedConfigRegistry(type: Exec) { ...@@ -197,16 +202,24 @@ task createStrippedConfigRegistry(type: Exec) {
} }
} }
// ndk-gdb requires the gdb.setup to be in libs/<arch>/ folder - it's hardcoded in the script
// it should in theory also be able to copy the gdbserver binary onto the device, but the matching
// against prebuilt archs is too rudimentary and doesn't map armeabi-v7 to arm for example
task copyNdkDebugServer(type: Copy) { task copyNdkDebugServer(type: Copy) {
description "copies gdbserver into and creates gdb.setup in the debug-type only native directory" description "copies gdbserver into and creates gdb.setup and Application.mk for use with ndk-gdb"
inputs.file "liboSettings.gradle" inputs.file "liboSettings.gradle"
def gdbsetup = file("jniLibs_debug/${liboAndroidAppAbi}/gdb.setup") def gdbsetup = file("libs/${liboAndroidAppAbi}/gdb.setup") // only needed on buildhost
outputs.file gdbsetup // hardcoded path from ndk-gdb - reads the host architecture from that file
def applicationmk = file("jni/Application.mk")
outputs.files gdbsetup, applicationmk
outputs.dir 'jniLibs_debug' // own the directory, so it is removed on this task's clean outputs.dir 'jniLibs_debug' // own the directory, so it is removed on this task's clean
outputs.dir 'libs' // own the directory, so it is removed on this task's clean
into "jniLibs_debug/${liboAndroidAppAbi}" into "jniLibs_debug/${liboAndroidAppAbi}"
from "${liboNdkGdbserver}" from "${liboNdkGdbserver}"
doLast { doLast {
gdbsetup.text = "set solib-search-path ./obj/local/${liboAndroidAppAbi}" file("libs/${liboAndroidAppAbi}").mkdirs()
gdbsetup.text = "set solib-search-path ./obj/local/${liboAndroidAppAbi}\n"
applicationmk.text = "APP_ABI := ${liboAndroidAppAbi}\n"
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment