1. 首先安装gdbserver

apt-get install gdbserver

2. 编译-g 程序

gcc -g test_gdb.c -o test_gdb

源码如下:

#include "Util.h"

void p1()
{
int j = ;
char *p; *p = ''; printf("%p %c",p,*p);
do
{
j++;
}while(j < ); } void p2()
{
int j = ; while(j < )
{
j = j + j*j;
} } int main(int argc,char **argv)
{ CreateGerneralThread(p1); CreateGerneralThread(p2); while()
{
sleep();
}
return ;
}

3. 在server端执行下面语句:

gdbserver 192.168.110.138:9002 ./test_gdb

会出现下面这句话

tiger@ubuntu:/mnt/hgfs/e/Lessons/MyExercise/UtilLibs/THREAD$ gdbserver 192.168.115.250:9002 ./test_gdb
Process ./test_gdb created; pid = 23562
Listening on port 9002


在client端执行下面几句话:

1. gdb

出现下面这些东西:

[root@localhost ~]# gdb
GNU gdb (GDB) Fedora (7.3.50.20110722-.fc16)
Copyright (C) Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 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 "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) target remote 192.168.115.250:
Remote debugging using 192.168.115.250:
warning: Could not load vsyscall page because no executable was specified
try using the "file" command first.
0xb7fdf1d0 in ?? ()

2. 执行:

  target remote:192.168.115.250:9002

3. 执行:

  symbol-file  remote:192.168.115.250:9002

4. 可以调用类似continue , break 等命令了

参考:http://stackoverflow.com/questions/14014288/gdb-remote-debugging-cant-seem-to-find-symbols

最新文章

  1. 帆软报表FineReport中数据连接之Weblogic配置JNDI连接
  2. linux 安装后
  3. 4. Java Script 变量(untype)
  4. dmesg 的时间戳处理
  5. Hadoop 2.5.1编译
  6. LeetCode 268
  7. 关于委托:异常{ 无法将 匿名方法 转换为类型&ldquo;System.Delegate&rdquo;,因为它不是委托类型 }
  8. vue 存取、设置、清除cookie
  9. Windows&#160;批处理获取某路径下最新创建的文件的名称
  10. 【BZOJ4903】【UOJ#300】吉夫特(卢卡斯定理,动态规划)
  11. shell expect权威指南和实战
  12. php三种无限分类
  13. 【Struts2】自定义拦截器interceptors
  14. 刚刚安装完nginx,服务启动,通过浏览器无法访问的问题
  15. 演化理解 Android 异步加载图片(转)
  16. 列表中字符串按照某种规则排序的方法(python)
  17. 重温PHP之选择排序
  18. Django 之 富文本编辑器-tinymce
  19. less配置
  20. Centos7修改主机名称、DNS、网卡信息

热门文章

  1. HDU 1564 (博弈) Play a game
  2. wordpress plugins collection
  3. hihoCoder hiho一下 第四十八周 题目1 : 拓扑排序&#183;二
  4. 【转】发布的QT程序无法显示图标和图片的问题
  5. Android按键事件传递流程(二)
  6. 看看JavaScript中void(0)的含义
  7. asp.net读取xml方法
  8. HDU 4540 威威猫系列故事——打地鼠
  9. hdu 2899(数学基础+二分)
  10. 继承View绘制正方形且360旋转