[gnu.gdb.bug] GDB 3.2 on BIG_ENDIAN machines...

b-davis%cai@CS.UTAH.EDU (Brad Davis) (09/29/89)

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