Author Topic: cannot break in a constructor  (Read 3103 times)

SoftJunkie

  • Community Member
  • Posts: 32
  • Hero Points: 1
cannot break in a constructor
« on: February 14, 2007, 07:26:59 pm »
i am developing c++ under xp/cygwin and using slickedit v11.0.2. i've created a gnu c/c++ vs project. when running under the builtin debugger, i am unable to set a breakpoint in a constructor and break within the constructor. if the constructor calls another method, i can break within THAT method. but many constructors are empty and merely contain initializers. i cannot break in those cases. i've tried setting both the -g and -ggdb but that doesn't help.

help!

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1151
  • Hero Points: 107
Re: cannot break in a constructor
« Reply #1 on: February 14, 2007, 07:52:55 pm »
I've definitely seen this in a number of different compilers and debuggers.  Depending on optimizations used, there may be nothing for the debugger to break on.   If you take a look at the assembler output, you'll see that a lot of the constructor calls have probably been inlined away.  That's a very common optimization with empty constructors even with initializer lists. 

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2364
  • Hero Points: 319
Re: cannot break in a constructor
« Reply #2 on: February 16, 2007, 11:27:55 pm »
It is also a long standing limitation with GDB.  See http://sources.redhat.com/ml/gdb/2002-12/msg00309.html for a more thorough explanation.  Though that page refers to an ancient version of GDB (5.3), this problem remains, even in GDB 6.6, since the problem is intrinsic to a lack of information in the stabs produced by GCC.

SoftJunkie

  • Community Member
  • Posts: 32
  • Hero Points: 1
Re: cannot break in a constructor
« Reply #3 on: February 17, 2007, 12:52:20 am »
not a deal breaker. i've got a few workarounds to give me what i need. thanks for the info. at least i know it's not something i've got set incorrectly.