From: Michael Snyder Date: Wed, 24 May 2000 17:25:39 +0000 (+0000) Subject: 2000-05-24 Michael Snyder X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0f2c5ba5c5457819f3089c6ad9cd7fced6bc0538;p=binutils-gdb.git 2000-05-24 Michael Snyder * findvar.c (value_from_register): Factor code, simplify logic. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 04db1e2710b..efedf756c31 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2000-05-24 Michael Snyder + + * findvar.c (value_from_register): Factor code, simplify logic. + 2000-05-23 J.T. Conklin * config/i386/nbsd.mt (TDEPFILES): Move solib.o from here... diff --git a/gdb/findvar.c b/gdb/findvar.c index 8f1960890fd..7edbcea7c81 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -1476,7 +1476,7 @@ addresses have not been bound by the dynamic loader. Try again when executable i } /* Return a value of type TYPE, stored in register REGNUM, in frame - FRAME. + FRAME. NOTE: returns NULL if register value is not available. Caller will check return value or die! */ @@ -1500,7 +1500,8 @@ value_from_register (type, regnum, frame) CHECK_TYPEDEF (type); len = TYPE_LENGTH (type); - /* Pointers on D10V are really only 16 bits, but we lie to gdb elsewhere... */ + /* Pointers on D10V are really only 16 bits, + but we lie to gdb elsewhere... */ if (GDB_TARGET_IS_D10V && TYPE_CODE (type) == TYPE_CODE_PTR) len = 2; @@ -1703,25 +1704,20 @@ value_from_register (type, regnum, frame) } if (GDB_TARGET_IS_D10V - && TYPE_CODE (type) == TYPE_CODE_PTR - && TYPE_TARGET_TYPE (type) - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC)) + && TYPE_CODE (type) == TYPE_CODE_PTR) { - /* pointer to function */ unsigned long num; unsigned short snum; - snum = (unsigned short) extract_unsigned_integer (VALUE_CONTENTS_RAW (v), 2); - num = D10V_MAKE_IADDR (snum); - store_address (VALUE_CONTENTS_RAW (v), 4, num); - } - else if (GDB_TARGET_IS_D10V - && TYPE_CODE (type) == TYPE_CODE_PTR) - { - /* pointer to data */ - unsigned long num; - unsigned short snum; - snum = (unsigned short) extract_unsigned_integer (VALUE_CONTENTS_RAW (v), 2); - num = D10V_MAKE_DADDR (snum); + + snum = (unsigned short) + extract_unsigned_integer (VALUE_CONTENTS_RAW (v), 2); + + if (TYPE_TARGET_TYPE (type) /* pointer to function */ + && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC)) + num = D10V_MAKE_IADDR (snum); + else /* pointer to data */ + num = D10V_MAKE_DADDR (snum); + store_address (VALUE_CONTENTS_RAW (v), 4, num); }