[Android] [PATCH 1/2] build: keep debug info in a seperate .so.dbg file for release

Thomas Guillem thomas at gllm.fr
Tue Apr 7 17:57:54 CEST 2015


*.so.dbg files are saved in .dbg/<apk_version> directory
---
 .gitignore        |  2 ++
 compile-libvlc.sh | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/.gitignore b/.gitignore
index 70d741a..78f0081 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,8 @@
 
 # tmp dir used by gdb.sh
 .gdb
+# debug symbols
+.dbg
 
 # Local configuration
 local.properties
diff --git a/compile-libvlc.sh b/compile-libvlc.sh
index 7c64c0c..48cdb13 100755
--- a/compile-libvlc.sh
+++ b/compile-libvlc.sh
@@ -633,3 +633,21 @@ $ANDROID_NDK/ndk-build -C libvlc \
     HAVE_64=${HAVE_64} \
     NDK_PROJECT_PATH=jni \
     NDK_DEBUG=${NDK_DEBUG}
+
+checkfail "ndk-build failed"
+
+if [ "$RELEASE" = 1 ]; then
+    DBG_LIB_DIR=libvlc/jni/obj/local/${ANDROID_ABI}
+    OUT_LIB_DIR=libvlc/jni/libs/${ANDROID_ABI}
+    VERSION=$(grep "android:versionName" vlc-android/AndroidManifest.xml|cut -d\" -f 2)
+    OUT_DBG_DIR=.dbg/$VERSION
+
+    mkdir -p $OUT_DBG_DIR
+
+    for lib in ${DBG_LIB_DIR}/*.so; do
+        ${CROSS_COMPILE}objcopy --only-keep-debug "$lib" "$OUT_DBG_DIR/`basename $lib.dbg`"; \
+    done
+    for lib in ${OUT_LIB_DIR}/*.so; do
+        ${CROSS_COMPILE}objcopy --add-gnu-debuglink="$OUT_DBG_DIR/`basename $lib.dbg`" "$lib" ; \
+    done
+fi
-- 
2.1.3



More information about the Android mailing list