From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26223 invoked by alias); 28 Jun 2013 15:43:24 -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 26214 invoked by uid 89); 28 Jun 2013 15:43:23 -0000 X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 28 Jun 2013 15:43:23 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5SFhCuW018584 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 28 Jun 2013 11:43:12 -0400 Received: from barimba (ovpn-113-102.phx2.redhat.com [10.3.113.102]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r5SFh9Vp016718 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 28 Jun 2013 11:43:11 -0400 From: Tom Tromey To: Yao Qi Cc: 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> Date: Fri, 28 Jun 2013 15:58:00 -0000 In-Reply-To: <51CD0054.9040401@codesourcery.com> (Yao Qi's message of "Fri, 28 Jun 2013 11:17:40 +0800") Message-ID: <87ehbmkzqr.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-06/txt/msg00885.txt.bz2 >>>>> "Yao" == Yao Qi writes: Yao> + for (ix = 0; Yao> + VEC_iterate (msymbolp, name_prefix_imp, ix, msym_dll); Yao> + ix++) Yao> + { Yao> + const char *sname = SYMBOL_LINKAGE_NAME (msym_dll); Yao> + const char *name = (sname[1] == '_' ? &sname[7] : &sname[6]); Yao> + struct minimal_symbol *found Yao> + = prim_find_minimal_symbol (name); Yao> + Yao> + /* If found, there are symbols named "_imp_foo" and "foo" Yao> + respectively read in from the current objfile. Set the type Yao> + of symbol "foo" as 'mst_solib_trampoline'. */ Yao> + if (found != NULL && MSYMBOL_TYPE (found) == mst_text) Yao> + MSYMBOL_TYPE (found) = mst_solib_trampoline; It seems to me that it would be more efficient to keep a hash table of minsyms under construction, and then do this lookup when entering a new minsym. This would avoid repeated loops over all minsyms being defined. That is, if the new symbol is _imp_x, look up x. If the symbol is x, look up _imp_x. Then modify a symbol if needed. Tom