android内核调试
0x1:内核编译
下载源码:
$git clone https://android.googlesource.com/kernel/goldfish.git
$git branch -a
$git checkout remotes/origin/archive/android-gldfish-3.4
环境变量准备:
export PATH=$NDK_PATH/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin:$PATH
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=arm-eabi-
make goldfish_armv7_defconfig
内核config选项:
CONFIG_DEBUG_KERNEL=y 打开这个选项后,vmlinux 才有符号
CONFIG_KGDB=y 开启kgdb
编译内核:
make ARCH=arm CROSS_COMPILE=$NDK_PATH/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi- all
0x2:内核调试
emulator -no-window -no-audio -verbose -show-kernel -kernel goldfish/arch/arm/boot/zImage -memory 2048 -qemu -s -S
默认的调试端口为1234.
arm-linux-androideabi-gdb goldfish/vmlinux
连接方法:
target remote:1234
c
自动连接进入调试。
标题:
作者:
时间:
链接: