koutheir / libcxx-pretty-printers

Moved: https://codeberg.org/koutheir/libcxx-pretty-printers
https://codeberg.org/koutheir/libcxx-pretty-printers
GNU General Public License v3.0
148 stars 51 forks source link

Fix MapPrinter and its iterator by adding '__cc' #1

Closed yatharth closed 9 years ago

yatharth commented 9 years ago

With types like map<int, int> and vector<map<int, int>>, printing in gdb on OS X 10.4 gave me errors like these (oddly, pair<int, int> worked just fine):

Python Exception <class 'gdb.error'> There is no member or method named first.: 
$1 = std::__1::map (count=2)

$2 = std::__1::vector (length=2, capacity=2) = {
Python Exception <class 'gdb.error'> There is no member or method named first.: 
  [0] = std::__1::map (count=2),
Python Exception <class 'gdb.error'> There is no member or method named first.: 
  [1] = std::__1::map (count=2)
}

Disabling reading .gdbinit and inspecting an iterator of the map gave me

$3 = {__cc = {first = 0, second = 1}, __nc = {first = 0, second = 1}}

and adding ['__cc'] to the related classes fixed the problem. Making such modifications in other classes would be a good idea, but I didn't look into where all this should be done.

koutheir commented 9 years ago

Thank you for your inspection. I will have to propagate the change to all occurrences where required. Though that might take me some time to perform.