1.0.3.14: fix print_obj on x86-64
[sbcl.git] / src / runtime / print.c
index 451a16d..8e3ba51 100644 (file)
@@ -49,6 +49,28 @@ static void print_obj(char *prefix, lispobj obj);
 
 #define NEWLINE_OR_RETURN if (continue_p(1)) newline(NULL); else return;
 
+/* FIXME: This should be auto-generated by whatever generates
+   constants.h so we don't have to maintain this twice! */
+#ifdef LISP_FEATURE_X86_64
+char *lowtag_Names[] = {
+    "even fixnum",
+    "instance pointer",
+    "other immediate [0]",
+    "unknown [3]",
+    "unknown [4]",
+    "unknown [5]",
+    "other immediate [1]",
+    "list pointer",
+    "odd fixnum",
+    "function pointer",
+    "other immediate [2]",
+    "unknown [11]",
+    "unknown [12]",
+    "unknown [13]",
+    "other immediate [3]",
+    "other pointer"
+};
+#else
 char *lowtag_Names[] = {
     "even fixnum",
     "instance pointer",
@@ -59,6 +81,7 @@ char *lowtag_Names[] = {
     "other immediate [1]",
     "other pointer"
 };
+#endif
 
 /* FIXME: Yikes! This table implicitly depends on the values in sbcl.h,
  * but doesn't actually depend on them, so if they change, it gets
@@ -326,6 +349,11 @@ static void brief_list(lispobj obj)
     }
 }
 
+static void print_unknown(lispobj obj)
+{
+    printf("unknown object: %p", obj);
+}
+
 static void print_list(lispobj obj)
 {
     if (!is_valid_lisp_addr((os_vm_address_t)native_pointer(obj))) {
@@ -418,7 +446,7 @@ static void print_slots(char **slots, int count, lispobj *ptr)
 /* FIXME: Yikes again! This, like subtype_Names[], needs to depend
  * on the values in sbcl.h (or perhaps be generated automatically
  * by GENESIS as part of sbcl.h). */
-static char *symbol_slots[] = {"value: ", "unused: ",
+static char *symbol_slots[] = {"value: ", "hash: ",
     "plist: ", "name: ", "package: ",
 #ifdef LISP_FEATURE_SB_THREAD
     "tls-index: " ,
@@ -670,12 +698,25 @@ static void print_otherptr(lispobj obj)
 
 static void print_obj(char *prefix, lispobj obj)
 {
+#ifdef LISP_FEATURE_X86_64
+    static void (*verbose_fns[])(lispobj obj)
+        = {print_fixnum, print_struct, print_otherimm, print_unknown,
+           print_unknown, print_unknown, print_otherimm, print_list,
+           print_fixnum, print_otherptr, print_otherimm, print_unknown,
+           print_unknown, print_unknown, print_otherimm, print_otherptr};
+    static void (*brief_fns[])(lispobj obj)
+        = {brief_fixnum, brief_struct, brief_otherimm, print_unknown,
+           print_unknown,  print_unknown, brief_otherimm, brief_list,
+           brief_fixnum, brief_otherptr, brief_otherimm, print_unknown,
+           print_unknown,  print_unknown,brief_otherimm, brief_otherptr};
+#else
     static void (*verbose_fns[])(lispobj obj)
         = {print_fixnum, print_struct, print_otherimm, print_list,
            print_fixnum, print_otherptr, print_otherimm, print_otherptr};
     static void (*brief_fns[])(lispobj obj)
         = {brief_fixnum, brief_struct, brief_otherimm, brief_list,
            brief_fixnum, brief_otherptr, brief_otherimm, brief_otherptr};
+#endif
     int type = lowtag_of(obj);
     struct var *var = lookup_by_obj(obj);
     char buffer[256];