GDB 调试技巧(不断更新中......)
2017-03-29 18:44
471 查看
一、break到不同类的同名函数
方法: 在函数前面加类名以及作用域运算符eg : break A::func //break 到类A的func函数
程序如下:
//gdb_test.cpp #include<iostream> class A { public: void func() { std::cout << "A::func() is called" << std::endl; } }; class B { public: void func() { std::cout << "B::func() is called" << std::endl; } }; int main(int argc,char *argv[]) { A a; B b; a.func(); b.func(); return 0; }
调试过程如下:
[kiosk@localhost mess]$ gdb gdb_test GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-94.el7 Copyright (C) 2013 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/>... Reading symbols from /home/kiosk/practice/mess/gdb_test...done. (gdb) b A::func //备注:break 到 A::func()位置处 Breakpoint 1 at 0x4008fa: file gdb_test.cpp, line 13. (gdb) b B::func //备注:break 到 B::func()位置处 Breakpoint 2 at 0x400924: file gdb_test.cpp, line 20. (gdb)
相关文章推荐
- iOS开发调试技巧总结(不断更新)
- C/C++ 常用调试函数及技巧(不断更新中)
- 关于 智能杀毒伴侣 相关说明及技巧及版本更新 (不断更新)
- 在gdb中显示unicode等几则调试技巧
- VS 常用的一些技巧和问题集锦【不断的更新中】
- GDB调试技巧
- C# 学习技巧积累(不断更新中。。)
- 一些技巧(不断更新)
- 编程一句话技巧(不断更新)
- jquery使用技巧-不断更新中
- MyEclipse 学习笔记与使用技巧(不断更新)
- DataGridView一些技巧[不断更新]
- 在gdb中显示unicode等几则调试技巧
- ASP.NET Ajax 调试技巧:用 FireBug 调试 UpdatePanel 不更新问题
- 献给新手(950使用技巧汇编,不断更新)
- vc使用技巧(不断更新中)
- gdb中的信号(signal)相关调试技巧
- MacOSX下比较有用的技巧(不断更新)
- 用GDB调试程序---转贴,非常全面的调试技巧
- 用 GDB 调试Linux程序及有用技巧