+ -
当前位置:首页 → 问答吧 → gdb调试的问题

gdb调试的问题

时间:2010-08-04

来源:互联网

GNU gdb 6.8-debian
Copyright (C) 2008 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 "i486-linux-gnu"...
(gdb) l
warning: Source file is more recent than executable.
11         * Foundation.  See file COPYING.
12         *
13         */
14       
15        #include "libceph.h"
16        #include <iostream>
17        using namespace std;
18       
19        int main(int argc, const char **argv)
20        {
(gdb)
21          if (ceph_initialize(argc, argv) < 0) {
22            cerr << "error initializing\n" << std::endl;
23            return(1);
24          }
25          cout << "Successfully initialized Ceph!" << std::endl;
26       
27          if(ceph_mount() < 0) {
28            cerr << "error mounting\n" << std::endl;
29            return(1);
30          }
(gdb)
31          cout << "Successfully mounted Ceph!" << std::endl;
32          
33          //test readdir
34          DIR * dirpp;
35          struct dirent *de=new struct dirent;
36          int a=ceph_opendir("/",&dirpp);
37          if (a<0){
38              cerr<<"error!can not open dir\n";  
39              return 1;
40          }
(gdb)
41          else {
42          cout<<"find the dir\n";
43          a=ceph_readdir_r(dirpp,de);
44          if(a==1)
45             cout<<"we got a dirent!\n";
46          else if(a==0)
47            cout<<"for the end of direntory\n";
48          else
49            cout<<"on error!\n";
50          delete de;
(gdb)
51         }
52         
53         //chdir func & getcwd func
54          a=ceph_chdir("/");
55          if(a>0)
56             cout<<"chdir done!\n";
57          else{
58             cout<<"failed in chdir!\n";
59             return 1;
60           }
(gdb)
61            
62          char buf[50];
63          a=ceph_getcwd(buf,sizeof(buf));
64          if(a==0)
65            cout<<"get cwd \n";
66          
67          ceph_deinitialize();
68          cout << "Successfully deinitialized Ceph!" << std::endl;
69       
70          return 0;
(gdb)
71        }
(gdb) b 54
No line 54 in file "client/testceph.cc".//这里的问题谁能告诉我啊?
都已经列出了71行了,怎么就没有54行呢?

作者: hjwsm1989   发布时间: 2010-08-04

另外我检查了一下我的
Uid: ( 1031/ UNKNOWN)   Gid: ( 1031/ UNKNOWN)
是不是这个不对啊?我是以根用户进入的

作者: hjwsm1989   发布时间: 2010-08-04

好了,是gdb要调试的*.0文件,我没有进入这个目录下面,进了就好了……

作者: hjwsm1989   发布时间: 2010-08-04

相关阅读 更多