This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] regcache.c (register_size): Check for REGISTER_RAW_SIZE_P


Hi,

according to my confused mail on the gdb list
(http://sources.redhat.com/ml/gdb/2003-07/msg00091.html)

I think register_size() in regcache.c needs a patch.  First of all,
it calls the very same gdb_assert() call twice.  The second reason
is that REGISTER_RAW_SIZE() is called in this assertion unconditionally.
This collides with the attempts to get rid of deprecated calls.

A target which already removed the call is so unable to call register_size
w/o failing in gdbarch_deprecated_register_raw_size().

I've just updated that code adding some comments (and deleting the stray assert).


Therefore I suggest testing for REGISTER_RAW_SIZE_P first.  Does that
makes sense?

I thought about that when making my change but decided to retain the unconditional check.
Until REGISTER_RAW_SIZE is completly eliminated it's value must always match that computed by the register cache. If the architecture didn't supply a method then the default needs to match.


Andrew



	* regcache.c (register_size): Remove second call to gdb_assert.
	Only call assertion if REGISTER_RAW_SIZE is implemented for
	this target.

Index: regcache.c
===================================================================
RCS file: /cvs/src/src/gdb/regcache.c,v
retrieving revision 1.89
diff -u -p -r1.89 regcache.c
--- regcache.c 3 Jul 2003 14:34:29 -0000 1.89
+++ regcache.c 9 Jul 2003 14:01:37 -0000
@@ -290,8 +290,8 @@ register_size (struct gdbarch *gdbarch, int size;
gdb_assert (regnum >= 0 && regnum < (NUM_REGS + NUM_PSEUDO_REGS));
size = descr->sizeof_register[regnum];
- gdb_assert (size == REGISTER_RAW_SIZE (regnum)); /* OK */
- gdb_assert (size == REGISTER_RAW_SIZE (regnum)); /* OK */
+ if (REGISTER_RAW_SIZE_P ())
+ gdb_assert (size == REGISTER_RAW_SIZE (regnum)); /* OK */
return size;
}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]