ruediger / Boost-Pretty-Printer

GDB Pretty Printers for Boost
197 stars 61 forks source link

Improve BoostVariant Printer #35

Closed huili80 closed 6 years ago

huili80 commented 6 years ago

Moved BoostVariant to variant.py, which also contains several utility functions:

The changes were made in order to correctly split types in the parameter pack of boost::variant<...>, as well as to correctly look up types that are cv-qualified and/or references/pointers.

A few additional unit tests are added.

mbalabin commented 6 years ago

Hi. Your commit is good (I want to do only a couple minor changes). But I added a few more tests for strip_qualifiers/apply_qualifiers and stumbled upon a little problem in apply_qualifiers: gdb can make either const-qualified type or volatile-qualified type out of a given type, but not a const+volatile qualified. I believe we can just drop support for volatile, because it does not make any sense as a variant parameter (and it is entirely possible that volatile is not important for a debugger). Probably I should ask on the gdb mailing list. Anyway, I will think it over. The current plan is to finish merging this PR on the next weekend.

huili80 commented 6 years ago

Thanks for reviewing the changes. As for const/volatile, if apply_qualifiers is going to be used only by the BoostVariant printer, it might be okay to drop both when reconstructing type, since they don't matter for printing (I made that change in my forked master branch if you'd like to check it out).

mbalabin commented 6 years ago

@huili80 Thank you for contributing!