20000-05-18 H.J. Lu (hjl@gnu.org)
[binutils-gdb.git] / gdb / utils.c
index 1e081552f07dd7f156d3fffeedacd56f5b667cf2..45fdb1dd47b8055dd5858fac1ee51e0ccade7802 100644 (file)
@@ -203,6 +203,18 @@ make_cleanup_freeargv (arg)
   return make_my_cleanup (&cleanup_chain, do_freeargv, arg);
 }
 
+static void
+do_bfd_close_cleanup (void *arg)
+{
+  bfd_close (arg);
+}
+
+struct cleanup *
+make_cleanup_bfd_close (bfd *abfd)
+{
+  return make_cleanup (do_bfd_close_cleanup, abfd);
+}
+
 static void
 do_ui_file_delete (void *arg)
 {
@@ -375,10 +387,16 @@ restore_my_cleanups (pmy_chain, chain)
    to arrange to free the object thus allocated.  */
 
 void
-free_current_contents (location)
-     char **location;
+free_current_contents (void *ptr)
 {
-  free (*location);
+  void **location = ptr;
+  if (location == NULL)
+    internal_error ("free_current_contents: NULL pointer");
+  if (*location != NULL)
+    {
+      free (*location);
+      *location = NULL;
+    }
 }
 
 /* Provide a known function that does nothing, to use as a base for
@@ -679,6 +697,7 @@ internal_verror (const char *fmt, va_list ap)
     }
 
   /* Try to get the message out */
+  target_terminal_ours ();
   fputs_unfiltered ("gdb-internal-error: ", gdb_stderr);
   vfprintf_unfiltered (gdb_stderr, fmt, ap);
   fputs_unfiltered ("\n", gdb_stderr);
@@ -719,6 +738,7 @@ internal_error (char *string, ...)
 {
   va_list ap;
   va_start (ap, string);
+
   internal_verror (string, ap);
   va_end (ap);
 }
@@ -2363,6 +2383,7 @@ initialize_utils ()
                  var_boolean, (char *) &pagination_enabled,
                  "Set state of pagination.", &setlist),
      &showlist);
+
   if (xdb_commands)
     {
       add_com ("am", class_support, pagination_on_command,
@@ -3006,20 +3027,3 @@ preg_nz (reg)
     }
   return preg_str;
 }
-
-/* Helper functions for INNER_THAN */
-int
-core_addr_lessthan (lhs, rhs)
-     CORE_ADDR lhs;
-     CORE_ADDR rhs;
-{
-  return (lhs < rhs);
-}
-
-int
-core_addr_greaterthan (lhs, rhs)
-     CORE_ADDR lhs;
-     CORE_ADDR rhs;
-{
-  return (lhs > rhs);
-}