From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40077 invoked by alias); 2 Jun 2017 12:30:39 -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 30302 invoked by uid 89); 2 Jun 2017 12:30:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.8 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_STOCKGEN,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 02 Jun 2017 12:29:54 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4B7EC80F95 for ; Fri, 2 Jun 2017 12:23:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4B7EC80F95 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4B7EC80F95 Received: from cascais.lan (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB5065C549 for ; Fri, 2 Jun 2017 12:22:59 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 20/40] Eliminate block_iter_name_* Date: Fri, 02 Jun 2017 12:30:00 -0000 Message-Id: <1496406158-12663-21-git-send-email-palves@redhat.com> In-Reply-To: <1496406158-12663-1-git-send-email-palves@redhat.com> References: <1496406158-12663-1-git-send-email-palves@redhat.com> X-SW-Source: 2017-06/txt/msg00039.txt.bz2 This patch gets rid of block_iter_name_* as being unnecessary. It's the same as calling block_iter_match_*, and passing strcmp_iw as comparison routine. (A later patch will get rid of those new explicit strcmp_iw calls.) gdb/ChangeLog: yyyy-mm-dd Pedro Alves * block.c (block_iter_name_step, block_iter_name_first) (block_iter_name_next): Delete. (block_lookup_symbol_primary): Adjust to use dict_iter_match_first/dict_iter_match_next. * block.h (block_iter_name_first, block_iter_name_next): Delete declarations. (ALL_BLOCK_SYMBOLS_WITH_NAME): Adjust to use dict_iter_match_first/dict_iter_match_next. --- gdb/block.c | 73 ++------------------------------------------------------ gdb/block.h | 24 +++---------------- gdb/dictionary.c | 14 ----------- gdb/dictionary.h | 19 --------------- 4 files changed, 5 insertions(+), 125 deletions(-) diff --git a/gdb/block.c b/gdb/block.c index 2f44460..1c343aa 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -589,75 +589,6 @@ block_iterator_next (struct block_iterator *iterator) return block_iterator_step (iterator, 0); } -/* Perform a single step for a "name" block iterator, iterating across - symbol tables as needed. Returns the next symbol, or NULL when - iteration is complete. */ - -static struct symbol * -block_iter_name_step (struct block_iterator *iterator, const char *name, - int first) -{ - struct symbol *sym; - - gdb_assert (iterator->which != FIRST_LOCAL_BLOCK); - - while (1) - { - if (first) - { - struct compunit_symtab *cust - = find_iterator_compunit_symtab (iterator); - const struct block *block; - - /* Iteration is complete. */ - if (cust == NULL) - return NULL; - - block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), - iterator->which); - sym = dict_iter_name_first (BLOCK_DICT (block), name, - &iterator->dict_iter); - } - else - sym = dict_iter_name_next (name, &iterator->dict_iter); - - if (sym != NULL) - return sym; - - /* We have finished iterating the appropriate block of one - symtab. Now advance to the next symtab and begin iteration - there. */ - ++iterator->idx; - first = 1; - } -} - -/* See block.h. */ - -struct symbol * -block_iter_name_first (const struct block *block, - const char *name, - struct block_iterator *iterator) -{ - initialize_block_iterator (block, iterator); - - if (iterator->which == FIRST_LOCAL_BLOCK) - return dict_iter_name_first (block->dict, name, &iterator->dict_iter); - - return block_iter_name_step (iterator, name, 1); -} - -/* See block.h. */ - -struct symbol * -block_iter_name_next (const char *name, struct block_iterator *iterator) -{ - if (iterator->which == FIRST_LOCAL_BLOCK) - return dict_iter_name_next (name, &iterator->dict_iter); - - return block_iter_name_step (iterator, name, 0); -} - /* Perform a single step for a "match" block iterator, iterating across symbol tables as needed. Returns the next symbol, or NULL when iteration is complete. */ @@ -812,9 +743,9 @@ block_lookup_symbol_primary (const struct block *block, const char *name, || BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL); other = NULL; - for (sym = dict_iter_name_first (block->dict, name, &dict_iter); + for (sym = dict_iter_match_first (block->dict, name, strcmp_iw, &dict_iter); sym != NULL; - sym = dict_iter_name_next (name, &dict_iter)) + sym = dict_iter_match_next (name, strcmp_iw, &dict_iter)) { if (SYMBOL_DOMAIN (sym) == domain) return sym; diff --git a/gdb/block.h b/gdb/block.h index eeb5ed4..1741e52 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -237,25 +237,6 @@ extern struct symbol *block_iterator_first (const struct block *block, extern struct symbol *block_iterator_next (struct block_iterator *iterator); /* Initialize ITERATOR to point at the first symbol in BLOCK whose - SYMBOL_SEARCH_NAME is NAME (as tested using strcmp_iw), and return - that first symbol, or NULL if there are no such symbols. */ - -extern struct symbol *block_iter_name_first (const struct block *block, - const char *name, - struct block_iterator *iterator); - -/* Advance ITERATOR to point at the next symbol in BLOCK whose - SYMBOL_SEARCH_NAME is NAME (as tested using strcmp_iw), or NULL if - there are no more such symbols. Don't call this if you've - previously received NULL from block_iterator_first or - block_iterator_next on this iteration. And don't call it unless - ITERATOR was created by a previous call to block_iter_name_first - with the same NAME. */ - -extern struct symbol *block_iter_name_next (const char *name, - struct block_iterator *iterator); - -/* Initialize ITERATOR to point at the first symbol in BLOCK whose SYMBOL_SEARCH_NAME is NAME, as tested using COMPARE (which must use the same conventions as strcmp_iw and be compatible with any block hashing function), and return that first symbol, or NULL @@ -340,8 +321,9 @@ extern int block_find_non_opaque_type_preferred (struct symbol *sym, must be a struct block_iterator. SYM points to the current symbol. */ #define ALL_BLOCK_SYMBOLS_WITH_NAME(block, name, iter, sym) \ - for ((sym) = block_iter_name_first ((block), (name), &(iter)); \ + for ((sym) = block_iter_match_first ((block), (name), \ + strcmp_iw, &(iter)); \ (sym) != NULL; \ - (sym) = block_iter_name_next ((name), &(iter))) + (sym) = block_iter_match_next ((name), strcmp_iw, &(iter))) #endif /* BLOCK_H */ diff --git a/gdb/dictionary.c b/gdb/dictionary.c index e78db2e..b2cfca2 100644 --- a/gdb/dictionary.c +++ b/gdb/dictionary.c @@ -530,20 +530,6 @@ dict_iterator_next (struct dict_iterator *iterator) } struct symbol * -dict_iter_name_first (const struct dictionary *dict, - const char *name, - struct dict_iterator *iterator) -{ - return dict_iter_match_first (dict, name, strcmp_iw, iterator); -} - -struct symbol * -dict_iter_name_next (const char *name, struct dict_iterator *iterator) -{ - return dict_iter_match_next (name, strcmp_iw, iterator); -} - -struct symbol * dict_iter_match_first (const struct dictionary *dict, const char *name, symbol_compare_ftype *compare, struct dict_iterator *iterator) diff --git a/gdb/dictionary.h b/gdb/dictionary.h index 124fc98..4f4f160 100644 --- a/gdb/dictionary.h +++ b/gdb/dictionary.h @@ -123,25 +123,6 @@ extern struct symbol *dict_iterator_first (const struct dictionary *dict, extern struct symbol *dict_iterator_next (struct dict_iterator *iterator); /* Initialize ITERATOR to point at the first symbol in DICT whose - SYMBOL_SEARCH_NAME is NAME (as tested using strcmp_iw), and return - that first symbol, or NULL if there are no such symbols. */ - -extern struct symbol *dict_iter_name_first (const struct dictionary *dict, - const char *name, - struct dict_iterator *iterator); - -/* Advance ITERATOR to point at the next symbol in DICT whose - SYMBOL_SEARCH_NAME is NAME (as tested using strcmp_iw), or NULL if - there are no more such symbols. Don't call this if you've - previously received NULL from dict_iterator_first or - dict_iterator_next on this iteration. And don't call it unless - ITERATOR was created by a previous call to dict_iter_name_first - with the same NAME. */ - -extern struct symbol *dict_iter_name_next (const char *name, - struct dict_iterator *iterator); - -/* Initialize ITERATOR to point at the first symbol in DICT whose SYMBOL_SEARCH_NAME is NAME, as tested using COMPARE (which must use the same conventions as strcmp_iw and be compatible with any dictionary hashing function), and return that first symbol, or NULL -- 2.5.5