🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #276

GDB 3.2 on BIG_ENDIAN machines...

#276
From: Brad Davis
Date: Fri, 29 Sep 1989 13:36
34 lines
1316 bytes
Compiler: gcc1.35/gas1.34
CPU: 68020
Machine: ISI Optimum V16
OS: BSD4.3 4.0E

The following program gives a bogus (shifted up by 16 bits) value for
'a' when 'a' is printed by GDB.

foo1(short a)
{
	printf("%d\n", a);
}

main()
{
	foo1(4);
}

I traced the problem to 'read_inferior_memory' (and
'write_inferior_memory') in the bopy() call.  Since 'a' is a short
then the address passed to 'read_inferior..' is not the long word
address of 'a' but two bytes higher (the short word address).  A bcopy
is performed on the short word address, into a long word address,
causing the two short words to be swapped.

Swapping words fixed this but breaks other things.

The problem also exists with 'char' parameters and on Sun's and under
GDB 3.1.

This doesn't happen on SMALL_ENDIAN machines since the long word
address and the short word address are the same.

Brad Davis
Technical Details
Message-ID: <8909291336.AA16414@cai.utah.edu>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!ucbvax!tut.cis.ohio-state.edu!CS.UTAH.EDU!b-davis%cai

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!ucbvax!tut.cis.ohio-state.edu!CS.UTAH.EDU!b-davis%cai
From: b-davis%cai@CS.UTAH.EDU (Brad Davis)
Newsgroups: gnu.gdb.bug
Subject: GDB 3.2 on BIG_ENDIAN machines...
Message-ID: <8909291336.AA16414@cai.utah.edu>
Date: 29 Sep 89 13:36:27 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 34