Mon Apr 13 16:28:07 1998 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>
Mon, 13 Apr 1998 21:54:22 +0000 (21:54 +0000)
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>
Mon, 13 Apr 1998 21:54:22 +0000 (21:54 +0000)
        * utils.c: (warning) added call to warning_hook

        * source.c: (find_source_lines) modified to call warning in case
        of source vs. executable time stamp mismatch. Simplified object
        file check. Initialized mtime to 0.

        * defs.h: added warning_hook prototype

        * top.c: added warning_hook prototype.

        * gdbtk.c: (perror_with_name_wrapper) new function to call
        perror_with_name safely.
        (gdb_loadfile) added source vs. executable time stamp check.
        (gdbtk_warning) new function to pass a warning message to the gui.
        (gdbtk_ignorable_warning) new function to pass a warning
        to the gui. Used only for the src. vs. exec check.
        (gdbtk_init) added warning_hook
        added include <sys/stat.h>

gdb/ChangeLog
gdb/ChangeLog-gdbtk
gdb/gdbtk.c
gdb/top.c

index 19d5b295ae808b02886f16131f2a1384a0585b85..599c5b31b1e6bfbc724772616726dc21e064ae59 100644 (file)
@@ -1,3 +1,15 @@
+Mon Apr 13 16:28:07 1998  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+       * utils.c: (warning) added call to warning_hook
+
+       * source.c: (find_source_lines) modified to call warning in case
+       of source vs. executable time stamp mismatch. Simplified object
+       file check. Initialized mtime to 0.
+
+       * defs.h: added warning_hook prototype
+
+       * top.c: added warning_hook prototype.
+
 Mon Apr 13 09:54:08 1998  Keith Seitz  <keiths@andros.cygnus.com>
 
        * config/sparc/tm-sun4os4.h (IS_STATIC_TRANSFORM_NAME): Add missing
@@ -71,6 +83,7 @@ Wed Apr  8 16:47:33 1998  Jason Molenda  (crash@bugshack.cygnus.com)
        * breakpoint.c (breakpoint_re_set_one): Remove Ulrich Drepper's
        patch of March 23 1998.
 
+>>>>>>> 1.4385
 Sat Apr  4 10:05:00 1998  Dawn Perchik  <dawn@cygnus.com>
 
        * mdebugread.c (parse_partial_symbols): If this is an .mdebug 
index 0257c3a9f2ee7d8270b7777fd986d3d400f959cd..330737c6f2600b3fa4652e96f503230ad63989ee 100644 (file)
@@ -1,3 +1,14 @@
+Mon Apr 13 16:28:07 1998  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+       
+       * gdbtk.c: (perror_with_name_wrapper) new function to call 
+       perror_with_name safely.
+       (gdb_loadfile) added source vs. executable time stamp check.
+       (gdbtk_warning) new function to pass a warning message to the gui.
+       (gdbtk_ignorable_warning) new function to pass a warning
+       to the gui. Used only for the src. vs. exec check.
+       (gdbtk_init) added warning_hook 
+       added include <sys/stat.h>
+
 Mon Apr 13 12:58:26 1998  Keith Seitz  <keiths@onions.cygnus.com>
 
        * gdbtk.c (gdbtk_start_timer): Include on all platforms. Decrease
index 4c58c9b22f8aee042f0fa5dd9e61324c3e83d70a..089a0ca4ad717862912e0e88406125d5d7bc3b6f 100644 (file)
@@ -35,6 +35,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include <winuser.h>
 #endif
 
+#include <sys/stat.h>
+
 #include <tcl.h>
 #include <tk.h>
 #include <itcl.h> 
@@ -95,6 +97,8 @@ static void null_routine PARAMS ((int));
 static void gdbtk_flush PARAMS ((FILE *));
 static void gdbtk_fputs PARAMS ((const char *, FILE *));
 static int gdbtk_query PARAMS ((const char *, va_list));
+static void gdbtk_warning PARAMS ((const char *, va_list));
+static void gdbtk_ignorable_warning PARAMS ((const char *, va_list));
 static char *gdbtk_readline PARAMS ((char *));
 static void gdbtk_init PARAMS ((char *));
 static void tk_command_loop PARAMS ((void));
@@ -303,6 +307,38 @@ gdbtk_fputs (ptr, stream)
   in_fputs = 0;
 }
 
+static void
+gdbtk_warning (warning, args)
+     const char *warning;
+     va_list args;
+{
+  char buf[200], *merge[2];
+  char *command;
+
+  vsprintf (buf, warning, args);
+  merge[0] = "gdbtk_tcl_warning";
+  merge[1] = buf;
+  command = Tcl_Merge (2, merge);
+  Tcl_Eval (interp, command);
+  Tcl_Free (command);
+}
+
+static void
+gdbtk_ignorable_warning (warning, args)
+     const char *warning;
+     va_list args;
+{
+  char buf[200], *merge[2];
+  char *command;
+
+  vsprintf (buf, warning, args);
+  merge[0] = "gdbtk_tcl_ignorable_warning";
+  merge[1] = buf;
+  command = Tcl_Merge (2, merge);
+  Tcl_Eval (interp, command);
+  Tcl_Free (command);
+}
+
 static int
 gdbtk_query (query, args)
      const char *query;
@@ -318,7 +354,7 @@ gdbtk_query (query, args)
   command = Tcl_Merge (2, merge);
   Tcl_Eval (interp, command);
   Tcl_Free (command);
-
   val = atol (interp->result);
   return val;
 }
@@ -2135,6 +2171,7 @@ gdbtk_init ( argv0 )
   command_loop_hook = tk_command_loop;
   print_frame_info_listing_hook = gdbtk_print_frame_info;
   query_hook = gdbtk_query;
+  warning_hook = gdbtk_warning;
   flush_hook = gdbtk_flush;
   create_breakpoint_hook = gdbtk_create_breakpoint;
   delete_breakpoint_hook = gdbtk_delete_breakpoint;
@@ -3000,6 +3037,13 @@ full_lookup_symtab(file)
   return NULL;
 }
 
+static int
+perror_with_name_wrapper (args)
+  char * args;
+{
+  perror_with_name (args);
+  return 1;
+}
 
 /* gdb_loadfile loads a c source file into a text widget. */
 
@@ -3024,6 +3068,9 @@ gdb_loadfile (clientData, interp, objc, objv)
   char *ltable;
   struct symtab *symtab;
   struct linetable_entry *le;
+  long mtime = 0;
+  struct stat st;
+
  
   if (objc != 4)
     {
@@ -3047,6 +3094,22 @@ gdb_loadfile (clientData, interp, objc, objv)
       return TCL_ERROR;
     }
 
+  if (fstat (fp->_file, &st) < 0)
+    {
+      catch_errors (perror_with_name_wrapper, "gdbtk: get time stamp", "",
+                    RETURN_MASK_ALL);
+      return TCL_ERROR;
+    }
+
+  if (symtab && symtab->objfile && symtab->objfile->obfd)
+      mtime = bfd_get_mtime(symtab->objfile->obfd);
+  else if (exec_bfd)
+      mtime = bfd_get_mtime(exec_bfd);
+  if (mtime && mtime < st.st_mtime)
+     gdbtk_ignorable_warning("Source file is more recent than executable.\n", (va_list)0);
+
+
   /* Source linenumbers don't appear to be in order, and a sort is */
   /* too slow so the fastest solution is just to allocate a huge */
   /* array and set the array entry for each linenumber */
index 100b8fc0dadc04f08be87ca92b329e3304f2be96..248a44df63500b5b2c1a3f332b5eb8e812ee302f 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -403,6 +403,10 @@ void (*print_frame_info_listing_hook) PARAMS ((struct symtab *s, int line,
 
 int (*query_hook) PARAMS ((const char *, va_list));
 
+/* Replaces most of warning.  */
+
+void (*warning_hook) PARAMS ((const char *, va_list));
+
 /* Called from gdb_flush to flush output.  */
 
 void (*flush_hook) PARAMS ((FILE *stream));