【发布时间】:2011-09-07 07:37:04
【问题描述】:
anisha@linux-dopx:~> g++ -Wall -pedantic breakpoints.cpp -g
anisha@linux-dopx:~> gdb a.out
(gdb) b X::X
Breakpoint 1 at 0x400ac1: file breakpoints.cpp, line 14.
Breakpoint 2 at 0x400aa0: file breakpoints.cpp, line 9.
warning: Multiple breakpoints were set.
Use the "delete" command to delete unwanted breakpoints.
(gdb)
设置断点的方法是什么 在默认构造函数上,这样 GDB 不会创建不必要的断点 在其重载的对应物上?
还是它预期的 GDB 有问题 用户删除它的烂摊子? 还是我错过了一点?
编辑 1.
对于以下代码:
class X
{
public:
X ()
{
std :: cout << "\nIn the default constructor";
}
X (int)
{
std :: cout << "\nIn the parameterized constructor";
}
~X () {}
};
我试过了:
(gdb) b X:: X (11)
the class X does not have any method named X (11)
Hint: try 'X:: X (11)<TAB> or 'X:: X (11)<ESC-?>
(Note leading single quote.)
Make breakpoint pending on future shared library load? (y or [n])
没有帮助!
编辑 2。
感谢osgx,以下工作:
(gdb) b X::X(int)
Breakpoint 5 at 0x400ac1: file breakpoints.cpp, line 14.
(gdb) b X::X()
Breakpoint 6 at 0x400aa0: file breakpoints.cpp, line 9.
(gdb)
【问题讨论】:
-
什么CPU有linux-dopx?
-
@osgx 不明白你想要什么信息。
-
linux-dopx 是基于 x86 还是 x86_64 CPU?还是ARM?
-
好的 :)
anisha@linux-dopx:~> uname -a Linux linux-dopx 2.6.34-12-desktop #1 SMP PREEMPT 2010-06-29 02:39:08 +0200 x86_64 x86_64 x86_64 GNU/Linux
标签: c++ gdb breakpoints