From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3282 invoked by alias); 30 Apr 2009 16:48:24 -0000 Received: (qmail 3267 invoked by uid 22791); 30 Apr 2009 16:48:21 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 30 Apr 2009 16:48:15 +0000 Received: from wpaz37.hot.corp.google.com (wpaz37.hot.corp.google.com [172.24.198.101]) by smtp-out.google.com with ESMTP id n3UGm87e030394; Thu, 30 Apr 2009 09:48:08 -0700 Received: from localhost (elbrus.mtv.corp.google.com [172.18.118.100]) by wpaz37.hot.corp.google.com with ESMTP id n3UGm6iC001548; Thu, 30 Apr 2009 09:48:07 -0700 Received: by localhost (Postfix, from userid 74925) id 7DED819C4E1; Thu, 30 Apr 2009 09:48:06 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Frank Middleton Subject: [patch] Fix a buglet in elfread.c Message-Id: <20090430164806.7DED819C4E1@localhost> Date: Thu, 30 Apr 2009 16:48:00 -0000 From: ppluzhnikov@google.com (Paul Pluzhnikov) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-04/txt/msg00812.txt.bz2 Greetings, GDB appears to make unwarranted assumptions about presence of .data, .rodata in and ELF image. In http://sourceware.org/ml/gdb/2009-04/msg00228.html you can see an image on Solaris which has .rodata, but no .data, and this causes elfread.c:366: internal-error: sect_index_data not initialized when using /usr/lib/libXau.so.6 from Solaris snv103 (SunOS 5.11) for SPARC. Attached patch fixes that. OK? -- Paul Pluzhnikov 2009-04-30 Paul Pluzhnikov * elfread.c (elf_symtab_read): Don't assume .data and .rodata are present. Index: elfread.c =================================================================== RCS file: /cvs/src/src/gdb/elfread.c,v retrieving revision 1.76 diff -u -p -u -r1.76 elfread.c --- elfread.c 3 Jan 2009 05:57:51 -0000 1.76 +++ elfread.c 30 Apr 2009 15:03:41 -0000 @@ -427,10 +427,11 @@ elf_symtab_read (struct objfile *objfile int max_index; size_t size; - max_index - = max (SECT_OFF_BSS (objfile), - max (SECT_OFF_DATA (objfile), - SECT_OFF_RODATA (objfile))); + max_index = SECT_OFF_BSS (objfile); + if (objfile->sect_index_data > max_index) + max_index = objfile->sect_index_data; + if (objfile->sect_index_rodata > max_index) + max_index = objfile->sect_index_rodata; /* max_index is the largest index we'll use into this array, so we must