gdb+gdbserver找不到符号文件的问题

远端gdbserver已经起来,本地使用gdb已经连接上gdbserver,但是本地提示找不到符号文件:

warning: Could not load vsyscall page because no executable was specified

try using the "file" command first.

那么使用file命令,指定被调试的可执行文件即可:

file /opt/linuxshare/helloworld/main


这里要注意一下,file指定的main已经是一个ELF可执行文件,也就是正在被调试的程序,另外,这个文件其实是存在于远端磁盘上,但是已经被mount到了本地机器上。


file成功后即可看到源码:

(gdb) file /opt/linuxshare/helloworld/main

A program is being debugged already.

Are you sure you want to change the file? (y or n) y

Reading symbols from /opt/linuxshare/helloworld/main...done.

(gdb) b main

Breakpoint 1 at 0x40055c: file main.c, line 3.

(gdb) info b

Num     Type           Disp Enb Address            What

1       breakpoint     keep y   0x000000000040055c in main at main.c:3

(gdb) l

1 #include <stdio.h>

2 int main() {

3     printf("Hello World\n");

4

5     int i = 0;

6     while(1)

7     {

8 sleep(3);

9 printf("time: %d\n", ++i);

10     }

本文转自 zhegaozhouji 51CTO博客,原文链接:http://blog.51cto.com/1038741/1715919


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值