mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-05-24 02:37:23 +08:00
Add -s option to source command.
* NEWS: Document new option. * cli/cli-cmds.c (find_and_open_script): Add function comment. Delete from_tty and cleanupp args. Split filep arg into file and full_pathp. New arg search_path. (source_script_from_stream): New function. (source_script_with_search): New function. (source_script): Rewrite. (source_command): Parse "-s" option. (init_cli_cmds): Add "-s" docs to source command help, and reformat. * python/python.c (source_python_script): Make file arg a const char *. Don't call fclose, leave for caller. * python/python.h (source_python_script): Update. testsuite/ * gdb.base/source-test.gdb: New file. * gdb.base/source.exp: Add tests for "source -s". doc/ * gdb.texinfo (Command Files): Add docs for new "source -s" option.
This commit is contained in:
@ -364,10 +364,11 @@ gdbpy_parse_and_eval (PyObject *self, PyObject *args)
|
||||
}
|
||||
|
||||
/* Read a file as Python code. STREAM is the input file; FILE is the
|
||||
name of the file. */
|
||||
name of the file.
|
||||
STREAM is not closed, that is the caller's responsibility. */
|
||||
|
||||
void
|
||||
source_python_script (FILE *stream, char *file)
|
||||
source_python_script (FILE *stream, const char *file)
|
||||
{
|
||||
struct cleanup *cleanup;
|
||||
|
||||
@ -375,7 +376,6 @@ source_python_script (FILE *stream, char *file)
|
||||
|
||||
PyRun_SimpleFile (stream, file);
|
||||
|
||||
fclose (stream);
|
||||
do_cleanups (cleanup);
|
||||
}
|
||||
|
||||
@ -562,9 +562,8 @@ eval_python_from_control_command (struct command_line *cmd)
|
||||
}
|
||||
|
||||
void
|
||||
source_python_script (FILE *stream, char *file)
|
||||
source_python_script (FILE *stream, const char *file)
|
||||
{
|
||||
fclose (stream);
|
||||
throw_error (UNSUPPORTED_ERROR,
|
||||
_("Python scripting is not supported in this copy of GDB."));
|
||||
}
|
||||
|
Reference in New Issue
Block a user