mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-12-17 07:40:07 +08:00
gdb/python: generalize serialize_mi_result()
This commit generalizes serialize_mi_result() to make usable in different contexts than printing result of custom MI command. To do so, the check whether passed Python object is a dictionary has been moved to the caller - at the very least, different uses require different error messages. Also it has been renamed to serialize_mi_results() to better match GDB/MI output syntax (see corresponding section in documentation, in particular rules 'result-record' and 'async-output'. Since it is now more generic function, it has been moved to py-mi.c. This is a preparation for implementing Python support for sending custom MI async events. Approved-By: Andrew Burgess <aburgess@redhat.com>
This commit is contained in:
@@ -486,6 +486,19 @@ struct gdbarch *arch_object_to_gdbarch (PyObject *obj);
|
||||
extern PyObject *gdbpy_execute_mi_command (PyObject *self, PyObject *args,
|
||||
PyObject *kw);
|
||||
|
||||
/* Serialize RESULTS and print it in MI format to the current_uiout.
|
||||
|
||||
This function handles the top-level results passed as a dictionary.
|
||||
The caller is responsible for ensuring that. The values within this
|
||||
dictionary can be a wider range of types. Handling the values of the top-level
|
||||
dictionary is done by serialize_mi_result_1, see that function for more
|
||||
details.
|
||||
|
||||
If anything goes wrong while parsing and printing the MI output then an
|
||||
error is thrown. */
|
||||
|
||||
extern void serialize_mi_results (PyObject *results);
|
||||
|
||||
/* Convert Python object OBJ to a program_space pointer. OBJ must be a
|
||||
gdb.Progspace reference. Return nullptr if the gdb.Progspace is not
|
||||
valid (see gdb.Progspace.is_valid), otherwise return the program_space
|
||||
|
||||
Reference in New Issue
Block a user