From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12721 invoked by alias); 16 Oct 2011 07:58:39 -0000 Received: (qmail 12473 invoked by uid 22791); 16 Oct 2011 07:58:22 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,TW_BJ X-Spam-Check-By: sourceware.org Received: from ipmail05.adl6.internode.on.net (HELO ipmail05.adl6.internode.on.net) (150.101.137.143) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 16 Oct 2011 05:16:26 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhYCAGtomk520iBh/2dsb2JhbAAMNpoBkgYRQD0WGAMCAQIBWAYCAQGIA7UOiAgEpWM Received: from ppp118-210-32-97.lns20.adl2.internode.on.net (HELO [192.168.1.1]) ([118.210.32.97]) by ipmail05.adl6.internode.on.net with ESMTP; 16 Oct 2011 15:46:09 +1030 Message-ID: <4E9A6897.6030900@toojays.net> Date: Sun, 16 Oct 2011 07:58:00 -0000 From: John Steele Scott User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110922 Thunderbird/3.1.15 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [patch] PR symtab/13277: Resolving opaque structures in ICC generated binaries. Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 2011-10/txt/msg00440.txt.bz2 ICC does not set DW_AT_declaration on opaque structure declarations, so gdb will show such structures as "" unless executing code within the compilation unit which contains the complete declaration. However, ICC does set DW_AT_byte_size to zero on opaque declarations. This patch adds a check for DW_AT_byte_size == 0 with producer == ICC to allow gdb to resolve opaque structures in binaries which were built with ICC. See http://sourceware.org/bugzilla/show_bug.cgi?id=13277 for more details, including an example. Changelog: 2011-10-16 John Steele Scott PR symtab/13277: Resolving opaque structures in ICC generated binaries. * symtab.c (producer_is_icc): New function. * symtab.h (producer_is_icc): Declare. * dwarf2read.c (read_structure_type): Set TYPE_STUB on structures with a byte size of zero, if the binary was produced by ICC. --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -7636,6 +7636,11 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) /* RealView does not output the required DW_AT_declaration on incomplete types. */ TYPE_STUB (type) = 1; + else if (attr != NULL&& die->child == NULL&& TYPE_LENGTH (type) == 0 + && producer_is_icc (cu->producer)) + /* ICC does not output the required DW_AT_declaration + on incomplete types, but gives them a size of zero. */ + TYPE_STUB (type) = 1; /* We need to add the type field to the die immediately so we don't infinitely recurse when dealing with pointers to the structure diff --git a/gdb/symtab.c b/gdb/symtab.c index 9447bd9..ffaa035 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4806,6 +4806,20 @@ producer_is_realview (const char *producer) return 0; } +int +producer_is_icc (const char *producer) +{ + static const char *const icc_ident = "Intel(R) C Intel(R) 64 Compiler XE"; + + if (producer == NULL) + return 0; + + if (strncmp (producer, icc_ident, strlen (icc_ident)) == 0) + return 1; + + return 0; +} + void _initialize_symtab (void) { diff --git a/gdb/symtab.h b/gdb/symtab.h index 90a6fe4..987f199 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1302,6 +1302,10 @@ extern struct symtabs_and_lines expand_line_sal (struct symtab_and_line sal); compiler (armcc). */ int producer_is_realview (const char *producer); +/* Return 1 if the supplied producer string matches the Intel C/C++ + compiler (icc). */ +int producer_is_icc (const char *producer); + void fixup_section (struct general_symbol_info *ginfo, CORE_ADDR addr, struct objfile *objfile);