allow using Android Studio with lldb to debug native part
and of course also for the Java part Using build-id linker flag allows lldb to map the installed .so to the non-stripped version on the buildhost. Also ndk-gdb supports specifying a different package name on the commandline, so no need for the error in configure anymore. Change-Id: If6887a27cc8ab15ee6ab612502cacf0a22ade737
This commit is contained in:
@@ -45,7 +45,7 @@ WHOLELIBS = \
|
|||||||
|
|
||||||
$(OBJLOCAL)/liblo-native-code.so : native-code.cxx $(ALL_STATIC_LIBS)
|
$(OBJLOCAL)/liblo-native-code.so : native-code.cxx $(ALL_STATIC_LIBS)
|
||||||
mkdir -p $(OBJLOCAL)
|
mkdir -p $(OBJLOCAL)
|
||||||
$(CXX) -Wl,--gc-sections -Wl,--version-script=../Bootstrap/version.map -Wl,--no-keep-files-mapped -Wl,--no-undefined -DANDROID -DDISABLE_DYNLOADING -shared -o $(OBJLOCAL)/liblo-native-code.so -I$(BUILDDIR)/config_host -I$(SRCDIR)/include native-code.cxx -L$(INSTDIR)/$(LIBO_LIB_FOLDER) $(WHOLELIBS) $(LIBS) -lgnustl_static -lGLESv2 -landroid -ljnigraphics -llog -lz
|
$(CXX) -Wl,--build-id=sha1 -Wl,--gc-sections -Wl,--version-script=../Bootstrap/version.map -Wl,--no-keep-files-mapped -Wl,--no-undefined -DANDROID -DDISABLE_DYNLOADING -shared -o $(OBJLOCAL)/liblo-native-code.so -I$(BUILDDIR)/config_host -I$(SRCDIR)/include native-code.cxx -L$(INSTDIR)/$(LIBO_LIB_FOLDER) $(WHOLELIBS) $(LIBS) -lgnustl_static -lGLESv2 -landroid -ljnigraphics -llog -lz
|
||||||
|
|
||||||
$(SODEST)/liblo-native-code.so : $(OBJLOCAL)/liblo-native-code.so
|
$(SODEST)/liblo-native-code.so : $(OBJLOCAL)/liblo-native-code.so
|
||||||
mkdir -p $(SODEST)
|
mkdir -p $(SODEST)
|
||||||
|
@@ -8,8 +8,8 @@ Contains common code for all projects on Android to bootstrap LibreOffice. In
|
|||||||
addition it is a home to LibreOfficeKit (LOK - see libreofficekit/README) JNI
|
addition it is a home to LibreOfficeKit (LOK - see libreofficekit/README) JNI
|
||||||
classes.
|
classes.
|
||||||
|
|
||||||
LOAndroid3 (in experimental)
|
stuff in source directory
|
||||||
****************************
|
*************************
|
||||||
|
|
||||||
LibreOffice Android application - the code is based on Fennec (Firefox for Android).
|
LibreOffice Android application - the code is based on Fennec (Firefox for Android).
|
||||||
It uses OpenGL ES 2 for rendering of the document tiles which are gathered from
|
It uses OpenGL ES 2 for rendering of the document tiles which are gathered from
|
||||||
@@ -158,7 +158,7 @@ For instructions on how to build for Android, see README.cross.
|
|||||||
Attach your device, so 'adb devices' shows it. Then run:
|
Attach your device, so 'adb devices' shows it. Then run:
|
||||||
|
|
||||||
cd android/source
|
cd android/source
|
||||||
ant debug install
|
make install
|
||||||
adb logcat
|
adb logcat
|
||||||
|
|
||||||
and if all goes well, you should have some nice debug output to enjoy when you
|
and if all goes well, you should have some nice debug output to enjoy when you
|
||||||
@@ -187,7 +187,8 @@ space on your emulator's or device's /data volume. You can do:
|
|||||||
|
|
||||||
adb shell stop; adb shell start
|
adb shell stop; adb shell start
|
||||||
|
|
||||||
* Debugging
|
Debugging
|
||||||
|
---------
|
||||||
|
|
||||||
First of all, you need to configure the build with --enable-debug or
|
First of all, you need to configure the build with --enable-debug or
|
||||||
--enable-dbgutil. You may want to provide --enable-selective-debuginfo too,
|
--enable-dbgutil. You may want to provide --enable-selective-debuginfo too,
|
||||||
@@ -198,6 +199,8 @@ 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).
|
||||||
|
|
||||||
|
* Using ndk-gdb
|
||||||
|
|
||||||
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
|
||||||
@@ -225,11 +228,32 @@ rtl::OString, you need:
|
|||||||
(gdb) python sys.path.insert(0, "/master/solenv/gdb")
|
(gdb) python sys.path.insert(0, "/master/solenv/gdb")
|
||||||
(gdb) source /master/instdir/program/libuno_sal.so.3-gdb.py
|
(gdb) source /master/instdir/program/libuno_sal.so.3-gdb.py
|
||||||
|
|
||||||
|
* Using Android Studio (and thus lldb)
|
||||||
|
|
||||||
|
Note that both might not yield the same results - so if lldb doesn't show you
|
||||||
|
useful info, try with the ndk-gdb method and the other way round.
|
||||||
|
|
||||||
|
- open android/source/build.gradle in Android Studio via File|New → Import Project
|
||||||
|
- make sure you select the right build variant (strippedUIDebug is what you want)
|
||||||
|
- use Run|Edit Configurations to create a new configuration of type "Android Native"
|
||||||
|
- on tab "General" pick module "source"
|
||||||
|
- on tab "Native Debugger" add android/source/obj/local/<hostarch> to
|
||||||
|
the Symbol directories
|
||||||
|
|
||||||
|
Then you can select your new configuration and use Run | Debug to launch it.
|
||||||
|
Note that lldb doesn't initially stop execution, so if you want to add
|
||||||
|
breakpoints using lldb prompt, you manually have to pause execution, then you
|
||||||
|
can witch to the lldb tab and add your breakpoints. However making use of the
|
||||||
|
editor just using File|Open .. to open the desired file in Android Studio and
|
||||||
|
then toggling the breakpoint by clicking on the margin is more comfortable.
|
||||||
|
|
||||||
* Debugging the Java part
|
* Debugging the Java part
|
||||||
|
|
||||||
At the moment the code is not organized in a way that would make Eclipse or
|
Open android/source/build.gradle in Android studio via File|New → Import
|
||||||
Android Studio happy as-is, so the quickest way is to use the jdb command-line
|
Project and you can use Android Studio's debugging interface.
|
||||||
debugger. Steps to use it:
|
Just make sure you pick the correct build variant (strippedUIDebug)
|
||||||
|
|
||||||
|
The alternative is to use the jdb command-line debugger. Steps to use it:
|
||||||
|
|
||||||
1) Find out the JDWP ID of a debuggable application:
|
1) Find out the JDWP ID of a debuggable application:
|
||||||
|
|
||||||
|
@@ -12311,10 +12311,6 @@ if echo "$host_os" | grep -q linux-android ; then
|
|||||||
|
|
||||||
AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
|
AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
|
||||||
else
|
else
|
||||||
if test -n "$ENABLE_DEBUG" -a "$with_android_package_name" != "org.libreoffice" ; then
|
|
||||||
AC_MSG_ERROR([The package name must be set
|
|
||||||
to org.libreoffice when debugging, please avoid --with-android-package-name.])
|
|
||||||
fi
|
|
||||||
ANDROID_PACKAGE_NAME="$with_android_package_name"
|
ANDROID_PACKAGE_NAME="$with_android_package_name"
|
||||||
AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
|
AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user