Article View: gnu.gdb.bug
Article #10133WORDS_BIG_ENDIAN bug in findvar.c
From: "Bill Bailey"
Date: Tue, 05 Jun 1990 21:43
Date: Tue, 05 Jun 1990 21:43
59 lines
2840 bytes
2840 bytes
I am engaged in porting gdb to the Ncube series of processors. So far,
everything is generally going well. Here is a probable bug I believe I have
discovered in the portable code.
On Ncube, all registers are 64 bits. The machine uses BYTES_BIG_ENDIAN and
WORDS_LITTLE_ENDIAN. The bug arises when I ask gdb to print an "int" automatic
variable which just happens to be in a register. value_from_regiser() offsets
incorrectly into the virtual_buffer holding the register bytes .
Note the bug would not surface if the machine were WORDS_BIG_ENDIAN which is
why it does not happen on the convex port. Incidentally, gcc defines convex
to be WORDS_LITTLE_ENDIAN which is inconsistent from the way gdb defines
things. I do not know who is right.
thanks
--bill
===================================================================
RCS file: /rcs/cvs/gnu/gdb/findvar.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 findvar.c
*** /tmp/,RCSt1a00174 Tue Jun 5 14:41:45 1990
--- findvar.c Tue Jun 5 14:22:03 1990
***************
*** 484,495 ****
/* Raw and virtual formats are the same for this register. */
#ifdef BYTES_BIG_ENDIAN
if (len < REGISTER_RAW_SIZE (regnum))
{
/* Big-endian, and we want less than full size. */
VALUE_OFFSET (v) = REGISTER_RAW_SIZE (regnum) - len;
}
! #endif
bcopy (virtual_buffer + VALUE_OFFSET (v),
VALUE_CONTENTS (v), len);
--- 484,503 ----
/* Raw and virtual formats are the same for this register. */
#ifdef BYTES_BIG_ENDIAN
+ # ifdef WORDS_BIG_ENDIAN
if (len < REGISTER_RAW_SIZE (regnum))
{
/* Big-endian, and we want less than full size. */
VALUE_OFFSET (v) = REGISTER_RAW_SIZE (regnum) - len;
}
! # else
! if (len < REGISTER_RAW_SIZE (regnum) && len < sizeof (long))
! {
! /* Big-endian, and we want less than full size. */
! VALUE_OFFSET (v) = sizeof (long) - len;
! }
! # endif /* WORDS_BIG_ENDIAN */
! #endif /* BYTES_BIG_ENDIAN */
bcopy (virtual_buffer + VALUE_OFFSET (v),
VALUE_CONTENTS (v), len);
Technical Details
Message-ID:
<9006052143.AA00179@hqsun7.oracle.com>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!hqsun7.oracle.com!WBAILEY.US1.oramailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,cbf7dc0a2803b533,start
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 1990-06-05 15:37:55 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!hqsun7.oracle.com!WBAILEY.US1.oramail
From: WBAILEY.US1.oramail@hqsun7.oracle.com ("Bill Bailey")
Newsgroups: gnu.gdb.bug
Subject: WORDS_BIG_ENDIAN bug in findvar.c
Message-ID: <9006052143.AA00179@hqsun7.oracle.com>
Date: 5 Jun 90 21:43:50 GMT
Sender: daemon@tut.cis.ohio-state.edu
Reply-To: wbailey@oracle.com
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 59
Posted: Tue Jun 5 22:43:50 1990