X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fvalue.c;h=781808016cde43778c4446b1ae4f0ff02f17b20d;hb=8aaaf7577f070c91086533d959ac36a15d1d604f;hp=8e22ac7f8c1bce79605e7679ea2a4a3d5d214314;hpb=1a6d41c6433a0980f302c480b1d1db71234b49e4;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/value.c b/gdb/value.c index 8e22ac7f8c..781808016c 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -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 &&doc, +add_internal_function (gdb::unique_xmalloc_ptr &&name, + gdb::unique_xmalloc_ptr &&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 *