How to create new mi commands via python / get current interpreter in python

Simon Sobisch simonsobisch@gnu.org
Tue Nov 2 16:40:35 GMT 2021


It is possible to send `interpreter-exec mi "command"` from a python 
extension, but how can we check the _current_ interpreter a python 
create gdb command was executed in?

The reason: depending on the interpreter the return value should be 
different

interpreter-exec console "break"
--> returns user output (which may be parsed)

vs.
interpreter-exec mi "-break-insert"
--> returns interpreter output intended to be parsed


Additional to this question: is there an option to create new MI 
commands from python (instead of "console commands"), or python helper 
functions which provide better ways to return mi-messages than plain 
"print" with self-formatting?

Thanks for any insights,
Simon


More information about the Gdb mailing list