From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16686 invoked by alias); 24 May 2012 22:16:48 -0000 Received: (qmail 16674 invoked by uid 22791); 24 May 2012 22:16:46 -0000 X-SWARE-Spam-Status: No, hits=-5.5 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,TW_BJ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 24 May 2012 22:16:31 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4OMGA1K028017 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 24 May 2012 18:16:10 -0400 Received: from host2.jankratochvil.net (ovpn-116-78.ams2.redhat.com [10.36.116.78]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q4OMG43Q027045 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 24 May 2012 18:16:07 -0400 Date: Thu, 24 May 2012 22:16:00 -0000 From: Jan Kratochvil To: John Steele Scott Cc: Tom Tromey , gdb-patches@sourceware.org, Joel Brobecker Subject: [commit TYPE_OPAQUE] [patch] PR symtab/13277: Resolving opaque structures in ICC generated binaries. Message-ID: <20120524221603.GC516@host2.jankratochvil.net> References: <20111026221057.GA24628@host1.jankratochvil.net> <4EBFB451.8030503@toojays.net> <4FA4912E.9050709@toojays.net> <20120512183722.GA20606@host2.jankratochvil.net> <4FB10DD8.7040501@toojays.net> <20120518144642.GA19690@host2.jankratochvil.net> <4FB8E4BD.6000501@toojays.net> <20120520130919.GA6990@host2.jankratochvil.net> <20120520131719.GB7416@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120520131719.GB7416@host2.jankratochvil.net> User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2012-05/txt/msg00951.txt.bz2 On Sun, 20 May 2012 15:17:19 +0200, Jan Kratochvil wrote: > sorry I did not write a proper reproducer + testcase for it but I believe the > attached patch should fix it. It is probably a regression since introduction > of quick_symbol_functions. Added a testcase. Added new method comment. Checked in. Thanks, Jan http://sourceware.org/ml/gdb-cvs/2012-05/msg00187.html --- src/gdb/ChangeLog 2012/05/24 22:09:18 1.14293 +++ src/gdb/ChangeLog 2012/05/24 22:14:35 1.14294 @@ -1,3 +1,10 @@ +2012-05-24 Jan Kratochvil + + * psymtab.c (lookup_symbol_aux_psymtabs): New variable stab_best. Use + it as a fallback for TYPE_IS_OPAQUE. + * symfile.h (struct quick_symbol_functions): Mention TYPE_OPAQUE + symbols for lookup_symbol. + 2012-05-24 John Steele Scott PR symtab/13277: Resolving opaque structures in ICC generated binaries. --- src/gdb/testsuite/ChangeLog 2012/05/24 22:09:21 1.3206 +++ src/gdb/testsuite/ChangeLog 2012/05/24 22:14:35 1.3207 @@ -1,3 +1,8 @@ +2012-05-24 Jan Kratochvil + + * gdb.dwarf2/dw2-icc-opaque.S: Add debug_info_seg3 and + .debug_abbrev_seg3. + 2012-05-24 John Steele Scott PR symtab/13277: Resolving opaque structures in ICC generated binaries. --- src/gdb/psymtab.c 2012/05/18 14:26:26 1.46 +++ src/gdb/psymtab.c 2012/05/24 22:14:35 1.47 @@ -510,6 +510,7 @@ { struct partial_symtab *ps; const int psymtab_index = (block_index == GLOBAL_BLOCK ? 1 : 0); + struct symtab *stab_best = NULL; ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, ps) { @@ -530,13 +531,18 @@ } if (sym && strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0) - return stab; + { + if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym))) + return stab; + + stab_best = stab; + } /* Keep looking through other psymtabs. */ } } - return NULL; + return stab_best; } /* Look in PST for a symbol in DOMAIN whose name matches NAME. Search --- src/gdb/symfile.h 2012/04/28 23:22:13 1.108 +++ src/gdb/symfile.h 2012/05/24 22:14:35 1.109 @@ -182,7 +182,9 @@ indicates what sort of symbol to search for. Returns the newly-expanded symbol table in which the symbol is - defined, or NULL if no such symbol table exists. */ + defined, or NULL if no such symbol table exists. If OBJFILE + contains !TYPE_OPAQUE symbol prefer its symtab. If it contains + only TYPE_OPAQUE symbol(s), return at least that symtab. */ struct symtab *(*lookup_symbol) (struct objfile *objfile, int kind, const char *name, domain_enum domain); --- src/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.S 2012/05/24 22:09:21 1.1 +++ src/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.S 2012/05/24 22:14:36 1.2 @@ -205,3 +205,54 @@ .byte 0x08 /* DW_FORM_string. */ .2byte 0x0000 /* End abbrev. */ .byte 0x00 /* End abbrev table. */ + + + .file "opaque-pointer2.c" + + .section .debug_info + .align 1 +debug_info_seg3: + .4byte debug_info_seg3_end - 1f /* Length of compilation unit info. */ +1: + .2byte 0x0002 /* DWARF version number. */ + .4byte .debug_abbrev_seg3 /* Points to abbrev section for this unit. */ + .byte 0x04 /* Target address size. */ + + .byte 0x01 /* DIE 1: DW_TAG_compile_unit. */ + .byte 0x01 /* DW_AT_language = DW_LANG_C89. */ + .ascii "Intel(R) C Intel(R) 64 Compiler XE " /* DW_AT_producer. */ + .ascii "for applications running on Intel(R) 64, " + .ascii "Version 12.0.4.191 Build 20110427\n " + .asciz "Fixes SameLinkageName MemberPointers" + + .byte 0x04 /* DIE 4: DW_TAG_structure_type. */ + .byte 0x01 /* DW_AT_accessibility. */ + .byte 0x00 /* DW_AT_byte_size. */ + .asciz "opaque_struct_t" /* DW_AT_name. */ + + .byte 0x00 /* End DIE 1. */ +debug_info_seg3_end: + + .section .debug_abbrev +.debug_abbrev_seg3: + .align 1 + .byte 0x01 /* Abbrev 1. */ + .byte 0x11 /* DW_TAG_compile_unit. */ + .byte 0x01 /* DW_CHILDREN_yes. */ + .byte 0x13 /* DW_AT_language. */ + .byte 0x0b /* DW_FORM_data1. */ + .byte 0x25 /* DW_AT_producer. */ + .byte 0x08 /* DW_AT_string. */ + .2byte 0x0000 /* End abbrev. */ + + .byte 0x04 /* Abbrev 4. */ + .byte 0x13 /* DW_TAG_structure_type. */ + .byte 0x00 /* DW_CHILDREN_no. */ + .byte 0x32 /* DW_AT_accessibility. */ + .byte 0x0b /* DW_FORM_data1. */ + .byte 0x0b /* DW_AT_byte_size. */ + .byte 0x0b /* DW_FORM_data1. */ + .byte 0x03 /* DW_AT_name. */ + .byte 0x08 /* DW_FORM_string. */ + .2byte 0x0000 /* End abbrev. */ + .byte 0x00 /* End abbrev table. */