diff options
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/python.c | 24 | ||||
-rw-r--r-- | gdb/python/python.h | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/gdb/python/python.c b/gdb/python/python.c index 827372c..1f1ae72 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -343,6 +343,22 @@ gdbpy_parse_and_eval (PyObject *self, PyObject *args) return value_to_value_object (result); } +/* Read a file as Python code. STREAM is the input file; FILE is the + name of the file. */ + +void +source_python_script (FILE *stream, char *file) +{ + PyGILState_STATE state; + + state = PyGILState_Ensure (); + + PyRun_SimpleFile (stream, file); + + fclose (stream); + PyGILState_Release (state); +} + /* Printing. */ @@ -525,6 +541,14 @@ eval_python_from_control_command (struct command_line *cmd) error (_("Python scripting is not supported in this copy of GDB.")); } +void +source_python_script (FILE *stream, char *file) +{ + fclose (stream); + throw_error (UNSUPPORTED_ERROR, + _("Python scripting is not supported in this copy of GDB.")); +} + #endif /* HAVE_PYTHON */ diff --git a/gdb/python/python.h b/gdb/python/python.h index f35827b..5d93f67 100644 --- a/gdb/python/python.h +++ b/gdb/python/python.h @@ -24,6 +24,8 @@ void eval_python_from_control_command (struct command_line *); +void source_python_script (FILE *stream, char *file); + int apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr, int embedded_offset, CORE_ADDR address, struct ui_file *stream, int recurse, |