public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-jankratochvil-autoload: Merge branch 'gdbinitb-move2-misc-pfx-warn-safepath' into gdbinitb-move2-misc-pfx-warn-safepath-debug
@ 2012-01-29 22:13 jkratoch
  0 siblings, 0 replies; only message in thread
From: jkratoch @ 2012-01-29 22:13 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-autoload has been updated
       via  d2cd20665287cb43b81203d2b44fd5d8e5c24792 (commit)
       via  466ab870d5ca459427908345ad3c2e852b3ed78e (commit)
       via  ec2fe6d00064307673389f3a68317b11bd1791f2 (commit)
       via  054a5784dd62e29376ed0cb970714a78b1c358dc (commit)
       via  15f1e3d72eb53a5a2d874264af97e7c0dfcba267 (commit)
      from  cf5f4fa111700c5804d8e878ce3910260c6781d8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit d2cd20665287cb43b81203d2b44fd5d8e5c24792
Merge: ec2fe6d 466ab87
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun Jan 29 23:09:44 2012 +0100

    Merge branch 'gdbinitb-move2-misc-pfx-warn-safepath' into gdbinitb-move2-misc-pfx-warn-safepath-debug
    
    Conflicts:
    	gdb/auto-load.c

commit 466ab870d5ca459427908345ad3c2e852b3ed78e
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun Jan 29 23:09:18 2012 +0100

    .

commit ec2fe6d00064307673389f3a68317b11bd1791f2
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun Jan 29 23:08:42 2012 +0100

    .

commit 054a5784dd62e29376ed0cb970714a78b1c358dc
Merge: cf5f4fa 15f1e3d
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun Jan 29 22:19:06 2012 +0100

    Merge branch 'gdbinitb-move2-misc-pfx-warn-safepath' into gdbinitb-move2-misc-pfx-warn-safepath-debug
    
    Conflicts:
    	gdb/auto-load.c

commit 15f1e3d72eb53a5a2d874264af97e7c0dfcba267
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun Jan 29 22:18:35 2012 +0100

    .

-----------------------------------------------------------------------

Summary of changes:
 gdb/auto-load.c           |   38 +++++++++++++++++++++++---------------
 gdb/auto-load.h           |    4 ++--
 gdb/linux-thread-db.c     |    4 +++-
 gdb/main.c                |    5 ++++-
 gdb/python/py-auto-load.c |   32 ++++++++++++--------------------
 5 files changed, 44 insertions(+), 39 deletions(-)

First 500 lines of diff:
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index d8135d3..d617a09 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -37,7 +37,7 @@
 #define GDB_AUTO_FILE_NAME "-gdb.rc"
 
 /* Value of the 'set debug auto-load' configuration variable.  */
-int debug_auto_load = 0;
+static int debug_auto_load = 0;
 
 /* "show" command for the debug_auto_load configuration variable.  */
 
@@ -195,11 +195,11 @@ filename_is_in_dir (const char *filename, const char *dir)
 {
   size_t dir_len = strlen (dir);
 
-  while (dir_len && dir[dir_len - 1] == DIRNAME_SEPARATOR)
+  while (dir_len && IS_DIR_SEPARATOR (dir[dir_len - 1]))
     dir_len--;
 
   return (filename_ncmp (dir, filename, dir_len) == 0
-	  && (filename[dir_len] == DIRNAME_SEPARATOR
+	  && (IS_DIR_SEPARATOR (filename[dir_len])
 	      || filename[dir_len] == '\0'));
 }
 
@@ -250,19 +250,28 @@ filename_is_in_auto_load_safe_path_vec (const char *filename,
 /* Return 1 if FILENAME is located in one of the directories of
    AUTO_LOAD_SAFE_PATH.  Otherwise call warning and return 0.  FILENAME does
    not have to be an absolute path.
-   
+
    Existence of FILENAME is not checked.  Function will still give a warning
    even if the caller would quietly skip non-existing file in unsafe
    directory.  */
 
 int
-file_is_auto_load_safe (const char *filename)
+file_is_auto_load_safe (const char *filename, const char *debug_fmt, ...)
 {
   char *filename_real = NULL;
   struct cleanup *back_to;
-  
+
+  if (debug_auto_load)
+    {
+      va_list debug_args;
+
+      va_start (debug_args, debug_fmt);
+      vfprintf_unfiltered (gdb_stdlog, debug_fmt, debug_args);
+      va_end (debug_args);
+    }
+
   back_to = make_cleanup (free_current_contents, &filename_real);
-  
+
   if (filename_is_in_auto_load_safe_path_vec (filename, &filename_real))
     {
       do_cleanups (back_to);
@@ -290,11 +299,11 @@ source_gdb_script_for_objfile (struct objfile *objfile, FILE *file,
 {
   volatile struct gdb_exception e;
 
-  if (debug_auto_load)
-    fprintf_unfiltered (gdb_stdlog,
-			_("auto-load: Loading canned sequences of commands "
-			  "script \"%s\" for objfile \"%s\".\n"),
-			filename, objfile->name);
+  if (!file_is_auto_load_safe (filename, _("auto-load: Loading canned "
+					   "sequences of commands script "
+					   "\"%s\" for objfile \"%s\".\n"),
+			       filename, objfile->name))
+    return;
 
   TRY_CATCH (e, RETURN_MASK_ALL)
     {
@@ -537,12 +546,11 @@ auto_load_objfile_script (struct objfile *objfile,
     }
 
   if (input)
-    make_cleanup_fclose (input);
-
-  if (input && file_is_auto_load_safe (debugfile))
     {
       struct auto_load_pspace_info *pspace_info;
 
+      make_cleanup_fclose (input);
+
       /* Add this script to the hash table too so "info auto-load-scripts"
 	 can print it.  */
       pspace_info =
diff --git a/gdb/auto-load.h b/gdb/auto-load.h
index f642f4b..e8106df 100644
--- a/gdb/auto-load.h
+++ b/gdb/auto-load.h
@@ -30,7 +30,6 @@ struct script_language
 				     const char *filename);
 };
 
-extern int debug_auto_load;
 extern int global_auto_load;
 
 extern const char auto_load_local_gdbinit_on[];
@@ -52,6 +51,7 @@ extern int
 extern struct cmd_list_element **auto_load_set_cmdlist_get (void);
 extern struct cmd_list_element **auto_load_show_cmdlist_get (void);
 
-extern int file_is_auto_load_safe (const char *filename);
+extern int file_is_auto_load_safe (const char *filename,
+				   const char *debug_fmt, ...);
 
 #endif /* AUTO_LOAD_H */
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 3c5b6dd..8942a89 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -799,7 +799,9 @@ try_thread_db_load (const char *library)
     printf_unfiltered (_("Trying host libthread_db library: %s.\n"),
                        library);
 
-  if (!file_is_auto_load_safe (library))
+  if (!file_is_auto_load_safe (library, _("auto-load: Loading libthread-db "
+					  "library \"%s\".\n"),
+			       library))
     return 0;
 
   handle = dlopen (library, RTLD_NOW);
diff --git a/gdb/main.c b/gdb/main.c
index c53febf..456eab4 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -953,7 +953,10 @@ captured_main (void *data)
 	    warning (_("Ignoring file .gdbinit in current directory as it has "
 		       "been deprecated.  %s"),
 		     _(adv));
-	  else if (file_is_auto_load_safe (local_gdbinit))
+	  else if (file_is_auto_load_safe (local_gdbinit,
+	                                   _("auto-load: Loading .gdbinit "
+					     "file \"%s\".\n"),
+					   local_gdbinit))
 	    catch_command_errors (source_script, local_gdbinit, 0,
 				  RETURN_MASK_ALL);
 	}
diff --git a/gdb/python/py-auto-load.c b/gdb/python/py-auto-load.c
index 5f7c0b9..68ae6b1 100644
--- a/gdb/python/py-auto-load.c
+++ b/gdb/python/py-auto-load.c
@@ -146,18 +146,14 @@ Use `info auto-load-scripts [REGEXP]' to list them."),
       else
 	{
 	  /* If this file is not currently loaded, load it.  */
-	  if (! in_hash_table && file_is_auto_load_safe (full_path))
-	    {
-	      if (debug_auto_load)
-		fprintf_unfiltered (gdb_stdlog,
-				    _("auto-load: Loading Python "
-				      "script \"%s\" from section \"%s\" of "
-				      "objfile \"%s\".\n"),
-				    full_path, GDBPY_AUTO_SECTION_NAME,
-				    objfile->name);
-
-	      source_python_script_for_objfile (objfile, stream, full_path);
-	    }
+	  if (!in_hash_table
+	      && file_is_auto_load_safe (full_path,
+					 _("auto-load: Loading Python script "
+					   "\"%s\" from section \"%s\" of "
+					   "objfile \"%s\".\n"),
+					 full_path, GDBPY_AUTO_SECTION_NAME,
+					 objfile->name))
+	    source_python_script_for_objfile (objfile, stream, full_path);
 	}
 
       do_cleanups (back_to);
@@ -199,16 +195,12 @@ static void
 gdbpy_load_auto_script_for_objfile (struct objfile *objfile, FILE *file,
 				    const char *filename)
 {
-  if (!file_is_auto_load_safe (filename))
+  if (!file_is_auto_load_safe (filename,
+			       _("auto-load: Loading Python script \"%s\" by "
+			         "extension for objfile \"%s\".\n"),
+			       filename, objfile->name))
     return;
 
-  if (debug_auto_load)
-    fprintf_unfiltered (gdb_stdlog,
-			_("auto-load: Loading Python "
-			  "script \"%s\" by extension for "
-			  "objfile \"%s\".\n"),
-			filename, objfile->name);
-
   source_python_script_for_objfile (objfile, file, filename);
 }
 


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-01-29 22:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-29 22:13 [SCM] archer-jankratochvil-autoload: Merge branch 'gdbinitb-move2-misc-pfx-warn-safepath' into gdbinitb-move2-misc-pfx-warn-safepath-debug jkratoch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).