From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6237 invoked by alias); 18 Jul 2013 03:26:49 -0000 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 Received: (qmail 6200 invoked by uid 89); 18 Jul 2013 03:26:49 -0000 X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_20,KAM_STOCKGEN,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RDNS_NONE,TW_BJ,TW_YM autolearn=no version=3.3.1 Received: from Unknown (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 18 Jul 2013 03:26:47 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1UzerY-0006Vs-4M from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Wed, 17 Jul 2013 20:26:40 -0700 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 17 Jul 2013 20:26:40 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.2.247.3; Wed, 17 Jul 2013 20:26:39 -0700 Message-ID: <51E76040.2030202@codesourcery.com> Date: Thu, 18 Jul 2013 03:26:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Subject: Re: [PATCH] Fix up msymbol type of dll trampoline to mst_solib_trampoline References: <1372043502-4618-1-git-send-email-yao@codesourcery.com> <874ncjmgkl.fsf@fleche.redhat.com> <51CD0054.9040401@codesourcery.com> <87ehbmkzqr.fsf@fleche.redhat.com> <51D36FB3.4070006@codesourcery.com> <87vc4igxq6.fsf@fleche.redhat.com> <51E74E2D.3040806@codesourcery.com> In-Reply-To: <51E74E2D.3040806@codesourcery.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-SW-Source: 2013-07/txt/msg00437.txt.bz2 On 07/18/2013 10:08 AM, Yao Qi wrote: > > Committed. > Forget to attach the patch. Here is it. -- Yao (齐尧) gdb: 2013-07-18 Yao Qi * coffread.c (coff_symfile_read): Iterate over minimal symbols, if the name is prefixed by "__imp_" or "_imp_", look for minimal symbol without prefix. If found, set its type to 'mst_solib_trampoline'. --- gdb/coffread.c | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/gdb/coffread.c b/gdb/coffread.c index bf39085..1402247 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -650,6 +650,35 @@ coff_symfile_read (struct objfile *objfile, int symfile_flags) install_minimal_symbols (objfile); + if (pe_file) + { + struct minimal_symbol *msym; + + ALL_OBJFILE_MSYMBOLS (objfile, msym) + { + const char *name = SYMBOL_LINKAGE_NAME (msym); + + /* If the minimal symbols whose name are prefixed by "__imp_" + or "_imp_", get rid of the prefix, and search the minimal + symbol in OBJFILE. Note that 'maintenance print msymbols' + shows that type of these "_imp_XXXX" symbols is mst_data. */ + if (MSYMBOL_TYPE (msym) == mst_data + && (strncmp (name, "__imp_", 6) == 0 + || strncmp (name, "_imp_", 5) == 0)) + { + const char *name1 = (name[1] == '_' ? &name[7] : &name[6]); + struct minimal_symbol *found; + + found = lookup_minimal_symbol (name1, NULL, objfile); + /* If found, there are symbols named "_imp_foo" and "foo" + respectively in OBJFILE. Set the type of symbol "foo" + as 'mst_solib_trampoline'. */ + if (found != NULL && MSYMBOL_TYPE (found) == mst_text) + MSYMBOL_TYPE (found) = mst_solib_trampoline; + } + } + } + /* Free the installed minimal symbol data. */ do_cleanups (cleanup_minimal_symbols); -- 1.7.7.6