User forums > Help

Breakpoint in constructor/destructor

<< < (3/4) > >>

mandrav:

--- Quote ---I was just wondering if the workaround is already available(November 17, 2005)?
--- End quote ---

Should be. Set the breakpoint on the constructor's first line, i.e:

--- Code: (cpp) ---AClass::AClass(int x) // <-- put the breakpoint here
{
}

--- End code ---

Bonanza:
Thanks mandrav.

I tried that:-(

I am using gdb 6.3 and gcc 3.4.4. I updated to the nightly build previously mentioned (by overwritting files in the install folder).

I set the breakpoints like on the picture attached (it is breaking perfectly on a breakpoint in my main function).

The code example I used is also attached.

It works all fine if I enter the following "gdb user commands":

--- Code: ---b _ZN7Point2DC1Eii
b _ZN7Point2DC1Ev
b _ZN7Point2DC1ERKS_
b _ZN6Line2DC1E7Point2DS0_
b _ZN6Line2DD1Ev

--- End code ---

I must be doing something else wrong I guess?!?

[attachment deleted by admin]

mandrav:
Try sending this command to gdb:

--- Code: ---break Point2D::Point2D
--- End code ---

Bonanza:
OK

Then I get this from the debugger window:

--- Code: ---> break Point2D::Point2D
[0] cancel
[1] all
[2] Point2D::Point2D(Point2D const&) at main.cpp:42
[3] Point2D::Point2D() at main.cpp:36
[4] Point2D::Point2D(int, int) at main.cpp:30
>

--- End code ---

And the dubugger hangs:-(

Cannot enter "1" anywhere?

mandrav:
My bad, try rbreak Point2D::Point2D

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version