* utils.c, defs.h (warning_begin): Renamed from warning_setup, for
authorJim Kingdon <jkingdon@engr.sgi.com>
Tue, 11 Apr 1995 22:26:14 +0000 (22:26 +0000)
committerJim Kingdon <jkingdon@engr.sgi.com>
Tue, 11 Apr 1995 22:26:14 +0000 (22:26 +0000)
consistency with error_begin.  Also print warning_pre_print.
Document it better.
* utils.c (warning): Use it.
* utils.c (error_begin): Doc fix.
* rs6000-nat.c (vmap_ldinfo): If symfile_objfile is not part of
any vmap, nuke it.

gdb/ChangeLog
gdb/defs.h
gdb/rs6000-nat.c
gdb/utils.c

index 869f98df38c137df9ec6ad2331cd8eb2a140d3a2..ca287c46cb3eef5ea94c9edcd3ccc52dce699d0d 100644 (file)
@@ -1,3 +1,13 @@
+Tue Apr 11 13:46:25 1995  Jim Kingdon  <kingdon@deneb.cygnus.com>
+
+       * utils.c, defs.h (warning_begin): Renamed from warning_setup, for
+       consistency with error_begin.  Also print warning_pre_print.
+       Document it better.
+       * utils.c (warning): Use it.
+       * utils.c (error_begin): Doc fix.
+       * rs6000-nat.c (vmap_ldinfo): If symfile_objfile is not part of
+       any vmap, nuke it.
+
 Tue Apr 11 09:35:20 1995  Jim Kingdon  (kingdon@lioth.cygnus.com)
 
        * printcmd.c (print_address_numeric): Pass use_local to
index 884d5ad248fc46037f878ac3cad003f006df8f1a..9bce3c48e94dcdcf0d939ef385fe26811f191a00 100644 (file)
@@ -211,11 +211,9 @@ extern void fputs_filtered PARAMS ((const char *, GDB_FILE *));
 
 extern void fputs_unfiltered PARAMS ((const char *, GDB_FILE *));
 
-extern void fputc_unfiltered PARAMS ((int, GDB_FILE *));
+extern int fputc_unfiltered PARAMS ((int c, GDB_FILE *));
 
-extern void putc_unfiltered PARAMS ((int));
-
-#define putchar_unfiltered(C)  putc_unfiltered(C)
+extern int putchar_unfiltered PARAMS ((int c));
 
 extern void puts_filtered PARAMS ((char *));
 
@@ -541,6 +539,10 @@ extern char *reg_names[];
 
 extern char *error_pre_print;
 
+/* Message to be printed before the error message, when an error occurs.  */
+
+extern char *quit_pre_print;
+
 /* Message to be printed before the warning message, when a warning occurs.  */
 
 extern char *warning_pre_print;
@@ -573,7 +575,7 @@ return_to_top_level PARAMS ((enum return_reason)) ATTR_NORETURN;
 extern int
 catch_errors PARAMS ((int (*) (char *), void *, char *, return_mask));
 
-extern void warning_setup PARAMS ((void));
+extern void warning_begin PARAMS ((void));
 
 extern void warning ();
 
@@ -596,7 +598,9 @@ extern void psignal PARAMS ((unsigned, const char *));
 
 extern int fclose ();
 
+#ifndef atof
 extern double atof ();
+#endif
 
 #ifndef MALLOC_INCOMPATIBLE
 
@@ -740,25 +744,6 @@ extern void set_endian_from_file PARAMS ((bfd *));
 #endif /* defined (TARGET_BYTE_ORDER_SELECTABLE) */
 #endif /* BITS_BIG_ENDIAN not defined.  */
 
-/* Swap LEN bytes at BUFFER between target and host byte-order.  */
-#define SWAP_TARGET_AND_HOST(buffer,len) \
-  do                                                                    \
-    {                                                                   \
-      if (TARGET_BYTE_ORDER != HOST_BYTE_ORDER)                         \
-        {                                                               \
-          char tmp;                                                     \
-          char *p = (char *)(buffer);                                   \
-          char *q = ((char *)(buffer)) + len - 1;                       \
-          for (; p < q; p++, q--)                                       \
-            {                                                           \
-              tmp = *q;                                                 \
-              *q = *p;                                                  \
-              *p = tmp;                                                 \
-            }                                                           \
-        }                                                               \
-    }                                                                   \
-  while (0)
-
 /* In findvar.c.  */
 
 extern LONGEST extract_signed_integer PARAMS ((void *, int));
