]> git.eshelyaron.com Git - emacs.git/commitdiff
(safe_debug_print): New function to be called from gdb
authorKim F. Storm <storm@cua.dk>
Wed, 9 Nov 2005 23:14:32 +0000 (23:14 +0000)
committerKim F. Storm <storm@cua.dk>
Wed, 9 Nov 2005 23:14:32 +0000 (23:14 +0000)
to print Lisp objects; use valid_lisp_object_p to avoid crashing
if user tries to print something which is not a Lisp object.

src/print.c

index 91642afd6512c0fad0cd5217928bd1f745b69506..d563580ddd3d4bb75a37fdb007fb29d257a268ed 100644 (file)
@@ -970,6 +970,26 @@ debug_print (arg)
   Fprin1 (arg, Qexternal_debugging_output);
   fprintf (stderr, "\r\n");
 }
+
+void
+safe_debug_print (arg)
+     Lisp_Object arg;
+{
+  int valid = valid_lisp_object_p (arg);
+
+  if (valid > 0)
+    debug_print (arg);
+  else
+    fprintf (stderr, "#<%s_LISP_OBJECT 0x%08lx>\r\n",
+            !valid ? "INVALID" : "SOME",
+#ifdef NO_UNION_TYPE
+            (unsigned long) arg
+#else
+            (unsigned long) arg.i
+#endif
+            );
+}
+
 \f
 DEFUN ("error-message-string", Ferror_message_string, Serror_message_string,
        1, 1, 0,