diff options
| author | Karl Heuer | 1995-01-19 21:09:50 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-01-19 21:09:50 +0000 |
| commit | 00d76abc821d050efa5bf10483460611f51fd504 (patch) | |
| tree | ea805b199f87adfde824ce28966a0ca3df4dc6d4 /src | |
| parent | b59ab95c5cbfe7663b04f95e896c19f1284e6e46 (diff) | |
| download | emacs-00d76abc821d050efa5bf10483460611f51fd504.tar.gz emacs-00d76abc821d050efa5bf10483460611f51fd504.zip | |
(print): Print internal types too, for debugging.
Print appropriate message for invalid pseudovector or misc type.
Diffstat (limited to 'src')
| -rw-r--r-- | src/print.c | 74 |
1 files changed, 68 insertions, 6 deletions
diff --git a/src/print.c b/src/print.c index c6bc0c59762..8f8b6090595 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -977,6 +977,8 @@ print (obj, printcharfun, escapeflag) | |||
| 977 | PRINTCHAR ('#'); | 977 | PRINTCHAR ('#'); |
| 978 | size &= PSEUDOVECTOR_SIZE_MASK; | 978 | size &= PSEUDOVECTOR_SIZE_MASK; |
| 979 | } | 979 | } |
| 980 | if (size & PSEUDOVECTOR_FLAG) | ||
| 981 | goto badtype; | ||
| 980 | 982 | ||
| 981 | PRINTCHAR ('['); | 983 | PRINTCHAR ('['); |
| 982 | { | 984 | { |
| @@ -995,8 +997,9 @@ print (obj, printcharfun, escapeflag) | |||
| 995 | 997 | ||
| 996 | #ifndef standalone | 998 | #ifndef standalone |
| 997 | case Lisp_Misc: | 999 | case Lisp_Misc: |
| 998 | if (MARKERP (obj)) | 1000 | switch (XMISC (obj)->type) |
| 999 | { | 1001 | { |
| 1002 | case Lisp_Misc_Marker: | ||
| 1000 | strout ("#<marker ", -1, printcharfun); | 1003 | strout ("#<marker ", -1, printcharfun); |
| 1001 | if (!(XMARKER (obj)->buffer)) | 1004 | if (!(XMARKER (obj)->buffer)) |
| 1002 | strout ("in no buffer", -1, printcharfun); | 1005 | strout ("in no buffer", -1, printcharfun); |
| @@ -1009,9 +1012,8 @@ print (obj, printcharfun, escapeflag) | |||
| 1009 | } | 1012 | } |
| 1010 | PRINTCHAR ('>'); | 1013 | PRINTCHAR ('>'); |
| 1011 | break; | 1014 | break; |
| 1012 | } | 1015 | |
| 1013 | else if (OVERLAYP (obj)) | 1016 | case Lisp_Misc_Overlay: |
| 1014 | { | ||
| 1015 | strout ("#<overlay ", -1, printcharfun); | 1017 | strout ("#<overlay ", -1, printcharfun); |
| 1016 | if (!(XMARKER (OVERLAY_START (obj))->buffer)) | 1018 | if (!(XMARKER (OVERLAY_START (obj))->buffer)) |
| 1017 | strout ("in no buffer", -1, printcharfun); | 1019 | strout ("in no buffer", -1, printcharfun); |
| @@ -1026,16 +1028,76 @@ print (obj, printcharfun, escapeflag) | |||
| 1026 | } | 1028 | } |
| 1027 | PRINTCHAR ('>'); | 1029 | PRINTCHAR ('>'); |
| 1028 | break; | 1030 | break; |
| 1031 | |||
| 1032 | /* Remaining cases shouldn't happen in normal usage, but let's print | ||
| 1033 | them anyway for the benefit of the debugger. */ | ||
| 1034 | case Lisp_Misc_Free: | ||
| 1035 | strout ("#<misc free cell>", -1, printcharfun); | ||
| 1036 | break; | ||
| 1037 | |||
| 1038 | case Lisp_Misc_Intfwd: | ||
| 1039 | sprintf (buf, "#<intfwd to %d>", *XINTFWD (obj)->intvar); | ||
| 1040 | strout (buf, -1, printcharfun); | ||
| 1041 | break; | ||
| 1042 | |||
| 1043 | case Lisp_Misc_Boolfwd: | ||
| 1044 | sprintf (buf, "#<boolfwd to %s>", | ||
| 1045 | (*XBOOLFWD (obj)->boolvar ? "t" : "nil")); | ||
| 1046 | strout (buf, -1, printcharfun); | ||
| 1047 | break; | ||
| 1048 | |||
| 1049 | case Lisp_Misc_Objfwd: | ||
| 1050 | strout (buf, "#<objfwd to ", -1, printcharfun); | ||
| 1051 | print (*XOBJFWD (obj)->objvar, printcharfun, escapeflag); | ||
| 1052 | PRINTCHAR ('>'); | ||
| 1053 | break; | ||
| 1054 | |||
| 1055 | case Lisp_Misc_Buffer_Objfwd: | ||
| 1056 | strout (buf, "#<buffer_objfwd to ", -1, printcharfun); | ||
| 1057 | print (*(Lisp_Object *)((char *)current_buffer + | ||
| 1058 | XBUFFER_OBJFWD (obj)->offset), | ||
| 1059 | printcharfun, escapeflag); | ||
| 1060 | PRINTCHAR ('>'); | ||
| 1061 | break; | ||
| 1062 | |||
| 1063 | case Lisp_Misc_Buffer_Local_Value: | ||
| 1064 | strout ("#<buffer_local_value ", -1, printcharfun); | ||
| 1065 | goto do_buffer_local; | ||
| 1066 | case Lisp_Misc_Some_Buffer_Local_Value: | ||
| 1067 | strout ("#<some_buffer_local_value ", -1, printcharfun); | ||
| 1068 | do_buffer_local: | ||
| 1069 | strout ("[realvalue] ", -1, printcharfun); | ||
| 1070 | print (XBUFFER_LOCAL_VALUE (obj)->car, printcharfun, escapeflag); | ||
| 1071 | strout ("[buffer] ", -1, printcharfun); | ||
| 1072 | print (XCONS (XBUFFER_LOCAL_VALUE (obj)->cdr)->car, | ||
| 1073 | printcharfun, escapeflag); | ||
| 1074 | strout ("[alist-elt] ", -1, printcharfun); | ||
| 1075 | print (XCONS (XCONS (XBUFFER_LOCAL_VALUE (obj)->cdr)->cdr)->car, | ||
| 1076 | printcharfun, escapeflag); | ||
| 1077 | strout ("[default-value] ", -1, printcharfun); | ||
| 1078 | print (XCONS (XCONS (XBUFFER_LOCAL_VALUE (obj)->cdr)->cdr)->cdr, | ||
| 1079 | printcharfun, escapeflag); | ||
| 1080 | PRINTCHAR ('>'); | ||
| 1081 | break; | ||
| 1082 | |||
| 1083 | default: | ||
| 1084 | goto badtype; | ||
| 1029 | } | 1085 | } |
| 1030 | /* Other cases fall through to get an error. */ | 1086 | break; |
| 1031 | #endif /* standalone */ | 1087 | #endif /* standalone */ |
| 1032 | 1088 | ||
| 1033 | default: | 1089 | default: |
| 1090 | badtype: | ||
| 1034 | { | 1091 | { |
| 1035 | /* We're in trouble if this happens! | 1092 | /* We're in trouble if this happens! |
| 1036 | Probably should just abort () */ | 1093 | Probably should just abort () */ |
| 1037 | strout ("#<EMACS BUG: INVALID DATATYPE ", -1, printcharfun); | 1094 | strout ("#<EMACS BUG: INVALID DATATYPE ", -1, printcharfun); |
| 1038 | sprintf (buf, "(#o%3o)", (int) XTYPE (obj)); | 1095 | if (MISCP (obj)) |
| 1096 | sprintf (buf, "(MISC 0x%04x)", (int) XMISC (obj)->type); | ||
| 1097 | else if (VECTORLIKEP (obj)) | ||
| 1098 | sprintf (buf, "(PVEC 0x%08x)", (int) XVECTOR (obj)->size); | ||
| 1099 | else | ||
| 1100 | sprintf (buf, "(0x%02x)", (int) XTYPE (obj)); | ||
| 1039 | strout (buf, -1, printcharfun); | 1101 | strout (buf, -1, printcharfun); |
| 1040 | strout (" Save your buffers immediately and please report this bug>", | 1102 | strout (" Save your buffers immediately and please report this bug>", |
| 1041 | -1, printcharfun); | 1103 | -1, printcharfun); |