How can I debug android native C library compiled externally with cmake

心已入冬 提交于 2019-12-22 06:57:05

问题


Essentially I need to debug native C code included in the FreeRDP Android project.

I successfully compiled the project downloaded from Github using the indicated bash script. https://github.com/FreeRDP/FreeRDP/blob/master/docs/README.android

I also correctly compiled the Android part with Android Studio. I can run the Android application correctly and without problems on a couple of devices by connecting to a couple of Windows servers.

A change to C source in the native library generates a runtime error, so I need to debug C source code.

I have exactly his problem to which no one has been able to give an answer and I do not even know if he has found a solution. Unfortunately my reputation (<50) does not allow me to post comments under that post (and other similars)


I think the .so files are compiled correctly, i have checked with objdump --syms and objdump --debugging but i can't step into native code. In Android Studio i have set Debug type: Dual and i also tried to put on LLDB Startup Commands something like breakpoint set --name <function> with no effects.

When the native code thrown the exception

--------- beginning of crash
10-02 14:42:22.064 32032-32032/com.freerdp.afreerdp A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x28 in tid 32032 (reerdp.afreerdp)

The debug stopped with following error:

__ lldb_unnamed_symbol64$$libfreerdp-android2.so

(i can't post Android Studio screenshot due my reputation)


Of course there is no problem creating an application that uses native code and set brackpoint inside the native code. https://developer.android.com/ndk/guides/index.html


Environment:
Ubuntu 16.04.3 LTS
Android Studio 2.3.3
Gradle version 3.3
cmake version 3.5.1 (on system)
cmake version 3.6.0-rc2 (on android sdk)
lldb version 4.0.0 (on android sdk)

Thanks in advance to anyone who can give me any help.

Andrea

来源:https://stackoverflow.com/questions/46488591/how-can-i-debug-android-native-c-library-compiled-externally-with-cmake

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!