Patchwork Remove MAX_REGISTER_SIZE define

login
register
mail settings
Submitter Alan Hayward
Date March 7, 2018, 3:53 p.m.
Message ID <5761B350-C237-4774-A305-B12193EF8577@arm.com>
Download mbox | patch
Permalink /patch/26225/
State New
Headers show

Comments

Alan Hayward - March 7, 2018, 3:53 p.m.
Many thanks to Yao for helping me remove all the other uses of
MAX_REGISTER_SIZE over the last year or so!

This patch removes the last uses of MAX_REGISTER_SIZE and deletes the define.

Built on x86 and aarch64. Grepped to ensured no more stray
MAX_REGISTER_SIZEs left in the code.

Alan

2018-03-07  Alan Hayward  <alan.hayward@arm.com>

	* defs.h: Remove MAX_REGISTER_SIZE
	* regcache.c (init_regcache_descr): Remove MAX_REGISTER_SIZE
	asserts.
	* python/py-unwind.c (pyuw_sniffer): Likewise.
Yao Qi - March 7, 2018, 4:22 p.m.
On Wed, Mar 7, 2018 at 3:53 PM, Alan Hayward <Alan.Hayward@arm.com> wrote:
> 2018-03-07  Alan Hayward  <alan.hayward@arm.com>
>
>         * defs.h: Remove MAX_REGISTER_SIZE
>         * regcache.c (init_regcache_descr): Remove MAX_REGISTER_SIZE
>         asserts.
>         * python/py-unwind.c (pyuw_sniffer): Likewise.
>

Patch is good to me.

Patch

diff --git a/gdb/defs.h b/gdb/defs.h
index a924573b57f8322f7b674c0bf0f749ab318983e2..91988758a3a8fb5125624381dfa0277730c6c373 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -531,11 +531,6 @@  enum symbol_needs_kind
 /* Dynamic target-system-dependent parameters for GDB.  */
 #include "gdbarch.h"

-/* * Maximum size of a register.  Something small, but large enough for
-   all known ISAs.  If it turns out to be too small, make it bigger.  */
-
-enum { MAX_REGISTER_SIZE = 64 };
-
 /* In findvar.c.  */

 template<typename T, typename = RequireLongest<T>>
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index a7e3a93ebc48c58661a14c73bd4618d47ffbb81b..906a00447e691bd248ec3a83bd54b80b6b85eeff 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -583,7 +583,6 @@  pyuw_sniffer (const struct frame_unwind *self, struct frame_info *this_frame,
         /* `value' validation was done before, just assert.  */
         gdb_assert (value != NULL);
         gdb_assert (data_size == TYPE_LENGTH (value_type (value)));
-        gdb_assert (data_size <= MAX_REGISTER_SIZE);

 	cached_frame->reg[i].data = (gdb_byte *) xmalloc (data_size);
         memcpy (cached_frame->reg[i].data, value_contents (value), data_size);
diff --git a/gdb/regcache.c b/gdb/regcache.c
index c73582f66ae38f288b9b68d6d054a7f82ac16e60..ebd0fd3d5f786ad35a80b7ef4aeb445036aae92e 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -117,7 +117,6 @@  init_regcache_descr (struct gdbarch *gdbarch)
 	descr->sizeof_register[i] = TYPE_LENGTH (descr->register_type[i]);
 	descr->register_offset[i] = offset;
 	offset += descr->sizeof_register[i];
-	gdb_assert (MAX_REGISTER_SIZE >= descr->sizeof_register[i]);
       }
     /* Set the real size of the raw register cache buffer.  */
     descr->sizeof_raw_registers = offset;
@@ -127,7 +126,6 @@  init_regcache_descr (struct gdbarch *gdbarch)
 	descr->sizeof_register[i] = TYPE_LENGTH (descr->register_type[i]);
 	descr->register_offset[i] = offset;
 	offset += descr->sizeof_register[i];
-	gdb_assert (MAX_REGISTER_SIZE >= descr->sizeof_register[i]);
       }
     /* Set the real size of the readonly register cache buffer.  */
     descr->sizeof_cooked_registers = offset;