0

How I can print value of share pointer stored in set. Print gdb share_ptr from C++ set.

    p field_set
$30 = std::set with 5 elements = {
  [0] = std::shared_ptr (count 2, weak 0) 0x862030,
  [1] = std::shared_ptr (count 2, weak 0) 0x863630,
  [2] = std::shared_ptr (count 2, weak 0) 0x863710,
  [3] = std::shared_ptr (count 2, weak 0) 0x8637f0,
  [4] = std::shared_ptr (count 2, weak 0) 0x8638d0

As you can see share_ptr are stored in C++ set value. How I can print value ?

I have already tried below input, its not working :

1.  p *(field_set)._M_ptr 
  //No symbol "driverl" in current context.
2.  p *(field_set[0])._M_ptr
   //No symbol "operator[]" in current context.
cpplearner
  • 13,776
  • 2
  • 47
  • 72
Sandip
  • 51
  • 11
  • Possible duplicate of [How to view the internal data of a smart pointer inside gdb?](https://stackoverflow.com/questions/41420814/how-to-view-the-internal-data-of-a-smart-pointer-inside-gdb) – ks1322 Dec 06 '17 at 15:03
  • @ ks1322: I am looking for printing value of share pointer stored inside C++ set. – Sandip Dec 07 '17 at 06:50

0 Answers0