This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdb: Use TYPE_LENGTH macro
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Andrew Burgess <andrew dot burgess at embecosm dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 14 Dec 2015 11:59:57 +0400
- Subject: Re: [PATCH] gdb: Use TYPE_LENGTH macro
- Authentication-results: sourceware.org; auth=none
- References: <35fffac2800e23cf5347c960104f8afa9c6f135d dot 1449861062 dot git dot andrew dot burgess at embecosm dot com>
On Fri, Dec 11, 2015 at 07:11:28PM +0000, Andrew Burgess wrote:
> Fixes a couple of places where we access the length field of the type
> structure directly, rather than using the TYPE_LENGTH macro.
>
> gdb/ChangeLog:
>
> * i386-tdep.c (i386_mpx_info_bounds): Use TYPE_LENGTH.
> (i386_mpx_set_bounds): Likewise.
> * solib-darwin.c (darwin_load_image_infos): Likewise.
> (darwin_solib_read_all_image_info_addr): Likewise.
This is nice, thank you! LGTM, except for one line that ends up
being too long, now, so you'll need to reformat a bit. See below.
> @@ -8853,14 +8853,14 @@ i386_mpx_set_bounds (char *args, int from_tty)
> bt_entry_addr = i386_mpx_get_bt_entry (addr, bd_base);
> for (i = 0; i < 2; i++)
> bt_entry[i] = read_memory_typed_address (bt_entry_addr
> - + i * data_ptr_type->length,
> + + i * TYPE_LENGTH (data_ptr_type),
> data_ptr_type);
> bt_entry[0] = (uint64_t) lower;
> bt_entry[1] = ~(uint64_t) upper;
>
> for (i = 0; i < 2; i++)
> - write_memory_unsigned_integer (bt_entry_addr + i * data_ptr_type->length,
> - data_ptr_type->length, byte_order,
> + write_memory_unsigned_integer (bt_entry_addr + i * TYPE_LENGTH (data_ptr_type),
> + TYPE_LENGTH (data_ptr_type), byte_order,
> bt_entry[i]);
... line too long here... The following should work:
write_memory_unsigned_integer (bt_entry_addr
+ i * TYPE_LENGTH (data_ptr_type),
TYPE_LENGTH (data_ptr_type), byte_order,
bt_entry[i]);
--
Joel