[PATCH] RS6000 and PowerPC CPU types
Andrew Cagney
ac131313@cygnus.com
Sun May 14 01:48:00 GMT 2000
Geoff Keating wrote:
> It is probably useful that if the user takes a binary which only runs
> on CPU type A, tries to run it on CPU type B, and runs gdb on the
> resulting core file, then gdb should not crash trying to read
> nonexistent registers :-).
>
> > >It is
> > >meaningless to try to match a CPU model with an object file,
> >
> > If the o_cputype field is set to something other than 0, then isn't it
> > likely that the object file is somehow specific to that CPU?
>
> Not really. I think MacOS sets it to 603 by default, for instance.
> In fact, if it is set to 0, that means 'old POWER'. 5, TCPU_ANY,
> means a mixture; 3, TCPU_COM, means the common subset of POWER and
> PowerPC. There doesn't seem to be a setting for 'uses 64-bit
> instructions but not running in 64-bit mode'.
>
> > >consider
> > >for instance an object file that contains code for bit-blitting and
> > >has six routines with identical behaviour but using different CPU
> > >features (like altivec and 64-bit instructions).
> >
> > In that case, the o_cputype field should be 0, in which case GDB would
> > choose the lowest common denominator.
>
> It would depend on what it is choosing it for. If it is doing
> disassembly, it needs to know about all the instructions, so that if
> the user gets a SIGILL the user knows which instruction he shouldn't
> be using. If it is displaying registers, it wants to display the
> registers that actually exist.
FYI,
The PowerPC et.al. architecture is, unfortunatly, clean in its design.
IBM managed to specify things early on.
A better ISA family to consider is the MIPS (....). With that, GDB
needs to know the exact target processor the binary is intended for, if
it is to have a fighting chance of doing things like disassembly and
registers correctly. Vendors have, unfortunatly, re-named / reused
instructions and register designations randomly.
It also needs to make heurestic guesses as to what the target will look
like (gain typically using the binary as a starting point).
Eventually GDB will obtain the target ISA from the target. In the mean
time, we keep guessing.
sigh,
Andrew
More information about the Binutils
mailing list