GNU gdb can not step into template functions (OS X Mavericks)

后端 未结 1 1910
醉酒成梦
醉酒成梦 2021-02-20 00:06

I have installed gdb 7.7 (from GNU sources) under OS X Mavericks (10.9.2). I codesigned it, so it works fine whenever I debug a c++ file that does not

相关标签:
1条回答
  • 2021-02-20 00:58

    In seems there is an issues with the step into command at MacOS port of gdb. As workaround you could set breakpoint at the function start to step into the template function:

    (gdb) b f<double>
    Breakpoint 1 at 0x1000015ab: file ./gdb_tmpl.cpp, line 6.
    (gdb) run
    Starting program: /Users/vershov/tmp/tests/a.out 
    
    Breakpoint 1, f<double> (x=12.300000000000001) at ./gdb_tmpl.cpp:6
    6       std::cout << "In f:" << std::endl;
    

    Also, you could disassemble it, just use correct command:

    (gdb) disass f
    No symbol "f" in current context.
    (gdb) disass f<double>
    Dump of assembler code for function f<double>(double):
       0x0000000100001590 <+0>: push   %rbp
       0x0000000100001591 <+1>: mov    %rsp,%rbp
       0x0000000100001594 <+4>: sub    $0x40,%rsp
       0x0000000100001598 <+8>: mov    0xa71(%rip),%rdi        # 0x100002010
       0x000000010000159f <+15>:    lea    0x9a0(%rip),%rsi        # 0x100001f46
    ...
    
    0 讨论(0)
提交回复
热议问题