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_gdbProcess ./test_gdb created; pid = 23562Listening 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:9001Remote debugging using 192.168.115.250:9001warning: Could not load vsyscall page because no executable was specifiedtry 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 等命令了