[FIXED] How to generate debug symbols for android native app?

Issue

i do first steps in developing for Native Android and need some help. I copy armv7 gdbserver to my phone and compile “hello word” test app written with C++. And now i want to debug my app with gdb from android ndk package.

I start gdb and connect to phone by target remote command and get this messages and after “s” command gdb holds.

(gdb) target remote 192.168.1.157:1235
Remote debugging using 192.168.1.157:1235
Reading /data/local/Test from remote target...
warning: File transfers from remote targets can be slow. Use "set  sysroot" to access files locally instead.
Reading /data/local/Test from remote target...
Reading symbols from target:/data/local/Test...done.
Reading /system/bin/linker from remote target...
Reading /system/bin/linker from remote target...
Reading symbols from target:/system/bin/linker...(no debugging symbols found)...done.
0xb6fdf654 in __dl__start () from target:/system/bin/linker
(gdb) s
Single stepping until exit from function __dl__start,
which has no line number information.

What i’m doing wrong? Why it holds? And how generate symbols/debug info? I tried to set “set(CMAKE_BUILD_TYPE Debug)” but no new files were generated.

My CmakeLists.Txt

set(PROJECT_NAME Test)

set(CMAKE_CXX_STANDARD 11)

set(CMAKE_TOOLCHAIN_FILE android-cmake/android.toolchain.cmake)
set(ANDROID_NDK /home/drem1lin/Android/Sdk/ndk-bundle)


set(ANDROID_NATIVE_API_LEVEL "android-19")
set(ANDROID_TOOLCHAIN_NAME "arm-linux-androideabi-4.9")
set(ANDROID_ABI "armeabi-v7a")

project(${PROJECT_NAME}) 
cmake_minimum_required(VERSION 3.1)

include_directories(include)
file(GLOB SOURCES source/*.c*)
add_executable(${PROJECT_NAME} ${SOURCES})
foreach (module_src ${MODULES})
    get_filename_component(module ${module_src} NAME_WE)
    string(TOLOWER ${module} module)
    add_library(${module} SHARED ${module_src})
    set_target_properties(${module} PROPERTIES PREFIX "")
    set_target_properties(${module} PROPERTIES SUFFIX ".m")
    target_link_libraries(${module} ${LIBRARY_DEPS})
endforeach(module_src)

With best regards Paul.

Solution

I have this trouble because I know linux build system very bad. Executible with symbols was created in {project}/obj/local/armeabi/ folder

Answered By – drem1lin

Answer Checked By – Cary Denson (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published