移动设备中导入gdb调试工具

(1)概述

ADB调试桥安装(方式一),ADB调试桥安装好了后一般的移动设备内都不含有gdb工具,

要想使用gdb工具可以借助adb的push参数进行上传。

gdb分为gdb客户端和服务端,文件可以从点击android-gdb-6.8下载。

下载后为文件夹android-gdb-6.8,包含文件gdb和gdbserver。

(2)使用

  • 借助刷机精灵的工具-> Adb命令行进入

  • 点击Adb命令行进入如下页面

  • 将保存在D盘根目录下的adb和adbserver上传到设备的/system/bin目录下
C:Program Files (x86)Shuame4.0.7.207>adb push D:gdb /system/bin
9208 KB/s (4252764 bytes in 0.451s)

C:Program Files (x86)Shuame4.0.7.207>adb push D:gdbserver /system/bin
5843 KB/s (550488 bytes in 0.092s)
  • 查看文件是否已上传到指定目录
C:Program Files (x86)Shuame4.0.7.207>adb shell
shell@G808_3G:/ $ su
su
root@G808_3G:/ # cd /system/bin
cd /system/bin
root@G808_3G:/system/bin # ll gdb*
ll gdb*
-rw-rw-rw- shell    shell     4252764 2009-03-02 07:34 gdb
-rw-rw-rw- shell    shell      550488 2009-03-02 07:33 gdbserver
  • 确认gdb命令是否可用,提示权限拒绝...
root@G808_3G:/system/bin # ./gdb
./gdb
k_shell/2000:15016: ./gdb: can't execute: Permission denied
  • 添加可执行权限
root@G808_3G:/system/bin # chmod 777 gdb
chmod 777 gdb
root@G808_3G:/system/bin # chmod 777 gdbserver
chmod 777 gdbserver
root@G808_3G:/system/bin # ll gdb*
ll gdb*
-rwxrwxrwx shell    shell     4252764 2009-03-02 07:34 gdb
-rwxrwxrwx shell    shell      550488 2009-03-02 07:33 gdbserver
  • 添加了执行权限后,gdb已可用
root@G808_3G:/system/bin # ./gdb
./gdb


dlopen failed on 'libthread_db.so.1' - libthread_db.so.1: cannot open shared object file: No such file or directory
GDB will not be able to debug pthreads.

GNU gdb 6.8
Copyright (C) 2008 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 "arm-none-linux-gnueabi".
(gdb)
原文地址:https://www.cnblogs.com/tdcqma/p/5956836.html