To prepare Eclipse:
https://fatalfeel.blogspot.tw/2013/09/build-eclipse-debug-environment-for.html
//////////////////////////////////////////////
Debug LinbusConfig App
//////////////////////////////////////////////
1.
~myandroid/frameworks/base/cmds/app_process/Android.mk
LOCAL_PATH:= $(call my-dir)
.
.
LOCAL_MODULE:= app_process
.
.
LOCAL_CFLAGS := -O1 -g
LOCAL_CPPFLAGS := -O1 -g
LOCAL_STRIP_MODULE := false
include $(BUILD_EXECUTABLE)
2.
~myandroid/packages/apps/LinbusConfig/jni/Android.mk
LOCAL_PATH:= $(call my-dir)
.
.
LOCAL_MODULE := liblinattach
.
.
LOCAL_CFLAGS := -O0 -g
LOCAL_CPPFLAGS := -O0 -g
LOCAL_STRIP_MODULE := false
include $(BUILD_EXECUTABLE)
3.
In Eclipse right click the project
Debug As -> Debug Configurations -> C/C++ Remote Application (double click)
4.
in Main tab
Name: LinbusConfig_System
C/C++ Application: /mnt/projects/marsh_200/out/matrix_io/android/target/product/matrix_io/symbols/system/bin/app_process32
Project: LinbusConfig
disable auto build
5.
gedit /mnt/projects/marsh_200/myandroid/packages/apps/LinbusConfig/gdb-androidx.cmds
//add
set solib-absolute-prefix /mnt/projects/marsh_200/out/matrix_io/android/target/product/matrix_io/symbols
set
solib-search-path
/mnt/projects/marsh_200/out/matrix_io/android/target/product/matrix_io/symbols/system/lib:/mnt/projects/marsh_200/out/matrix_io/android/target/product/matrix_io/symbols/system/bin
6.
into Main
GDB debugger: /mnt/projects/marsh_200/myandroid/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androideabi-gdb
GDB command file: /mnt/projects/marsh_200/myandroid/packages/apps/LinbusConfig/gdb-androidx.cmds
enable -> Force thread list update on suspend
into Connection
Type:TCP
Host name or IP address: localhost
port number: 5039
7.
in client terminal
adb forward tcp:5039 tcp:5039
* daemon started successfully *
8.
in target terminal
su //change to root
ps | grep LinbusConfig
1589 0 0% S 11 984304K 67512K fg system com.android.linbusconfig
gdbserver :5039 --attach 1589
or
gdbserver :5039 --attach $(pgrep -f com.android.linbusconfig)
沒有留言:
張貼留言