user44556
user44556

Reputation: 6093

How to break with GDB at object destruction if there is no destructor?

How to break with GDB at object destruction if there is no destructor?

Upvotes: 2

Views: 1834

Answers (1)

Didier Trosset
Didier Trosset

Reputation: 37467

If there's no destructor, you cannot break on the destructor, as there is no op-code for the destructor. You have two choices on where to break:

  • If the object is allocated on the stack, break on the closing brace of the scope defining the variable.
  • If the object is allocated on the heap, break on the delete statement.
  • If the object is statically allocated in a data segment, then you can't.

Upvotes: 2

Related Questions