On Mon, 2022-05-09 at 12:23 +0100, Jonathan Wakely wrote: > > But since what you want is something that works in arbitrary Python > > code, not just within GDB, doesn't pybind11 already do everything > > you > > want? > > https://github.com/pybind/pybind11 > > If you don't want to (or can't) use pybind11 to create Python > bindings, and you don't want to use the GDB Python API, then you will > have a ton of work to do. The GDB Python API is what provides all the > tools for traversing C++ class hierarchies, examining template > arguments, casting values to related types etc. I think I've given the wrong impression: I definitely do not want to avoid using the GDB Python API and I have no need for my python code to work outside of GDB. I was playing with this yesterday and came up with the attached creating an "accessors.py" API. It's certainly not fully-fleshed out and is not well-tested; it doesn't try to address any container types. More of a thought experiment. The idea is that someone could import libstdcxx.v6.accessors and write their own code using these Python types. An alternative would of course be to write a bunch of free methods, rather than create classes. I went the other way and started with the xmethod implementation, so mine doesn't do much with tuples. I looked at printers.py a bit, and considered moving the versioned namespace facilities to this new area as well, but didn't go further.