繁体   English   中英

无法进入类方法gdb

[英]unable to step into a class method gdb

我正在尝试通过gdb进入类中的方法。 因此,目前,我的gdb适用于独立功能。 我可以很好地采用它们,但是,当我尝试采用一种方法时,它并没有采用。 这是我的脚本:

#include <iostream>
using namespace std;

class test{
    public:
        void say_hello(){
            cout<< "hello";
        }
};

int main(){
    test t;
    t.say_hello();
    return 0;
}

这是在我按运行“ run”命令后gdb随即吐出的内容。

warning: `/BinaryCache/coreTLS/coreTLS-35.40.1~1/Objects/coretls.build/coretls.build/Objects-normal/x86_64/system_coretls_vers.o': can't open to read symbols: No such file or directory.
warning: Could not open OSO archive file "/BinaryCache/coreTLS/coreTLS-35.40.1~1/Symbols/BuiltProducts/libcoretls_ciphersuites.a"
warning: Could not open OSO archive file "/BinaryCache/coreTLS/coreTLS-35.40.1~1/Symbols/BuiltProducts/libcoretls_handshake.a"
warning: Could not open OSO archive file "/BinaryCache/coreTLS/coreTLS-35.40.1~1/Symbols/BuiltProducts/libcoretls_record.a"
warning: Could not open OSO archive file "/BinaryCache/coreTLS/coreTLS-35.40.1~1/Symbols/BuiltProducts/libcoretls_stream_parser.a"

当我尝试步进时,会发生以下情况:

Breakpoint 1, main () at test.cpp:13
13      t.say_hello();
(gdb) s
14      return 0;
(gdb) 
0x00007fff91eec5c9 in start () from /usr/lib/system/libdyld.dylib
(gdb) 
Single stepping until exit from function start,
which has no line number information.
hello[Inferior 1 (process 9896) exited normally]

如果有什么不同,当我运行g ++ --version时,我会得到Apple LLVM版本7.0.0。 谢谢。

默认情况下,GDB会跳过不包含调试信息的功能。 但是很显然您已经拥有它,因为在main()上断开时会看到“在test.cpp:13”。

我的猜测是,您有一个较旧的GDB版本,它无法完全理解编译器生成的符号,因此无法进入成员函数。

如果您是我,我将首先尝试使用lldb调试程序(因为您的系统上已经安装了该程序),然后看它是否运行良好。 如果确实如此,那么问题确实出在旧的GDB上,所以我将升级到更高的版本。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM