From patchwork Tue May 15 00:10:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weimin Pan X-Patchwork-Id: 27266 Received: (qmail 116159 invoked by alias); 15 May 2018 00:11:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 116019 invoked by uid 89); 15 May 2018 00:11:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, UNPARSEABLE_RELAY autolearn=ham version=3.3.2 spammy=Pan X-HELO: aserp2130.oracle.com Received: from aserp2130.oracle.com (HELO aserp2130.oracle.com) (141.146.126.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 May 2018 00:11:09 +0000 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4F07LO8180795 for ; Tue, 15 May 2018 00:11:05 GMT Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2130.oracle.com with ESMTP id 2hxpvcmu5u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 15 May 2018 00:11:05 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w4F0B5fw004920 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 15 May 2018 00:11:05 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w4F0B5pP010102 for ; Tue, 15 May 2018 00:11:05 GMT Received: from localhost.us.oracle.com (/10.211.15.129) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 14 May 2018 17:11:05 -0700 From: Weimin Pan To: gdb-patches@sourceware.org Subject: [PATCH] Removing lookup_minimal_symbol_and_objfile Date: Tue, 15 May 2018 00:10:59 +0000 Message-Id: <1526343059-25143-1-git-send-email-weimin.pan@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8893 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805140236 Removing lookup_minimal_symbol_and_objfile and replacing it with lookup_bound_minimal_symbol. lookup_minimal_symbol_and_objfile only searches ordinary hash table for the minimal symbol entry while lookup_bound_minimal_symbol does both ordinary hash table and demangled hash table for the entry. Tested in both aarch64-linux-gnu and amd64-linux-gnu. No regressions. --- gdb/ChangeLog | 10 ++++++++++ gdb/coff-pe-read.c | 4 ++-- gdb/glibc-tdep.c | 2 +- gdb/jit.c | 2 +- gdb/minsyms.c | 18 ------------------ gdb/minsyms.h | 5 ----- gdb/printcmd.c | 2 +- 7 files changed, 15 insertions(+), 28 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f91a976..6f4153b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2018-05-14 Weimin Pan + + * minsyms.h (lookup_minimal_symbol_and_objfile): Remove declaration. + * minsyms.c (lookup_minimal_symbol_and_objfile): Remove definition. + * coff-pe-read.c (add_pe_forwarded_sym): Replace + lookup_minimal_symbol_and_objfile with lookup_bound_minimal_symbol. + * glibc-tdep.c (glibc_skip_solib_resolver): Likewise. + * jit.c (jit_breakpoint_re_set_internal): Likewise. + * printcmd.c (info_address_command): Likewise. + 2018-05-04 Tom Tromey PR python/22730: diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c index 3f89977..615cc8e 100644 --- a/gdb/coff-pe-read.c +++ b/gdb/coff-pe-read.c @@ -219,7 +219,7 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader, forward_func_name); - msymbol = lookup_minimal_symbol_and_objfile (forward_qualified_name); + msymbol = lookup_bound_minimal_symbol (forward_qualified_name); if (!msymbol.minsym) { @@ -227,7 +227,7 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader, for (i = 0; i < forward_dll_name_len; i++) forward_qualified_name[i] = tolower (forward_qualified_name[i]); - msymbol = lookup_minimal_symbol_and_objfile (forward_qualified_name); + msymbol = lookup_bound_minimal_symbol (forward_qualified_name); } if (!msymbol.minsym) diff --git a/gdb/glibc-tdep.c b/gdb/glibc-tdep.c index 481e4b8..485cd8b 100644 --- a/gdb/glibc-tdep.c +++ b/gdb/glibc-tdep.c @@ -54,7 +54,7 @@ glibc_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) debugging programs that use shared libraries. */ struct bound_minimal_symbol resolver - = lookup_minimal_symbol_and_objfile ("_dl_runtime_resolve"); + = lookup_bound_minimal_symbol ("_dl_runtime_resolve"); if (resolver.minsym) { diff --git a/gdb/jit.c b/gdb/jit.c index 8cd645c..e6b3cc2 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -1041,7 +1041,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, { /* Lookup the registration symbol. If it is missing, then we assume we are not attached to a JIT. */ - reg_symbol = lookup_minimal_symbol_and_objfile (jit_break_name); + reg_symbol = lookup_bound_minimal_symbol (jit_break_name); if (reg_symbol.minsym == NULL || BMSYMBOL_VALUE_ADDRESS (reg_symbol) == 0) return 1; diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 496dba0..6545cd2 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -990,24 +990,6 @@ static const struct gnu_ifunc_fns stub_gnu_ifunc_fns = const struct gnu_ifunc_fns *gnu_ifunc_fns_p = &stub_gnu_ifunc_fns; -/* See minsyms.h. */ - -struct bound_minimal_symbol -lookup_minimal_symbol_and_objfile (const char *name) -{ - struct bound_minimal_symbol result; - struct objfile *objfile; - - ALL_OBJFILES (objfile) - { - result = lookup_minimal_symbol (name, NULL, objfile); - if (result.minsym != NULL) - return result; - } - - memset (&result, 0, sizeof (result)); - return result; -} /* Return leading symbol character for a BFD. If BFD is NULL, diff --git a/gdb/minsyms.h b/gdb/minsyms.h index 40e69ae..f6799ef 100644 --- a/gdb/minsyms.h +++ b/gdb/minsyms.h @@ -202,11 +202,6 @@ struct bound_minimal_symbol lookup_minimal_symbol (const char *, struct bound_minimal_symbol lookup_bound_minimal_symbol (const char *); -/* Find the minimal symbol named NAME, and return both the minsym - struct and its objfile. */ - -struct bound_minimal_symbol lookup_minimal_symbol_and_objfile (const char *); - /* Look through all the current minimal symbol tables and find the first minimal symbol that matches NAME and has text type. If OBJF is non-NULL, limit the search to that objfile. Returns a bound diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 4696373..8651c5e 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1557,7 +1557,7 @@ info_address_command (const char *exp, int from_tty) { struct bound_minimal_symbol msym; - msym = lookup_minimal_symbol_and_objfile (SYMBOL_LINKAGE_NAME (sym)); + msym = lookup_bound_minimal_symbol (SYMBOL_LINKAGE_NAME (sym)); if (msym.minsym == NULL) printf_filtered ("unresolved"); else