diff mbox

msp430: Don't use REG_UNKNOWN

Message ID C91B794C-4805-4A3B-BFD3-EA7FA8D8466C@arm.com
State New
Headers show

Commit Message

Alan Hayward April 7, 2017, 8:36 a.m. UTC
This patch is cut from "[PATCH] Remove MAX_REGISTER_SIZE from regcache.c"

This patch simply makes it more obvious that msp430_pseudo_register_read ()
cannot return REG_UNKNOWN.

This is required due to some regcache refactoring (see the “Remove
MAX_REGISTER_SIZE from regcache.c" thread).

Tested on a --enable-targets=all build using make check with board files
unix and native-gdbserver.

I do not have a msp430 machine to test on.

Ok to commit?

Alan.

2017-04-06  Alan Hayward  <alan.hayward@arm.com>

	* msp430-tdep.c (msp430_pseudo_register_read): Never return
	REG_UNKNOWN.

Comments

Yao Qi April 10, 2017, 1:45 p.m. UTC | #1
Alan Hayward <Alan.Hayward@arm.com> writes:

> Ok to commit?
>
> Alan.
>
> 2017-04-06  Alan Hayward  <alan.hayward@arm.com>
>
> 	* msp430-tdep.c (msp430_pseudo_register_read): Never return
> 	REG_UNKNOWN.

Patch is good to me.
diff mbox

Patch

diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index 75329dfcc5ed94fff19639db4db21dd0874d0e96..d9eebf0cc2647a079db2f822145d0fb74ea301e4 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -221,10 +221,9 @@  msp430_pseudo_register_read (struct gdbarch *gdbarch,
 			     struct regcache *regcache,
 			     int regnum, gdb_byte *buffer)
 {
-  enum register_status status = REG_UNKNOWN;
-
   if (MSP430_NUM_REGS <= regnum && regnum < MSP430_NUM_TOTAL_REGS)
     {
+      enum register_status status;
       ULONGEST val;
       enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
       int regsize = register_size (gdbarch, regnum);
@@ -234,11 +233,10 @@  msp430_pseudo_register_read (struct gdbarch *gdbarch,
       if (status == REG_VALID)
 	store_unsigned_integer (buffer, regsize, byte_order, val);

+      return status;
     }
   else
     gdb_assert_not_reached ("invalid pseudo register number");
-
-  return status;
 }

 /* Implement the "pseudo_register_write" gdbarch method.  */