* 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.
This commit is contained in:
Doug Evans
2011-10-27 15:46:11 +00:00
parent a08fc94222
commit d234ef5c0c
8 changed files with 44 additions and 25 deletions

View File

@ -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."));