User forums > Help
Breakpoint in constructor/destructor
RayGun:
Yay! That'd be cool! 8)
Strangely, when I went to GDB site, I found this in their release notes (for 6.3) -
gdb/1091: Constructor breakpoints ignored
gdb/1193: g++ 3.3 creates multiple constructors: gdb 5.3 can't set breakpoints
When gcc 3.x compiles a C++ constructor or C++ destructor, it generates
2 or 3 different versions of the object code. These versions have
unique mangled names (they have to, in order for linking to work), but
they have identical source code names, which leads to a great deal of
confusion. Specifically, if you set a breakpoint in a constructor or a
destructor, gdb will put a breakpoint in one of the versions, but your
program may execute the other version. This makes it impossible to set
breakpoints reliably in constructors or destructors.
gcc 3.x generates these multiple object code functions in order to
implement virtual base classes. gcc 2.x generated just one object code
function with a hidden parameter, but gcc 3.x conforms to a multi-vendor
ABI for C++ which requires multiple object code functions.
But I prefer to think 'twas some kind of mistake and stick with Mandrav's words :D
mandrav:
--- Quote ---But I prefer to think 'twas some kind of mistake and stick with Mandrav's words
--- End quote ---
No, that's not a mistake. It's the actual explanation of the problem.
We *do* have a workaround though ;)
Bonanza:
Are there any news on this?
Maybe this can inspire someone (it actually works):
http://mailman.isi.edu/pipermail/ns-users/2005-November/052583.html
One other thing, I made C::B run my own "debugger initialization command" (source gdb.txt) setting some breakpoints:
--- Code: ---> source gdb.txt
Breakpoint 1 at 0x4013a9: file main.cpp, line 30.
Breakpoint 2 at 0x4013d2: file main.cpp, line 36.
Breakpoint 3 at 0x401411: file main.cpp, line 42.
Breakpoint 4 at 0x4014c4: file main.cpp, line 83.
Breakpoint 5 at 0x401518: file main.cpp, line 90.
(gdb)
> directory C:/cppcourse/Line_example2/
(gdb)
> delete breakpoints
(gdb)
--- End code ---
However the breakpoints was automatically removed :(
Any chance that breakpoints could be removed before running the C::B "debugger initalization commands"?
sethjackson:
Try a nightly build from here, and use gdb 6.3.
http://forums.codeblocks.org/index.php?board=20.0
Quote from the G-man. I mean mandrav..... :lol:
--- Quote ---Please people, don't resurrect one year old threads!
--- End quote ---
From here.
http://forums.codeblocks.org/index.php?topic=157.msg23669#msg23669
Bonanza:
OK sorry, what do I do? Open a new thread and refer to this?
I tried with the 28 of april build, and if I am doing everything correct, the problem is not fixed.
I was just wondering if the workaround is already available(November 17, 2005)? :
--- Quote from: mandrav on November 17, 2005, 01:20:54 pm ---We *do* have a workaround though ;)
--- End quote ---
Thanks in advance, your all so cool:-)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version