I wanna to debug an native app with lldb but the executable is not created with debug_info.
My Android.bp:
cc_binary {
name: "native_algtest",
vendor: true,
srcs: [
"algorithms/algorithms.cpp",
"timer/timer.cpp",
"bench_test_native/native_test.cpp",
],
cflags: [ "-fexceptions",
"-Wreturn-type",
"-fstandalone-debug", ],
arch: {
arm64: {
strip: {
all: true,
keep_symbols_and_debug_frame: true,
keep_symbols_list: ["symbol"],
},
},
},
}
The result is:
native_algtest: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, BuildID[md5/uuid]=058e18cc89a03fd9e065b079aff26323, not stripped
At first I tried "-g" instead of "-fstandalone-debug" but it had the same result.
PS: I am executing the step-by-step from here but I cannot do the step 7
Target setup:
$ adb shell
# lldb-server platform --listen "*:10086" --server
Host lldb:
(lldb) platform select remote-android
Platform: remote-android
Connected: no
(lldb) platform connect connect://localhost:10086
Platform: remote-android
Triple: aarch64-unknown-linux-android
OS Version: 33 (5.15.92-v8+)
Kernel: #1 SMP PREEMPT Tue Feb 28 08:59:35 UTC 2023
Hostname: localhost
Connected: yes
WorkingDir: /
(lldb) file /vendor/bin/native_algtest
error: '/vendor/bin/native_algtest' doesn't contain any 'remote-gdb-server' platform architectures: aarch64, arm
UPDATE:
I found the binary with the debug_info in bellow path:
out/target/product/rpi4/symbols/vendor/bin/native_algtest
native_algtest: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, BuildID[md5/uuid]=ab107c9b82e031821b405d746c91032a, with debug_info, not stripped
But when I push it to the target it loses the debug_info property
$ file out/target/product/rpi4/symbols/vendor/bin/native_algtest
out/target/product/rpi4/symbols/vendor/bin/native_algtest: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, BuildID[md5/uuid]=ab107c9b82e031821b405d746c91032a, with debug_info, not stripped
$ adb push out/target/product/rpi4/symbols/vendor/bin/native_algtest /vendor/bin
out/target/product/rpi4/symbols/vendor/bin/native_algtest: 1 file pushed, 0 skipped. 48.2 MB/s (363640 bytes in 0.007s)
$ adb shell file vendor/bin/native_algtest
vendor/bin/native_algtest: ELF shared object, 64-bit LSB arm64, dynamic (/system/bin/linker64), for Android 33, BuildID=ab107c9b82e031821b405d746c91032a, not stripped
With this, there are some warnings but the no error anymore and lldb now is working without symbols
(lldb) file /vendor/bin/native_algtest
warning: (aarch64) /home/alisonv/.lldb/module_cache/remote-android/.cache/81BE9F9F-C3EB-E436-BEA9-954BAC713C94/libc++.so No LZMA support found for reading .gnu_debugdata section
warning: (aarch64) /home/alisonv/.lldb/module_cache/remote-android/.cache/7D87B110-4B41-B71F-169B-1597F383F8DE/libm.so No LZMA support found for reading .gnu_debugdata section
warning: (aarch64) /home/alisonv/.lldb/module_cache/remote-android/.cache/89ABE049-041F-B6B3-C44B-0CA03C962304/libdl.so No LZMA support found for reading .gnu_debugdata section
warning: (aarch64) /home/alisonv/.lldb/module_cache/remote-android/.cache/2D9F3F22-7934-C75F-6CB7-8C1B8B81EE8F/ld-android.so No LZMA support found for reading .gnu_debugdata section
Current executable set to '/vendor/bin/native_algtest' (aarch64).
(lldb) b 13
Breakpoint 1: where = native_algtest`main + 368 at native_test.cpp:13:29, address = 0x00000000000059f0