From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18295 invoked by alias); 14 Jan 2005 17:10:48 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 18156 invoked from network); 14 Jan 2005 17:10:36 -0000 Received: from unknown (HELO miranda.se.axis.com) (193.13.178.2) by sourceware.org with SMTP; 14 Jan 2005 17:10:36 -0000 Received: from [10.92.19.1] (ironmaiden.se.axis.com [10.92.19.1]) by miranda.se.axis.com (8.12.9/8.12.9/Debian-5local0.1) with ESMTP id j0EHAWKm009434; Fri, 14 Jan 2005 18:10:32 +0100 Message-ID: <41E7FD09.4000002@axis.com> Date: Fri, 14 Jan 2005 17:10:00 -0000 From: Orjan Friberg Organization: Axis Communications User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913 MIME-Version: 1.0 To: gdb-patches@sources.redhat.com CC: Mark Kettenis , hans-peter.nilsson@axis.com Subject: Re: [CRIS] Reading core file selects "wrong" mach References: <41ADCE5B.5010001@axis.com> <200412021718.iB2HIK1Q004810@elgar.sibelius.xs4all.nl> In-Reply-To: <200412021718.iB2HIK1Q004810@elgar.sibelius.xs4all.nl> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005-01/txt/msg00154.txt.bz2 Mark Kettenis wrote: > I guess the correct way to do this would be adding > elf_set_mach_from_flags() to `struct elf_backend_data', and use that > in elf_core_file_p() to set the machine after the architecture has > been set. Maybe there's an easier way to do it - simply call the elf backend before processing the program headers, and have the backend set the correct machine like they all seem to do already. Since the decision of whether to act on the e_flags value is pushed to the elf backend I don't see how this could break anything (which I assume could happen if it was done in elf_core_file_p). (Of course, for this to have any effect in my particular case, e_flags must be set in the core file.) I understand this will have to be sent to the binutils mailing list for approval, but I'd appreciate if someone on this list could tell me if it's a sane solution. Oh, and no regressions on i386 and CRIS. 2005-01-14 Orjan Friberg * elfcore.h (elf_core_file_p): Move the call to elf_backend_object_p to allow the correct machine to be set before processing the program headers. Index: elfcore.h =================================================================== RCS file: /cvs/src/src/bfd/elfcore.h,v retrieving revision 1.20 diff -u -p -r1.20 elfcore.h --- elfcore.h 7 Aug 2003 08:38:09 -0000 1.20 +++ elfcore.h 14 Jan 2005 17:03:02 -0000 @@ -214,6 +214,15 @@ elf_core_file_p (bfd *abfd) goto fail; } + /* Let the backend double check the format and override global + information. We do this before processing the program headers + to allow the correct machine (as opposed to just the default + machine) to be set, making it possible for grok_prstatus and + grok_psinfo to rely on the mach setting. */ + if (ebd->elf_backend_object_p + && (! (*ebd->elf_backend_object_p) (abfd))) + goto wrong; + /* Process each program header. */ for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex) if (! bfd_section_from_phdr (abfd, i_phdrp + phindex, (int) phindex)) @@ -222,12 +231,6 @@ elf_core_file_p (bfd *abfd) /* Save the entry point from the ELF header. */ bfd_get_start_address (abfd) = i_ehdrp->e_entry; - /* Let the backend double check the format and override global - information. */ - if (ebd->elf_backend_object_p - && (! (*ebd->elf_backend_object_p) (abfd))) - goto wrong; - bfd_preserve_finish (abfd, &preserve); return abfd->xvec; -- Orjan Friberg Axis Communications