gas: remove use of PTR
[binutils-gdb.git] / gdb / go-valprint.c
index 73429c64f67a0e9c6db6f6e3406d32fe288dda4a..45bd529ba950b2240a0f18b8dda0f21f87455998 100644 (file)
@@ -1,6 +1,6 @@
 /* Support for printing Go values for GDB, the GNU debugger.
 
-   Copyright (C) 2012-2021 Free Software Foundation, Inc.
+   Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -43,7 +43,7 @@ print_go_string (struct type *type,
                 struct value *val,
                 const struct value_print_options *options)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
   struct type *elt_ptr_type = type->field (0).type ();
   struct type *elt_type = TYPE_TARGET_TYPE (elt_ptr_type);
   LONGEST length;
@@ -52,7 +52,7 @@ print_go_string (struct type *type,
      unpack_value_field_as_pointer.  Do this until we can get
      unpack_value_field_as_pointer.  */
   LONGEST addr;
-  const gdb_byte *valaddr = value_contents_for_printing (val);
+  const gdb_byte *valaddr = value_contents_for_printing (val).data ();
 
 
   if (! unpack_value_field_as_long (type, valaddr, embedded_offset, 0,
@@ -66,15 +66,15 @@ print_go_string (struct type *type,
   /* TODO(dje): Print address of struct or actual string?  */
   if (options->addressprint)
     {
-      fputs_filtered (paddress (gdbarch, addr), stream);
-      fputs_filtered (" ", stream);
+      gdb_puts (paddress (gdbarch, addr), stream);
+      gdb_puts (" ", stream);
     }
 
   if (length < 0)
     {
-      printf_filtered (_("<invalid length: %ps>"),
-                      styled_string (metadata_style.style (),
-                                     plongest (addr)));
+      gdb_printf (_("<invalid length: %ps>"),
+                 styled_string (metadata_style.style (),
+                                plongest (addr)));
       return;
     }