-
GDB 6.3.2 problems
With gdb 6.3.2 (for MinGW) I can't seem to be able to debug as before.
Here is a simple example using Dev-C++.
Code:
int main() {
strdouble test2("999.43345678342"); // breakpoint is here
std::cout << std::setprecision(14) << test2;
}
When the breakpoint is reached and I click Step Into, instead of being sent to the class constructor in strdouble.cpp, I am being sent to the iostream header. And after stepping, i'm sent to the end of main.
I was debugging correctly before. This started happening as soon as I installed gdb 6.3.2. Is there any parameters I need to pass to gdb in order for it to work as expected?
-
Since this thread was so popular and since I ended up finding what the problem is, here goes for anyone who is curious or may find this later through the search feature:
GDB 6.3.2 (for MinGW only) has a bug in which it can't place breakpoints inside ctors due to the way g++ compiles the code. It creates numerous copies of each ctor.
Details aside, the workaround is to send an rbreak command to the debugger. It has to be an rbreak. A break will not do.
On my problem above I would send rbreak strdouble::strdouble as soon as the illustrated break was hit. This would create breakpoints on all ctors of strdouble. Once inside the constructor, if more breaks are needed, simple break line_number commands being sent to the debugger will do.
Breaks being sent through the IDE (by clicking the gutter) will not work. Currently due to this bug in gdb it is not possible to do it.
Also, Dev-C++ does not fully support gdb 6.3.2. So, best if you don't install it. Code::Blocks Nightly Builds don't support anything short of gdb 6.3.1. So, this is really only a problem for anyone using the Nightly Builds under windows with MingW.