Ubuntu下gdb远程调试--warning: Could not load vsyscall page because no executable was specified解决方案

1. 首先安装gdbserver

apt-get install gdbserver

2. 编译-g 程序

gcc -g test_gdb.c -o test_gdb

源码如下:

#include "Util.h"


void p1()
{
    int j = 0;
    char *p;
    
    *p = '5';

    printf("%p  %c",p,*p);
    do
    {
        j++;
    }while(j < 10);


}

void p2()
{
    int j = 0;

    while(j < 20)
    {
        j = j + j*j;
    }

}

int main(int argc,char **argv)
{

    CreateGerneralThread(p1);

    CreateGerneralThread(p2);


    while(1)
    {
        sleep(1);
    }
    return 0;
}

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-9.fc16)
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 "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:9001
Remote debugging using 192.168.115.250:9001
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

posted on 2013-07-09 17:24  净坛使者  阅读(2710)  评论(0编辑  收藏  举报

导航