From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29483 invoked by alias); 17 Jun 2003 15:40:29 -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 29456 invoked from network); 17 Jun 2003 15:40:28 -0000 Received: from unknown (HELO hub.ott.qnx.com) (209.226.137.76) by sources.redhat.com with SMTP; 17 Jun 2003 15:40:28 -0000 Received: from smtp.ott.qnx.com (smtp.ott.qnx.com [10.0.2.158]) by hub.ott.qnx.com (8.9.3p2/8.9.3) with ESMTP id LAA14228 for ; Tue, 17 Jun 2003 11:33:49 -0400 Received: from catdog ([10.4.2.2]) by smtp.ott.qnx.com (8.8.8/8.6.12) with SMTP id LAA04916 for ; Tue, 17 Jun 2003 11:40:27 -0400 Message-ID: <08c201c334e6$ccb8c750$0202040a@catdog> From: "Kris Warkentin" To: "Gdb-Patches@Sources.Redhat.Com" Subject: [Patch] arch recognition fix for osabi.c Date: Tue, 17 Jun 2003 15:40:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-SW-Source: 2003-06/txt/msg00562.txt.bz2 Here are some changes to osabi.c that allow gdb to recognize QNX binaries properly. The arch check change in gdbarch_init_osabi() allows the backend abi_init handlers to run. I believe the comment still stand - we will probably want to do something smarter in the future. The sniff change is only temporary. It works reasonably well for now and will probably stay for backwards compatability but we are also going to add a special .note section like others OSes in the future. Then we can check for both. cheers, Kris Changelog: * osabi.c (gdbarch_init_osabi): Just check arch for compatability rather identicality. (generic_elf_osabi_sniff_abi_tag_sections): Add check for QNX Neutrino binaries. Index: osabi.c =================================================================== RCS file: /cvs/src/src/gdb/osabi.c,v retrieving revision 1.15 diff -u -r1.15 osabi.c --- osabi.c 8 Jun 2003 18:27:14 -0000 1.15 +++ osabi.c 17 Jun 2003 15:32:53 -0000 @@ -311,8 +311,7 @@ type that is compatible with the desired machine type. Right now we simply return the first match, which is fine for now. However, we might want to do something smarter in the future. */ - compatible = arch_info->compatible (arch_info, handler->arch_info); - if (compatible == handler->arch_info) + if(arch_info->compatible (arch_info, handler->arch_info)) { (*handler->init_osabi) (info, gdbarch); return; @@ -430,6 +429,17 @@ necessary yet. */ *os_ident_ptr = GDB_OSABI_NETBSD_ELF; } + return; + } + + /* QNX Neutrino has ldqnx.so as its linker. */ + if (strcmp (name, ".interp") == 0 && sectsize > 0) + { + char *buf = alloca(sectsize); + bfd_get_section_contents(abfd, sect, buf, 0, sectsize); + buf[sectsize] = '\0'; /* Safety first boys and girls. */ + if(strstr(buf, "ldqnx.so")) + *os_ident_ptr = GDB_OSABI_QNXNTO; return; } }