Author Topic: Watching smart pointers  (Read 3149 times)

Offline Dahman

  • Multiple posting newcomer
  • *
  • Posts: 16
Watching smart pointers
« on: January 05, 2007, 11:54:45 am »
Hello,
How to debug and watch a smart pointer like boost::intrusive_ptr and boost::shared_ptr?
I tried this in gdb_types.script:

....
function Evaluate_SharedPtr(type, ptr, start, count)
{
    local result = _T("output ") + _T("(*") + ptr + _T(".get())");

    return result;
}
....

and work fine, but not if the smart pointer is an object of a class that contain another smart pointer (I see just the memory adress of the second pointer)
Thanks for any help.

Regards


Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Watching smart pointers
« Reply #1 on: January 05, 2007, 12:11:29 pm »
you can add a custom watch

eg.

*(classpointer->memberpointer)

Offline Dahman

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Watching smart pointers
« Reply #2 on: January 05, 2007, 01:39:09 pm »
Tiwag, thank you for the fast replay, I will try it.
Dahman