Subject: gdb on m68k
To: None <port-m68k@sun-lamp.cs.berkeley.edu, core@sun-lamp.cs.berkeley.edu>
From: Paul Mackerras <Paul.Mackerras@cs.anu.edu.au>
List: port-m68k
Date: 09/14/1994 14:10:36
Has anybody tried using GDB on any of the m68k ports lately?
When I tried, I got a message like "Error reading register pc (#17):
Invalid operation".

Further investigation showed that this was because of the check in the
code for the PT_READ_U function of ptrace that the address specified is
a multiple of 4.  It turns out that the p_md field of the proc
structure is at a 4n+2 offset on m68k machines, which means that GDB
gets an error reading u.u_ar0.  Also, the pc in the stack frame
is at a 4n+2 offset relative to the other registers.

So I commented out the check that the address is a multiple of 4, for
both the PT_READ_U and PT_WRITE_U functions in kern/sys_process.c, and
GDB now appears to work.  I don't really see any way to fix the
problem, other than removing the alignment checks.  I reckon that we
need a cpp symbol defined somewhere to say whether the machine can do
unaligned accesses.  Then we could use that to disable the alignment
checks.