From patchwork Thu Jul 2 01:19:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 7466 Received: (qmail 85222 invoked by alias); 2 Jul 2015 01:21:07 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 85212 invoked by uid 89); 2 Jul 2015 01:21:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 02 Jul 2015 01:21:04 +0000 Received: from svr-orw-fem-06.mgc.mentorg.com ([147.34.97.120]) by relay1.mentorg.com with esmtp id 1ZATBV-0003AG-77 from Sandra_Loosemore@mentor.com ; Wed, 01 Jul 2015 18:21:01 -0700 Received: from [IPv6:::1] (147.34.91.1) by SVR-ORW-FEM-06.mgc.mentorg.com (147.34.97.120) with Microsoft SMTP Server id 14.3.224.2; Wed, 1 Jul 2015 18:21:00 -0700 Message-ID: <5594919A.6090701@codesourcery.com> Date: Wed, 1 Jul 2015 19:19:22 -0600 From: Sandra Loosemore User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: , Yao Qi Subject: [patch, nios2] fix _initialize_nios2_linux_tdep for BFD mach changes As a consequence of this patch https://sourceware.org/ml/binutils/2015-07/msg00015.html which introduced new BFD mach identifiers for Nios II R1 and R2 processor variants, BFD now identifies Nios II R1 objects as bfd_mach_nios2r1 instead of bfd_mach_nios2. This breaks the call to gdbarch_register_osabi, such that GDB fails to recognize R1 nios2-linux-gnu executables. Note that this is *not* due to any incompatible change in R1 ELF objects, just in BFD's internal representation of the mach values. I stole this fix verbatim from the MIPS back end so I consider it borderline obvious. I don't like to leave GDB in a broken state so I propose to commit this in a few days unless I hear objections meanwhile. The patches to add GDB support for Nios II R2 objects will be coming along later; this patch just un-breaks the existing support for R1. -Sandra diff --git a/gdb/nios2-linux-tdep.c b/gdb/nios2-linux-tdep.c index 0a837b0..68c949a 100644 --- a/gdb/nios2-linux-tdep.c +++ b/gdb/nios2-linux-tdep.c @@ -223,8 +223,14 @@ extern initialize_file_ftype _initialize_nios2_linux_tdep; void _initialize_nios2_linux_tdep (void) { - gdbarch_register_osabi (bfd_arch_nios2, 0, GDB_OSABI_LINUX, - nios2_linux_init_abi); + + const struct bfd_arch_info *arch_info; + + for (arch_info = bfd_lookup_arch (bfd_arch_nios2, 0); + arch_info != NULL; + arch_info = arch_info->next) + gdbarch_register_osabi (bfd_arch_nios2, arch_info->mach, + GDB_OSABI_LINUX, nios2_linux_init_abi); initialize_tdesc_nios2_linux (); }