From: Thomas,Stephen <ste...@su...> - 2003-04-14 16:05:53
|
Hi Daniel, Thanks for your reply. What you suggest does appear to work, but I had = to do: gdb -c core file prog Using 'gdb -e prog -c core' (as suggested in the man page) doesn't work, = the file prog just gets ignored. But I think the core file ought to be correct if possible. Getting gdb = to generate the correct e_flags proved to be easy - they can be set in = the elf_backend_final_write_processing routine in the appropriate = elf<arch>.c. The kernel mod is also easy, it just means modifying = generic code. Thanks, Steve Thomas SuperH (UK) Ltd. -----Original Message----- From: Daniel Jacobowitz [mailto:dr...@fa...]=20 Sent: 14 April 2003 15:21 To: kaz Kojima Cc: Thomas,Stephen; McGoogan,Sean; = lin...@li...; lin...@m1...; = lin...@li... Subject: Re: [linux-sh:02691] Re: Use of e_flags field in ELF header On Mon, Apr 14, 2003 at 11:12:47PM +0900, kaz Kojima wrote: > Hi, >=20 > "Thomas,Stephen" <ste...@su...> wrote: > >Apparently, the e_flags field of the ELF Header structure in ELF=20 > >files is used by SH architectures to indicate the CPU type. The lower = > >5 bits have the following meaning: > > > > 0 =3D unknown CPU type > > 1 =3D SH1 > > 2 =3D SH2 > > 3 =3D SH3 > > 5 =3D SH3 with DSP > > 8 =3D SH3E > > 9 =3D SH4 > > 10 =3D SH5 > > > >The e_flags field is designed to hold architecture specific info, but = > >other architectures don't appear to use it in quite the same way,=20 > >i.e. to indicate different CPU types. > > > >Does anybody know why SH uses e_flags in this way? >=20 > I don't know why SH does so, but MIPS uses the upper 4 bits of e_flags = > to encode ISA. Perhaps there might be another examples. >=20 > >The problem I have is in generating & interpreting core files. When=20 > >the kernel (V2.4)generates an ELF core dump, it just sets e_flags to=20 > >0 (hard coded constant) & dumps it. So to get it to generate a valid=20 > >SH5 core dump, I need to modify generic code. There are similar=20 > >problems with the gdb 'gcore' command. >=20 > Your modification seems the right thing to do. Why is this an issue? If the core dump is marked "unknown", then the = ISA should be taken from the executable during a GDB session, and it = should do the right thing. --=20 Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer |