User forums > Using Code::Blocks

constructor breakpoint issue

(1/2) > >>

tiwag:
i've the following project and want to set a breakpoint in

plotsamplefrm.cpp:44

but it doesn't break

does anyone know how i can set a breakpoint so that it breaks in the constructor ?

[attachment deleted by admin]

MortenMacFly:
Hehe... nice one. I could't find a usual way to do this but if you are interested in, here is a workaround:
- add a dummy method to your class, eg:

--- Code: ---void PlotSampleFrm::Dummy()
{
  int i = 0;
}

--- End code ---
- add a method call just before the line 44 (or whereever you want to break inside the consructor)
- add a breakpoint inside the dummy method at the line that contains int i = 0;
- run the debugger -> it will break at that line
- go stepwise (Alt+F7, "next instruction") until you are inside the constructor again -> just at the line you actually would like to have the BP...

I know, this is pointless, but at least it alows you to break at that point... :lol:

tiwag:
the good old


--- Code: ---{ asm("int $3"); }
--- End code ---

works too to get into the debugger


but i can't understand why this happens  :roll:

any ideas ?

tiwag:

--- Quote from: MortenMacFly on July 18, 2006, 07:04:04 pm ---Hehe... nice one. I could't find a usual way to do this but if you are interested in, here is a workaround:
- add a dummy method to your class, eg:
...
--- End quote ---

i've tested your Dummy() method too and it works !
(thanks for pointing out)

now i'm even more confused !!!
what makes the difference ???

thomas:

--- Quote ---works too to get into the debugger


but i can't understand why this happens
--- End quote ---

That's easy. It is because the debugger catches all exceptions. :)

Try and drag a file onto Code::Blocks under Windows XP while the debugger is running. The debugger will report a segfault immediately! However, there is no segfault at all, it is just that some particularly bright and intelligent person at MS deemed it a good idea to implement drag and drop by firing off exceptions all over the time. The same goes for file selector boxes.

Navigation

[0] Message Index

[#] Next page

Go to full version