aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm2005-11-09 23:14:32 +0000
committerKim F. Storm2005-11-09 23:14:32 +0000
commitbd90dcd000bbc315b26153f091ce6a2ac592f1d7 (patch)
tree0cabe39b9511d405137abf7024e7beb3dc7917c0 /src
parentcbe3cc9229c62feafb7c8bfba3ddd24678d097c1 (diff)
downloademacs-bd90dcd000bbc315b26153f091ce6a2ac592f1d7.tar.gz
emacs-bd90dcd000bbc315b26153f091ce6a2ac592f1d7.zip
(safe_debug_print): New function to be called from gdb
to print Lisp objects; use valid_lisp_object_p to avoid crashing if user tries to print something which is not a Lisp object.
Diffstat (limited to 'src')
-rw-r--r--src/print.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/print.c b/src/print.c
index 91642afd651..d563580ddd3 100644
--- a/src/print.c
+++ b/src/print.c
@@ -970,6 +970,26 @@ debug_print (arg)
970 Fprin1 (arg, Qexternal_debugging_output); 970 Fprin1 (arg, Qexternal_debugging_output);
971 fprintf (stderr, "\r\n"); 971 fprintf (stderr, "\r\n");
972} 972}
973
974void
975safe_debug_print (arg)
976 Lisp_Object arg;
977{
978 int valid = valid_lisp_object_p (arg);
979
980 if (valid > 0)
981 debug_print (arg);
982 else
983 fprintf (stderr, "#<%s_LISP_OBJECT 0x%08lx>\r\n",
984 !valid ? "INVALID" : "SOME",
985#ifdef NO_UNION_TYPE
986 (unsigned long) arg
987#else
988 (unsigned long) arg.i
989#endif
990 );
991}
992
973 993
974DEFUN ("error-message-string", Ferror_message_string, Serror_message_string, 994DEFUN ("error-message-string", Ferror_message_string, Serror_message_string,
975 1, 1, 0, 995 1, 1, 0,