2

I've been trying to debug a shared library that I wrote in c/c++ but I can not debug it using eclipse. When I set a breakpoint is never hit and after execute info sharedlibrary in gdb, I got he following, confirming that the library is not there (called libtest-java.so)

From        To          Syms Read   Shared Object Library
                        No          /system/bin/linker
0x40093070  0x400c36f8  Yes         /Users/jpuig/Development/test/git/test_lib-protoype/java/test_Android/obj/local/armeabi/libc.so
                        No          libstdc++.so
                        No          libm.so
                        No          liblog.so
                        No          libcutils.so
                        No          libgccdemangle.so
                        No          libcorkscrew.so
                        No          libutils.so
                        No          libbinder.so
                        No          libhardware.so
                        No          libmemtrack.so
                        No          libz.so
                        No          libandroidfw.so
                        No          libexpat.so
                        No          libstlport.so
                        No          libnativehelper.so
                        No          libnetutils.so
                        No          libsync.so
                        No          libui.so
                        No          libGLES_trace.so
                        No          libEGL.so
                        No          libGLESv2.so
                        No          libgui.so
                        No          libinput.so
                        No          libcamera_metadata.so
                        No          libcamera_client.so
                        No          libpng.so
                        No          libft2.so
                        No          libjpeg.so
                        No          libgabi++.so
                        No          libicuuc.so
                        No          libicui18n.so
                        No          libskia.so
                        No          libsqlite.so
                        No          libGLESv1_CM.so
                        No          libETC1.so
                        No          libwpa_client.so
                        No          libhardware_legacy.so
                        No          libselinux.so
                        No          libsonivox.so
                        No          libcrypto.so
                        No          libssl.so
                        No          libstagefright_foundation.so
                        No          libspeexresampler.so
                        No          libaudioutils.so
                        No          libmedia.so
                        No          libusbhost.so
                        No          libharfbuzz_ng.so
                        No          libLLVM.so
                        No          libbcinfo.so
                        No          libbcc.so
                        No          libRS.so
                        No          libRScpp.so
                        No          libhwui.so
                        No          libandroid_runtime.so
                        No          libdvm.so
                        No          libjavacore.so
                        No          memtrack.msm8974.so
                        No          libdrmframework.so
                        No          libdrmframework_jni.so
                        No          libconnectivitymanager.so
                        No          libstagefright_omx.so
                        No          libstagefright_yuv.so
                        No          libvorbisidec.so
                        No          libpowermanager.so
                        No          libstagefright_enc_common.so
                        No          libstagefright_avc_common.so
                        No          libstagefright.so
                        No          libmtp.so
                        No          libexif.so
                        No          libstagefright_amrnb_common.so
                        No          libmedia_jni.so
                        No          libexif_jni.so
                        No          libcommon_time_client.so
                        No          libnbaio.so
                        No          libeffects.so
                        No          libaudioflinger.so
                        No          libvideoeditor_osal.so
                        No          libvideoeditor_videofilters.so
                        No          libvideoeditorplayer.so
                        No          libvideoeditor_core.so
                        No          libvideoeditor_jni.so
                        No          librs_jni.so
                        No          libandroid.so
                        No          libwilhelm.so
                        No          libOpenSLES.so
                        No          libjnigraphics.so
                        No          libwebviewchromium.so
                        No          libwebviewchromium_plat_support.so
                        No          libjavacrypto.so
                        No          libgsl.so
                        No          libadreno_utils.so
                        No          libEGL_adreno.so
                        No          libGLESv1_CM_adreno.so
                        No          libGLESv2_adreno.so
                        No          eglsubAndroid.so
                        No          libsc-a3xx.so
                        No          libqdutils.so
                        No          libmemalloc.so
                        No          gralloc.msm8974.so
0x77dbd638  0x77eb97b8  No          /Users/jpuig/Development/test/git/test_lib-protoype/java/test_Android/obj/local/armeabi/libtest-java.so

There is any way to load this library manually or something?? in the make file I use the following:

include $(CLEAR_VARS)

###### 
LOCAL_CPPFLAGS += -D DEBUG=1 -D NDK_DEBUG=1 
LOCAL_CFLAGS += -D DEBUG=1 -D NDK_DEBUG=1 
APP_OPTIM := debug
APP_CFLAG := -g -ggdb -O0
######

Thanks a lot for your time!

2
  • Shouldn't NDK_DEBUG=1 be a parameter to ndk-build command? Commented Feb 3, 2014 at 16:19
  • Does this have anything to do with GDB, or is the problem that the library is not being loaded into the process at runtime? What's your theory for why the process should be loading your library? What type of project are you building anyway, a normal app with a supplemental jni library? A native activity where you provide only a jni library? A standalone executable with a dynamic library? Are you explicitly loading the library from your code, or expecting the linker to deduce that it is needed? Commented Feb 3, 2014 at 16:28

1 Answer 1

2

I managed to fix it!

I was loading the library in an other class and my MainActivity was calling it when the button was pressed, therefore when GDB was ready no libraries where loaded... I thought that GDB will pick up the new library during runtime, so in order to load the library I just added the following lines in the static constructor of the first called class:

static {
        System.loadLibrary("test-java");
    }
Sign up to request clarification or add additional context in comments.

1 Comment

Anybody knows a way to load it after gdb is connected??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.