Implement gdb.execute_mi

This adds a new Python function, gdb.execute_mi, that can be used to
invoke an MI command but get the output as a Python object, rather
than a string.  This is done by implementing a new ui_out subclass
that builds a Python object.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=11688
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
This commit is contained in:
Tom Tromey 2023-03-16 10:57:32 -06:00
parent e7a2797eb0
commit c97d123d67
10 changed files with 419 additions and 0 deletions

View file

@ -2484,6 +2484,11 @@ PyMethodDef python_GdbMethods[] =
Evaluate command, a string, as a gdb CLI command. Optionally returns\n\
a Python String containing the output of the command if to_string is\n\
set to True." },
{ "execute_mi", (PyCFunction) gdbpy_execute_mi_command,
METH_VARARGS | METH_KEYWORDS,
"execute_mi (command, arg...) -> dictionary\n\
Evaluate command, a string, as a gdb MI command.\n\
Arguments (also strings) are passed to the command." },
{ "parameter", gdbpy_parameter, METH_VARARGS,
"Return a gdb parameter's value" },