Work around GCC 6.3.1 bug
[deliverable/binutils-gdb.git] / gdb / cp-valprint.c
index 9432c8369b046f02f5b05577467661f507d14c98..fb9bfd904f7b21107a9b6f247e73637d978e5981 100644 (file)
@@ -1,6 +1,6 @@
 /* Support for printing C++ values for GDB, the GNU debugger.
 
-   Copyright (C) 1986-2016 Free Software Foundation, Inc.
+   Copyright (C) 1986-2017 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -35,6 +35,7 @@
 #include "language.h"
 #include "extension.h"
 #include "typeprint.h"
+#include "byte-vector.h"
 
 /* Controls printing of vtbl's.  */
 static void
@@ -73,8 +74,6 @@ static struct obstack dont_print_vb_obstack;
 static struct obstack dont_print_statmem_obstack;
 static struct obstack dont_print_stat_array_obstack;
 
-extern void _initialize_cp_valprint (void);
-
 static void cp_print_static_field (struct type *, struct value *,
                                   struct ui_file *, int,
                                   const struct value_print_options *);
@@ -534,23 +533,18 @@ cp_print_value (struct type *type, struct type *real_type,
              if ((boffset + offset) < 0
                  || (boffset + offset) >= TYPE_LENGTH (real_type))
                {
-                 gdb_byte *buf;
-                 struct cleanup *back_to;
-
-                 buf = (gdb_byte *) xmalloc (TYPE_LENGTH (baseclass));
-                 back_to = make_cleanup (xfree, buf);
+                 gdb::byte_vector buf (TYPE_LENGTH (baseclass));
 
-                 if (target_read_memory (address + boffset, buf,
+                 if (target_read_memory (address + boffset, buf.data (),
                                          TYPE_LENGTH (baseclass)) != 0)
                    skip = 1;
                  base_val = value_from_contents_and_address (baseclass,
-                                                             buf,
+                                                             buf.data (),
                                                              address + boffset);
                  baseclass = value_type (base_val);
                  thisoffset = 0;
                  boffset = 0;
                  thistype = baseclass;
-                 do_cleanups (back_to);
                }
              else
                {
@@ -759,7 +753,7 @@ cp_find_class_member (struct type **self_p, int *fieldno,
 
 void
 cp_print_class_member (const gdb_byte *valaddr, struct type *type,
-                      struct ui_file *stream, char *prefix)
+                      struct ui_file *stream, const char *prefix)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
 
This page took 0.025408 seconds and 4 git commands to generate.