Convert Go printing to value-based API
[deliverable/binutils-gdb.git] / gdb / go-valprint.c
index 1648a6c02c0876654fbe877a9c1abc7753789343..79b3ad58d5a2f1a185f44811a92d95e15af3e82e 100644 (file)
@@ -122,3 +122,40 @@ go_val_print (struct type *type, int embedded_offset,
        break;
     }
 }
+
+/* See go-lang.h.  */
+
+void
+go_value_print_inner (struct value *val, struct ui_file *stream,
+                     int recurse, const struct value_print_options *options)
+{
+  struct type *type = check_typedef (value_type (val));
+
+  switch (TYPE_CODE (type))
+    {
+      case TYPE_CODE_STRUCT:
+       {
+         enum go_type go_type = go_classify_struct_type (type);
+
+         switch (go_type)
+           {
+           case GO_TYPE_STRING:
+             if (! options->raw)
+               {
+                 print_go_string (type, value_embedded_offset (val),
+                                  value_address (val),
+                                  stream, recurse, val, options);
+                 return;
+               }
+             break;
+           default:
+             break;
+           }
+       }
+       /* Fall through.  */
+
+      default:
+       c_value_print_inner (val, stream, recurse, options);
+       break;
+    }
+}
This page took 0.023479 seconds and 4 git commands to generate.