index 8b92b6f37915e8b887f307cc3c6469ab83248cef..5a4274d054b43ab5f3fcd352f36497174e867f1d 100644 (file)
@@ -546,6 +546,31 @@ vmap_ldinfo (ldi)
   } while (ldi->ldinfo_next
           && (ldi = (void *) (ldi->ldinfo_next + (char *) ldi)));
 
+  /* If we don't find the symfile_objfile anywhere in the ldinfo, it
+     is unlikely that the symbol file is relocated to the proper
+     address.  And we might have attached to a process which is
+     running a different copy of the same executable.  */
+  for (got_one = 0, vp = vmap; vp != NULL; vp = vp->nxt)
+    {
+      if (symfile_objfile == vp->objfile)
+       {
+         got_one = 1;
+         break;
+       }
+    }
+  if (symfile_objfile != NULL && !got_one)
+    {
+      warning_begin ();
+      fputs_unfiltered ("Symbol file ", gdb_stderr);
+      fputs_unfiltered (symfile_objfile->name, gdb_stderr);
+      fputs_unfiltered ("\nis not mapped; discarding it.\n\
+If in fact that file has symbols which the mapped files listed by\n\
+\"info files\" lack, you can load symbols with the \"symbol-file\" or\n\
+\"add-symbol-file\" commands (note that you must take care of relocating\n\
+symbols to the proper address).\n", gdb_stderr);
+      free_objfile (symfile_objfile);
+      symfile_objfile = NULL;
+    }
 }
 \f
 /* As well as symbol tables, exec_sections need relocation. After
index 8277a97f715dd18e0f6edb48c28145488883f1f4..dd3c746d77e234d7849419d6f61f1e19e3b43339 100644 (file)
@@ -223,23 +223,30 @@ null_cleanup (arg)
 }
 
 \f
-/* Provide a hook for modules wishing to print their own warning messages
-   to set up the terminal state in a compatible way, without them having
-   to import all the target_<...> macros. */
+/* Print a warning message.  Way to use this is to call warning_begin,
+   output the warning message (use unfiltered output to gdb_stderr),
+   ending in a newline.  There is not currently a warning_end that you
+   call afterwards, but such a thing might be added if it is useful
+   for a GUI to separate warning messages from other output.
+
+   FIXME: Why do warnings use unfiltered output and errors filtered?
+   Is this anything other than a historical accident?  */
 
 void
-warning_setup ()
+warning_begin ()
 {
   target_terminal_ours ();
   wrap_here("");                       /* Force out any buffered output */
   gdb_flush (gdb_stdout);
+  if (warning_pre_print)
+    fprintf_unfiltered (gdb_stderr, warning_pre_print);
 }
 
 /* Print a warning message.
    The first argument STRING is the warning message, used as a fprintf string,
    and the remaining args are passed as arguments to it.
    The primary difference between warnings and errors is that a warning
-   does not force the return to command level. */
+   does not force the return to command level.  */
 
 /* VARARGS */
 void
@@ -250,11 +257,7 @@ warning (va_alist)
   char *string;
 
   va_start (args);
-  target_terminal_ours ();
-  wrap_here("");                       /* Force out any buffered output */
-  gdb_flush (gdb_stdout);
-  if (warning_pre_print)
-    fprintf_unfiltered (gdb_stderr, warning_pre_print);
+  warning_begin ();
   string = va_arg (args, char *);
   vfprintf_unfiltered (gdb_stderr, string, args);
   fprintf_unfiltered (gdb_stderr, "\n");
@@ -262,10 +265,12 @@ warning (va_alist)
 }
 
 /* Start the printing of an error message.  Way to use this is to call
-   this, output the error message (use filtered output), and then call
-   return_to_top_level (RETURN_ERROR).  error() provides a convenient way to
-   do this for the special case that the error message can be formatted with
-   a single printf call, but this is more general.  */
+   this, output the error message (use filtered output to gdb_stderr
+   (FIXME: Some callers, like memory_error, use gdb_stdout)), ending
+   in a newline, and then call return_to_top_level (RETURN_ERROR).
+   error() provides a convenient way to do this for the special case
+   that the error message can be formatted with a single printf call,
+   but this is more general.  */
 void
 error_begin ()
 {
This page took 0.030102 seconds and 4 git commands to generate.