0

In Microsoft Visual C++ 2015, how can I set a "Data Breakpoint" on a Boost shared pointer so that the debugger breaks whenever the number of strong and/or weak references changes?

Pietro
  • 12,086
  • 26
  • 100
  • 193

1 Answers1

2

The control block of a std::shared_ptrin VS2015 has _Usesand _Weaks members. Just set data breakpoints to these through their watch expressions: e.g. &(*(ptr)._Rep)._Weaks

Here's a screenshot:

VS 2015 shared_ptr control block debug view

Martin Ba
  • 37,187
  • 33
  • 183
  • 337