diff options
author | Doug Evans <dje@google.com> | 2011-10-27 15:46:11 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2011-10-27 15:46:11 +0000 |
commit | d234ef5c0cca9ae4737cfcd833555db14dc0ead0 (patch) | |
tree | bf0ed9a7ba656b0baae5d48d400f04007b890da3 /gdb/python | |
parent | a08fc94222d1b5be7ecbf52d4d41fa6da1d71f18 (diff) | |
download | gdb-d234ef5c0cca9ae4737cfcd833555db14dc0ead0.zip gdb-d234ef5c0cca9ae4737cfcd833555db14dc0ead0.tar.gz gdb-d234ef5c0cca9ae4737cfcd833555db14dc0ead0.tar.bz2 |
* cli/cli-cmds.c (source_script_with_search): Pass full path to
source_script_from_stream if it may have been found on the search path.
* python/py-auto-load.c (source_section_scripts): Pass full path to
source_python_script_for_objfile.
* python/python.c (source_python_script): Delete stream parameter.
All callers updated.
(source_python_script_for_objfile): Ditto.
* python/python-internal.h (source_python_script_for_objfile): Update.
* python/python.h (source_python_script): Update.
testsuite/
* gdb.python/python.exp: Test source -s.
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/py-auto-load.c | 4 | ||||
-rw-r--r-- | gdb/python/python-internal.h | 2 | ||||
-rw-r--r-- | gdb/python/python.c | 26 | ||||
-rw-r--r-- | gdb/python/python.h | 2 |
4 files changed, 14 insertions, 20 deletions
diff --git a/gdb/python/py-auto-load.c b/gdb/python/py-auto-load.c index 75fa041..2a17ed0 100644 --- a/gdb/python/py-auto-load.c +++ b/gdb/python/py-auto-load.c @@ -312,7 +312,7 @@ Use `info auto-load-scripts [REGEXP]' to list them."), { /* If this file is not currently loaded, load it. */ if (! in_hash_table) - source_python_script_for_objfile (objfile, stream, file); + source_python_script_for_objfile (objfile, full_path); fclose (stream); free (full_path); } @@ -431,7 +431,7 @@ auto_load_objfile_script (struct objfile *objfile, const char *suffix) It's highly unlikely that we'd ever load it twice, and these scripts are required to be idempotent under multiple loads anyway. */ - source_python_script_for_objfile (objfile, input, debugfile); + source_python_script_for_objfile (objfile, debugfile); fclose (input); } diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index e593612..ef39d5d 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -247,7 +247,7 @@ extern const struct language_defn *python_language; void gdbpy_print_stack (void); void source_python_script_for_objfile (struct objfile *objfile, - FILE *stream, const char *file); + const char *file); PyObject *python_string_to_unicode (PyObject *obj); char *unicode_to_target_string (PyObject *unicode_str); diff --git a/gdb/python/python.c b/gdb/python/python.c index df8e3d5..3a5a6b5 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -599,21 +599,18 @@ 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. - STREAM is not closed, that is the caller's responsibility. */ +/* Read a file as Python code. + FILE is the name of the file. + This does not throw any errors. If an exception occurs python will print + the traceback and clear the error indicator. */ void -source_python_script (FILE *stream, const char *file) +source_python_script (const char *file) { struct cleanup *cleanup; cleanup = ensure_python_env (get_current_arch (), current_language); - - /* Note: If an exception occurs python will print the traceback and - clear the error indicator. */ python_run_simple_file (file); - do_cleanups (cleanup); } @@ -941,15 +938,12 @@ gdbpy_progspaces (PyObject *unused1, PyObject *unused2) source_python_script_for_objfile; it is NULL at other times. */ static struct objfile *gdbpy_current_objfile; -/* Set the current objfile to OBJFILE and then read STREAM,FILE as - Python code. - STREAM is left open, it is up to the caller to close it. - If an exception occurs python will print the traceback and - clear the error indicator. */ +/* Set the current objfile to OBJFILE and then read FILE as Python code. + This does not throw any errors. If an exception occurs python will print + the traceback and clear the error indicator. */ void -source_python_script_for_objfile (struct objfile *objfile, - FILE *stream, const char *file) +source_python_script_for_objfile (struct objfile *objfile, const char *file) { struct cleanup *cleanups; @@ -1032,7 +1026,7 @@ eval_python_from_control_command (struct command_line *cmd) } void -source_python_script (FILE *stream, const char *file) +source_python_script (const char *file) { throw_error (UNSUPPORTED_ERROR, _("Python scripting is not supported in this copy of GDB.")); diff --git a/gdb/python/python.h b/gdb/python/python.h index ce0eb35..ae55cc2 100644 --- a/gdb/python/python.h +++ b/gdb/python/python.h @@ -30,7 +30,7 @@ extern void finish_python_initialization (void); void eval_python_from_control_command (struct command_line *); -void source_python_script (FILE *stream, const char *file); +void source_python_script (const char *file); int apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr, int embedded_offset, CORE_ADDR address, |