I would like to access preprocessor macro definitions using GDB's embedded Python interpreter. Is there a Python macro API for GDB?
in GDB you can do:
gdb> info macro MACRO
But there is no mention of a Python API for macro's in the documentation.
https://sourceware.org/gdb/onlinedocs/gdb/Python-API.html
Also I came across a few messages about development of a Python macro API.
https://sourceware.org/ml/gdb-patches/2011-08/msg00441.html
It mentions a py-macro.c file. But it is nowhere to be found in the current gdb source code.
It doesn't appear that the patches have ever been approved or committed, so you are out of luck.
You can of course try to apply the patches to current GDB, or even GDB current as of the time patches were sent.