felixguendling / cista

Cista is a simple, high-performance, zero-copy C++ serialization & reflection library.
https://cista.rocks
MIT License
1.82k stars 118 forks source link

Pretty Printers for Cista #107

Closed julianharbarth closed 2 years ago

julianharbarth commented 3 years ago

This pull request contains pretty printers for some of the cista containers. These are implented using the Python API from GDB. These help when debugging programs that use cista containers by making them easier to inspect directly with GDB or in an IDE like CLion.

With the exception of hash_storage (for the map and the set) the rest should be also be straightforward to implement. I haven't had a closer look at hash_storage yet.

In general these are build to be used with CLion (or any other IDE that uses the same protocols). The straight text output is very basic / unchanged, since CLion does not seem to care about it.

The current implementation might can be improved by removing levels indirections to make the pretty output even prettier and porting / reimplementing these for LLDB.

felixguendling commented 3 years ago

For cista::hash_storage I would propose to iterate the ctrl_ and entries_ array in parallel and print the T in entries_[i] if the eighth bit of ctrl_[i] is not set (ctrl_[i] & ctrl_t::EMPTY) == 0. If the last bit is set, this means that the entry either EMPTY, DELETED, or END (last control byte).

julianharbarth commented 3 years ago

Alright, thanks for the pointers. I'm gonna check it out real soon.