[CRIS] Reading core file selects "wrong" mach

Orjan Friberg orjan.friberg@axis.com
Wed Dec 1 14:00:00 GMT 2004

When reading a CRISv32 Linux core file, the "wrong" mach is selected, causing 
cris_elf_grok_prstatus to not find the general-purpose registers (because unlike 
other ports it actually checks bfd_get_mach (abfd)).

The reason seems to be the call to bfd_default_set_arch_mach (abfd, ebd->arch, 
0) in elf_core_file_p in elfcore.h which will select the default mach for that 
arch.  Directly after this we start reading the core file which results in a 
call to cris_elf_grok_prstatus (which fails because the default mach doesn't 
match the current mach).

Is there an implicit assumption that the mach is not to be trusted when reading 
a core file?

(For reference: e_flags, checked in set_mach_from_flags, is hardcoded to 0 in 
the Linux kernel, but setting it correctly (to EF_CRIS_VARIANT_V32 in this case) 
wouldn't change a thing because of the above.)

Orjan Friberg
Axis Communications

More information about the Gdb-patches mailing list