gdb server调试步骤
编译gdb/gdbserver
编译arm-linux-gdb
下载gdb-7.12,解压缩进入目录
./configure --target=arm-linux --program-prefix=arm-linux- --prefix=/opt/arm-linux-gdb/
修改gdb/remote.c
//==================================
如果gdb提示:GDB7.6 Remote 'g' packet reply is too long
修改gdb/remote.c文件,屏蔽process_g_packet函数中的下列两行:
if (buf_len > 2 * rsa->sizeof_g_packet)
error (_(“Remote ‘g’ packet reply is too long: %s”), rs->buf);
在其后添加:
if (buf_len > 2 * rsa->sizeof_g_packet) {
rsa->sizeof_g_packet = buf_len ;
for (i = 0; i < gdbarch_num_regs (gdbarch); i++)
{
if (rsa->regs[i].pnum == -1)
continue;
if (rsa->regs[i].offset >= rsa->sizeof_g_packet)
rsa->regs[i].in_g_packet = 0;
else
rsa->regs[i].in_g_packet = 1;
}
}
make && make install
编译gdbserver
进入gdb/gdbserver目录
./configure --target=arm-linux --host=arm-linux
修改生成的makefile,将CC AR GXX都修改为交叉编译工具链中的工具
make
将生成的gdbserver移植到目标机即可
目标机:arm
假设正在运行的程序名字为hello,其进程ID 为6622,目标机IP为192.168.0.11,那么在目标机端开启gdbserver的命令格式:
#命令格式
gdbserver IP:PORT --attach PID
具体到目标机开启的命令为:
[root@test ~]# gdbserver 192.168.0.11:8888 --attach 6622
Attached; pid = 6622
Listening on port 8888
调试机:PC
root@liangwode:# arm-linux-gdb
GNU gdb (GDB) 7.12
Copyright (C) 2016 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=x86_64-pc-linux-gnu --target=arm-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) target remote 192.168.0.11:8888
Remote debugging using 192.168.0.11:8888
warning: Can not parse XML target description; XML support was disabled at compile time
Reading /home/storm/ftp/hello from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
Reading /home/storm/ftp/hello from remote target...
Reading symbols from target:/home/storm/ftp/hello...done.
Reading /lib/libc.so.6 from remote target...
Reading /lib/ld-linux-armhf.so.3 from remote target...
Reading symbols from target:/lib/libc.so.6...done.
Reading symbols from target:/lib/ld-linux-armhf.so.3...done.
0x76f0a8d4 in nanosleep () at ../sysdeps/unix/syscall-template.S:84
84 ../sysdeps/unix/syscall-template.S: No such file or directory.
gdb server调试步骤的更多相关文章
- Visual Studio 2015中使用gdb远程调试linux程序
VS的debug功能非常强大,相比而言linux上的图形化调试一直不是很好用. 如果可以使用VS来调试linux程序,应该是一件比较愉快的事情. 这在2015中变得可能,因为从2015开始VS支持An ...
- Window平台Grmon下如何使用gdb进行调试
Window平台Grmon下如何使用gdb进行调试 1输入cmd命令,打开其窗口,进入你要执行的文件目录下 2.连接开发板,输入grmon –altjtag –u 3.连上后,输入gdb命令 4.再输 ...
- GDB+GDBServer调试Linux应用程序
参考:http://blog.csdn.net/shanghaiqianlun/article/details/7820401 一.gdb+gdbserver总体介绍 远程调试环境由宿主机GDB和目标 ...
- Gdb远程调试Linux内核遇到的Bug
知识共享许可协议本作品采用知识共享署名 4.0 国际许可协议进行许可.转载保留声明头部与原文链接https://luzeshu.com/blog/gdb-bug 本博客同步在http://www.cn ...
- 基于TQ2440和Qemu的GDB+串口调试(1)
作者 彭东林 pengdonglin137@163.com 平台 TQ2440 + Linux-4.10.17 Qemu(vexpress-ca9) + Linux-4.10.17 概述 下面 ...
- 1、GDB程序调试
GDB是GNU开源组织发布的一个强大的Linux下的程序调试工具.一般来说GDB主要完成下面四个部分的功能. 1)启动你的程序,可以按照你的自定义的要求运行程序. 2)可让被调试程序在你所指定的调试的 ...
- Linux段错误及GDB Coredump调试方法
最近在Linux环境下做C语言项目,由于是在一个原有项目基础之上进行二次开发,而且项目工程庞大复杂,出现了不少问题,其中遇到最多.花费时间最长的问题就是著名的“段错误”(Segmentation Fa ...
- gdb各种调试命令和技巧
陈皓:用GDB调试程序 GDB概述———— GDB是GNU开源组织发布的一个强大的UNIX下的程序调试工具.或许,各位比较喜欢那种图形界面方式的,像VC.BCB等IDE的调试,但如果你是在UNIX平台 ...
- 一起talk GDB吧(第二回:GDB单步调试)
各位看官们,大家好.我们在上一回中说简单地介绍了GDB.这一回中,我们介绍GDB的调试功能:单步 调试. 闲话休提,言归正转. 让我们一起talk GDB吧! 看官们,我们先说一下什么是单步调试.大家 ...
随机推荐
- jquery动态改变元素内容
● text() - 设置或返回所选元素的文本内容 ● html() - 设置或返回所选元素的内容(包括 HTML 标记) ● val() - 设置或返回表单字段的值(只针对表单或者输入框)
- 【linux】【指令】systemctl 指令部分解读
systemctl [OPTIONS...] {COMMAND} ... Query or send control commands to the systemd manager. -h --hel ...
- RabbitMQ实现中AMQP与MQTT消息收发异同
实现了AMQP与MQTT(至多一次)后,用多个队列以topic exchange的方式用相同交换机监听同一个主题(topic),发现情况存在不同,觉得有点意思,所以记录了下来. 用2个MQTT(分别记 ...
- [Bzoj4289]PA2012 Tax(Dijkstra+技巧建图)
Description 给出一个N个点M条边的无向图,经过一个点的代价是进入和离开这个点的两条边的边权的较大值,求从起点1到点N的最小代价.起点的代价是离开起点的边的边权,终点的代价是进入终点的边的边 ...
- 0x01.被动信息收集
被动信息收集 基于公开渠道,不与目标系统产生直接交互,尽量避免留下痕迹(不进行大量扫描,正常交互范围) 信息收集内容 IP段 域名 邮件地址(定位邮件服务器,分为个人搭建和公网邮件系统) 文档图片数据 ...
- 基于CSS多列实现瀑布流
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Java从数据库读取页面树形菜单
从数据库加载菜单及子菜单主要使用递归的方法,具体实现可看代码 首先封装一个菜单pojo public class Menu { // 菜单id private String id; // 菜单名称 p ...
- convlstm学习资料
https://guanfuchen.github.io/post/markdown_blog_ws/markdown_blog_2017_11/convolutional_lstm_network_ ...
- USACO Section1.2 Transformations 解题报告
transform解题报告 —— icedream61 博客园(转载请注明出处)------------------------------------------------------------ ...
- 最短路径(Floyd法)
最短路径法: 算法的主要思想是:单独一条边的路径也不一定是最佳路径. 从任意一条单边路径开始.所有两点之间的距离是边的权的和,(如果两点之间没有边相连, 则为无穷大). 对于每一对顶点 u 和 v,看 ...