This commit was generated by cvs2svn to track changes on a CVS vendor
[deliverable/binutils-gdb.git] / gdb / maint.c
index 4ec051ad991c2aeda4ec8016a2d5e5f4e5303ea3..725c6c5d64a05b37060fa78611d0b19297de6a06 100644 (file)
 #include "objfiles.h"
 #include "value.h"
 
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
 extern void _initialize_maint_cmds PARAMS ((void));
 
 static void maintenance_command PARAMS ((char *, int));
 
 static void maintenance_dump_me PARAMS ((char *, int));
 
+static void maintenance_internal_error PARAMS ((char *args, int from_tty));
+
 static void maintenance_demangle PARAMS ((char *, int));
 
 static void maintenance_time_display PARAMS ((char *, int));
@@ -99,12 +97,29 @@ maintenance_dump_me (args, from_tty)
 {
   if (query ("Should GDB dump core? "))
     {
+#ifdef __DJGPP__
+      /* SIGQUIT by default is ignored, so use SIGABRT instead.  */
+      signal (SIGABRT, SIG_DFL);
+      kill (getpid (), SIGABRT);
+#else
       signal (SIGQUIT, SIG_DFL);
       kill (getpid (), SIGQUIT);
+#endif
     }
 }
 #endif
 
+/* Stimulate the internal error mechanism that GDB uses when an
+   internal problem is detected.  Allows testing of the mechanism.
+   Also useful when the user wants to drop a core file but not exit
+   GDB. */
+
+static void
+maintenance_internal_error (char *args, int from_tty)
+{
+  internal_error ("internal maintenance");
+}
+
 /*  Someday we should allow demangling for things other than just
    explicit strings.  For example, we might want to be able to
    specify the address of a string in either GDB's process space
@@ -332,13 +347,13 @@ maintenance_translate_address (arg, from_tty)
     sym = lookup_minimal_symbol_by_pc (address);
 
   if (sym)
-    printf_filtered ("%s+%u\n",
+    printf_filtered ("%s+%s\n",
                     SYMBOL_SOURCE_NAME (sym),
-                    address - SYMBOL_VALUE_ADDRESS (sym));
+                    paddr_u (address - SYMBOL_VALUE_ADDRESS (sym)));
   else if (sect)
-    printf_filtered ("no symbol at %s:0x%08x\n", sect->name, address);
+    printf_filtered ("no symbol at %s:0x%s\n", sect->name, paddr (address));
   else
-    printf_filtered ("no symbol at 0x%08x\n", address);
+    printf_filtered ("no symbol at 0x%s\n", paddr (address));
 
   return;
 }
@@ -378,6 +393,11 @@ itself a SIGQUIT signal.",
           &maintenancelist);
 #endif
 
+  add_cmd ("internal-error", class_maintenance, maintenance_internal_error,
+          "Give GDB an internal error.\n\
+Cause GDB to behave as if an internal error was detected.",
+          &maintenancelist);
+
   add_cmd ("demangle", class_maintenance, maintenance_demangle,
           "Demangle a C++ mangled name.\n\
 Call internal GDB demangler routine to demangle a C++ link name\n\
This page took 0.027506 seconds and 4 git commands to generate.