windows下gdb与gdb_server调试Android的程序

目录:android-ndk-r10e\\toolchains\\aarch64-linux-android-4.9\\prebuilt\\windows-x86_64\\bin

 

https://blog.csdn.net/zhangmiaoping23/article/details/44828479

概要总结:

 

手机需要执行

enforce & root

adb forward tcp:23946 tcp:23946

adb shell

ps -ef | grep vowifi

gdbserver64 :23946 --attach 4302

 

 

运行aarch64-linux-android-gdb.exe

file app_process64

set solib-absolute-prefix .

set solib-search-path .

target remote 127.0.0.1:23946

dir E:\\\\source-code\\\\latest

dir E:\\\\source-code\\\\vendor\\\\sprd\\\\proprietories-source\\\\sprd_vowifi_10_19

b zos_debug_server.c:167

 

cont

 

dir E:\\\\source-code\\vendor\\sprd\\proprietories-source\\sprd_vowifi_10_19

p  je_narenas_auto

 

 

 

 

 

 

 

手机服务端:

启动方式:  gdbserver:23946 + bin程序路径

附加方式:  gdbserver:23946+-attach [pid]

 

PC客户端:

 

C:\\Users>D:\\android-ndk-r9\\toolchains\\arm-linux-androideabi-4.4.3\\prebuilt\\windows\\bin\\arm-linux-androideabi-gdb.exe

 

(gdb) target remote 127.0.0.1:23946

 

 

 

详细过程:

 

环境: pc:windows7 x32

 

            模拟器Android4.2.2

 

gdbserver 路径 D:\\android-ndk-r9\\prebuilt\\android-arm\\gdbserver 

gdb 路径:D:\\android-ndk-r9\\toolchains\\arm-linux-androideabi-4.4.3\\prebuilt\\windows\\bin\\arm-linux-androideabi-gdb.exe

 

 

 

1.上传并修改手机的gdbserver权限

 

adb push D:\\android-ndk-r9\\prebuilt\\android-arm\\gdbserver\\gdbserver /data/local/tmp

 

adb shell chmod 777 /data/local/tmp/gdbserver

 

 

 

2.端口转发

 

adb forward tcp:23946 tcp:23946

 

 

 

3.运行gdbserver

 

启动方式:  gdbserver64:23946 + bin程序路径

 

附加方式:  gdbserver64:23946+-attach [pid]

 

root@android:/ # gdbserver64 :23946 --attach 1805

gdbserver :23946 --attach 1805

Attached; pid = 1805

Listening on port 23946

 

4.运行gdb

 

C:\\Users>D:\\android-ndk-r9\\toolchains\\arm-linux-androideabi-4.4.3\\prebuilt\\windows\\bin\\arm-linux-androideabi-gdb.exe

GNU gdb (GDB) 7.3.1-gg2

Copyright (C) 2011 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"

and \"show warranty\" for details.

This GDB was configured as \"--host=i586-pc-mingw32msvc --target=arm-linux-androi

d\".

For bug reporting instructions, please see:

<http://source.android.com/source/report-bugs.html>.

(gdb) set disassemble-next on

(gdb) set step-mode on

(gdb) target remote 127.0.0.1:23946

Remote debugging using 127.0.0.1:23946

0x40037ebc in ?? ()

=> 0x40037ebc:  90 00 bd e8     pop     {r4, r7}

(gdb)

 

此时gdbserver的显示

 

root@android:/ # gdbserver :23946 --attach 1805

gdbserver :23946 --attach 1805

Attached; pid = 1805

Listening on port 23946

Remote debugging from host 127.0.0.1

---------------------

作者:双刃剑客

来源:CSDN

原文:https://blog.csdn.net/zhangmiaoping23/article/details/44828479

版权声明:本文为博主原创文章,转载请附上博文链接!

收藏 打印