(source_command): Update documentation. Check permissions if
FROM_TTY is -1.
-Index: gdb-7.2.50.20101231/gdb/cli/cli-cmds.c
+Index: gdb-7.4.50.20111218/gdb/cli/cli-cmds.c
===================================================================
---- gdb-7.2.50.20101231.orig/gdb/cli/cli-cmds.c 2010-12-29 03:11:04.000000000 +0100
-+++ gdb-7.2.50.20101231/gdb/cli/cli-cmds.c 2011-01-01 00:53:51.000000000 +0100
-@@ -39,6 +39,7 @@
+--- gdb-7.4.50.20111218.orig/gdb/cli/cli-cmds.c 2011-12-16 22:17:42.000000000 +0100
++++ gdb-7.4.50.20111218/gdb/cli/cli-cmds.c 2011-12-19 00:27:16.572468926 +0100
+@@ -40,6 +40,7 @@
#include "source.h"
#include "disasm.h"
#include "tracepoint.h"
#include "ui-out.h"
-@@ -488,7 +489,7 @@ Script filename extension recognition is
+@@ -485,7 +486,7 @@ show_script_ext_mode (struct ui_file *fi
int
find_and_open_script (const char *script_file, int search_path,
{
char *file;
int fd;
-@@ -514,6 +515,32 @@ find_and_open_script (const char *script
+@@ -511,6 +512,32 @@ find_and_open_script (const char *script
return 0;
}
do_cleanups (old_cleanups);
*streamp = fdopen (fd, FOPEN_RT);
-@@ -573,13 +600,14 @@ source_script_with_search (const char *f
+@@ -572,13 +599,14 @@ source_script_with_search (const char *f
if (file == NULL || *file == 0)
error (_("source command requires file name of file to source."));
+ if (!find_and_open_script (file, search_path, &stream, &full_path,
+ from_tty))
{
- /* The script wasn't found, or was otherwise inaccessible.
+ /* The script wasn't found, or was otherwise inaccessible.
If the source command was invoked interactively, throw an
error. Otherwise (e.g. if it was invoked by a script),
silently ignore the error. */
perror_with_name (file);
else
return;
-Index: gdb-7.2.50.20101231/gdb/testsuite/gdb.base/gdbinit.exp
+Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.base/gdbinit.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.2.50.20101231/gdb/testsuite/gdb.base/gdbinit.exp 2011-01-01 00:53:09.000000000 +0100
++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.base/gdbinit.exp 2011-12-19 00:25:26.079891954 +0100
@@ -0,0 +1,91 @@
+# Copyright 2005
+# Free Software Foundation, Inc.
+}
+
+remote_exec build "rm .gdbinit"
-Index: gdb-7.2.50.20101231/gdb/testsuite/gdb.base/gdbinit.sample
+Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.base/gdbinit.sample
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.2.50.20101231/gdb/testsuite/gdb.base/gdbinit.sample 2011-01-01 00:53:09.000000000 +0100
++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.base/gdbinit.sample 2011-12-19 00:25:26.079891954 +0100
@@ -0,0 +1 @@
+echo "\nin gdbinit"
-Index: gdb-7.2.50.20101231/gdb/main.c
+Index: gdb-7.4.50.20111218/gdb/main.c
===================================================================
---- gdb-7.2.50.20101231.orig/gdb/main.c 2010-12-29 01:58:14.000000000 +0100
-+++ gdb-7.2.50.20101231/gdb/main.c 2011-01-01 00:53:09.000000000 +0100
-@@ -805,7 +805,7 @@ Excess command line arguments ignored. (
+--- gdb-7.4.50.20111218.orig/gdb/main.c 2011-11-05 18:08:30.000000000 +0100
++++ gdb-7.4.50.20111218/gdb/main.c 2011-12-19 00:25:26.080891950 +0100
+@@ -822,7 +822,7 @@ captured_main (void *data)
debugging or what directory you are in. */
if (home_gdbinit && !inhibit_gdbinit)
/* Now perform all the actions indicated by the arguments. */
if (cdarg != NULL)
-@@ -880,7 +880,7 @@ Can't attach to process and specify a co
+@@ -901,7 +901,7 @@ captured_main (void *data)
/* Read the .gdbinit file in the current directory, *if* it isn't
the same as the $HOME/.gdbinit file (it should exist, also). */
if (local_gdbinit && !inhibit_gdbinit)
/* Now that all .gdbinit's have been read and all -d options have been
processed, we can read any scripts mentioned in SYMARG.
-Index: gdb-7.2.50.20101231/gdb/python/py-auto-load.c
+Index: gdb-7.4.50.20111218/gdb/python/py-auto-load.c
===================================================================
---- gdb-7.2.50.20101231.orig/gdb/python/py-auto-load.c 2010-12-15 18:27:59.000000000 +0100
-+++ gdb-7.2.50.20101231/gdb/python/py-auto-load.c 2011-01-01 00:53:09.000000000 +0100
-@@ -224,7 +224,7 @@ source_section_scripts (struct objfile *
+--- gdb-7.4.50.20111218.orig/gdb/python/py-auto-load.c 2011-12-10 23:51:47.000000000 +0100
++++ gdb-7.4.50.20111218/gdb/python/py-auto-load.c 2011-12-19 00:25:26.080891950 +0100
+@@ -284,7 +284,7 @@ source_section_scripts (struct objfile *
}
opened = find_and_open_script (file, 1 /*search_path*/,
- &stream, &full_path);
+ &stream, &full_path, 1 /* from_tty */);
- /* If the file is not found, we still record the file in the hash table,
- we only want to print an error message once.
-Index: gdb-7.2.50.20101231/gdb/cli/cli-cmds.h
+ /* If one script isn't found it's not uncommon for more to not be
+ found either. We don't want to print an error message for each
+Index: gdb-7.4.50.20111218/gdb/cli/cli-cmds.h
===================================================================
---- gdb-7.2.50.20101231.orig/gdb/cli/cli-cmds.h 2010-12-29 03:11:04.000000000 +0100
-+++ gdb-7.2.50.20101231/gdb/cli/cli-cmds.h 2011-01-01 00:53:09.000000000 +0100
-@@ -126,7 +126,8 @@ extern void source_script (char *, int);
+--- gdb-7.4.50.20111218.orig/gdb/cli/cli-cmds.h 2011-11-01 15:51:23.000000000 +0100
++++ gdb-7.4.50.20111218/gdb/cli/cli-cmds.h 2011-12-19 00:25:26.080891950 +0100
+@@ -129,7 +129,8 @@ extern void source_script (char *, int);
/* Exported to objfiles.c. */
extern int find_and_open_script (const char *file, int search_path,