gdbserver: make aarch64_write_goto_address static
[deliverable/binutils-gdb.git] / gdb / value.c
index 8e22ac7f8c1bce79605e7679ea2a4a3d5d214314..53b51755d1d9d032d8deb904ae6344d202be5254 100644 (file)
@@ -1,6 +1,6 @@
 /* Low level packing and unpacking of values for GDB, the GNU Debugger.
 
-   Copyright (C) 1986-2019 Free Software Foundation, Inc.
+   Copyright (C) 1986-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -273,8 +273,8 @@ struct value
   LONGEST bitsize = 0;
 
   /* Only used for bitfields; position of start of field.  For
-     gdbarch_bits_big_endian=0 targets, it is the position of the LSB.  For
-     gdbarch_bits_big_endian=1 targets, it is the position of the MSB.  */
+     little-endian targets, it is the position of the LSB.  For
+     big-endian targets, it is the position of the MSB.  */
   LONGEST bitpos = 0;
 
   /* The number of references to this value.  When a value is created,
@@ -2421,31 +2421,19 @@ function_command (const char *command, int from_tty)
   /* Do nothing.  */
 }
 
-/* Clean up if an internal function's command is destroyed.  */
-static void
-function_destroyer (struct cmd_list_element *self, void *ignore)
-{
-  xfree ((char *) self->name);
-}
-
 /* Helper function that does the work for add_internal_function.  */
 
 static struct cmd_list_element *
 do_add_internal_function (const char *name, const char *doc,
                          internal_function_fn handler, void *cookie)
 {
-  struct cmd_list_element *cmd;
   struct internal_function *ifn;
   struct internalvar *var = lookup_internalvar (name);
 
   ifn = create_internal_function (name, handler, cookie);
   set_internalvar_function (var, ifn);
 
-  cmd = add_cmd (xstrdup (name), no_class, function_command, (char *) doc,
-                &functionlist);
-  cmd->destroyer = function_destroyer;
-
-  return cmd;
+  return add_cmd (name, no_class, function_command, doc, &functionlist);
 }
 
 /* See value.h.  */
@@ -2460,13 +2448,16 @@ add_internal_function (const char *name, const char *doc,
 /* See value.h.  */
 
 void
-add_internal_function (const char *name, gdb::unique_xmalloc_ptr<char> &&doc,
+add_internal_function (gdb::unique_xmalloc_ptr<char> &&name,
+                      gdb::unique_xmalloc_ptr<char> &&doc,
                       internal_function_fn handler, void *cookie)
 {
   struct cmd_list_element *cmd
-    = do_add_internal_function (name, doc.get (), handler, cookie);
+    = do_add_internal_function (name.get (), doc.get (), handler, cookie);
   doc.release ();
   cmd->doc_allocated = 1;
+  name.release ();
+  cmd->name_allocated = 1;
 }
 
 /* Update VALUE before discarding OBJFILE.  COPIED_TYPES is used to
@@ -3144,7 +3135,7 @@ unpack_bits_as_long (struct type *field_type, const gdb_byte *valaddr,
 
   /* Extract bits.  See comment above.  */
 
-  if (gdbarch_bits_big_endian (get_type_arch (field_type)))
+  if (byte_order == BFD_ENDIAN_BIG)
     lsbcount = (bytes_read * 8 - bitpos % 8 - bitsize);
   else
     lsbcount = (bitpos % 8);
@@ -3320,7 +3311,7 @@ modify_field (struct type *type, gdb_byte *addr,
   oword = extract_unsigned_integer (addr, bytesize, byte_order);
 
   /* Shifting for bit field depends on endianness of the target machine.  */
-  if (gdbarch_bits_big_endian (get_type_arch (type)))
+  if (byte_order == BFD_ENDIAN_BIG)
     bitpos = bytesize * 8 - bitpos - bitsize;
 
   oword &= ~(mask << bitpos);
@@ -3956,7 +3947,7 @@ isvoid_internal_fn (struct gdbarch *gdbarch,
   return value_from_longest (builtin_type (gdbarch)->builtin_int, ret);
 }
 
-/* Implementation of the convenience function $_cimag.  Extracts the
+/* Implementation of the convenience function $_creal.  Extracts the
    real part from a complex number.  */
 
 static struct value *
This page took 0.025245 seconds and 4 git commands to generate.