From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 82951 invoked by alias); 21 Nov 2019 03:32:04 -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 82938 invoked by uid 89); 21 Nov 2019 03:32:04 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.4 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_STOCKGEN autolearn=ham version=3.3.1 spammy=2102 X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 21 Nov 2019 03:32:02 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id EEDE320413; Wed, 20 Nov 2019 22:31:59 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id 650D320334; Wed, 20 Nov 2019 22:31:56 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 44A4C2816F; Wed, 20 Nov 2019 22:31:56 -0500 (EST) X-Gerrit-PatchSet: 3 Date: Thu, 21 Nov 2019 03:32:00 -0000 From: "Simon Marchi (Code Review)" To: Andrew Burgess , gdb-patches@sourceware.org Cc: Joel Brobecker , Christian Biesinger , Tom Tromey Auto-Submitted: auto-generated X-Gerrit-MessageType: comment Subject: [review v3] gdb: Introduce global_symbol_searcher X-Gerrit-Change-Id: I488ab292a892d9e9e84775c632c5f198b6ad3710 X-Gerrit-Change-Number: 264 X-Gerrit-ChangeURL: X-Gerrit-Commit: aae869090eb63acc233f0061fc9e8360b59faecf In-Reply-To: References: X-Gerrit-Comment-Date: Wed, 20 Nov 2019 22:31:55 -0500 Reply-To: gnutoolchain-gerrit@osci.io MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Content-Type: text/plain; charset=UTF-8 Message-Id: <20191121033156.44A4C2816F@gnutoolchain-gerrit.osci.io> X-SW-Source: 2019-11/txt/msg00640.txt.bz2 Simon Marchi has posted comments on this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/264 ...................................................................... Patch Set 3: (3 comments) Just marking the comments as resolved, as they have been addressed in patchset 3. | --- gdb/symtab.c | +++ gdb/symtab.c | @@ -4369,3 +4352,17 @@ file_matches (const char *file, const char *files[], int nfiles, int basenames) | - } | - else if (nfiles == 0) | +/* Compare FILE against all the entries of FILENAMES. If BASENAMES is | + non-zero compare only lbasename of FILENAMES. */ | + | +static bool | +file_matches (const char *file, const std::vector &filenames, | + bool basenames) | +{ | + if (filenames.size () == 0) PS1, Line 4359: > filenames.empty()? Done. | return 1; | + | + for (const char *name : filenames) | + { | + name = (basenames ? lbasename (name) : name); | + if (compare_filenames_for_search (file, name)) | + return 1; | + } | + ... | @@ -4466,15 +4446,20 @@ /* Search the symbol table for matches to the regular expression REGEXP, | - otherwise they are excluded. */ | +/* See symtab.h. */ | | std::vector | -search_symbols (const char *regexp, enum search_domain kind, | - const char *t_regexp, | - int nfiles, const char *files[], | - bool exclude_minsyms) | -{ | +search_symbols (const search_symbols_spec &search_spec) | +{ | + /* Unpack the search spec. */ | + const char *regexp = search_spec.symbol_regexp; | + enum search_domain kind = search_spec.kind; | + const char *t_regexp = search_spec.type_regexp; | + int nfiles = search_spec.filenames.size (); | + bool exclude_minsyms = search_spec.exclude_minsyms; PS1, Line 4456: > Did you consider making search_symbols a method of search_symbols_spec? Then this unpacking wouldn't be needed. Done. | + | + /* The search. */ | const struct blockvector *bv; | const struct block *b; | int i = 0; | struct block_iterator iter; | struct symbol *sym; | int found_misc = 0; | static const enum minimal_symbol_type types[] | --- gdb/symtab.h | +++ gdb/symtab.h | @@ -2073,0 +2085,27 @@ struct search_symbols_spec | + | + /* When this flag is false then minsyms that match SYMBOL_REGEXP will be | + included in the results, otherwise they are excluded. */ | + bool exclude_minsyms = false; | + | + /* The set of source files to search in for matching symbols. */ | + std::vector filenames; | + | + /* Constructor. */ | + search_symbols_spec (enum search_domain kind, | + const char *symbol_regexp = nullptr, | + const char *type_regexp = nullptr, | + bool exclude_minsyms = false) | + : kind (kind), | + symbol_regexp (symbol_regexp), | + type_regexp (type_regexp), | + exclude_minsyms (exclude_minsyms) | + { /* Nothing. */ } PS1, Line 2102: > This could gdb_assert (kind != ALL_DOMAIN) Done. | +}; | + | +/* Search the symbol table for matches as defined by SEARCH_SPEC. | + | + Within each file the results are sorted locally; each symtab's global | + and static blocks are separately alphabetized. Duplicate entries are | + removed. */ | + | +extern std::vector search_symbols -- Gerrit-Project: binutils-gdb Gerrit-Branch: master Gerrit-Change-Id: I488ab292a892d9e9e84775c632c5f198b6ad3710 Gerrit-Change-Number: 264 Gerrit-PatchSet: 3 Gerrit-Owner: Andrew Burgess Gerrit-Reviewer: Andrew Burgess Gerrit-Reviewer: Tom Tromey Gerrit-CC: Christian Biesinger Gerrit-CC: Joel Brobecker Gerrit-CC: Simon Marchi Gerrit-Comment-Date: Thu, 21 Nov 2019 03:31:55 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: Andrew Burgess Comment-In-Reply-To: Christian Biesinger Comment-In-Reply-To: Tom Tromey Comment-In-Reply-To: Simon Marchi Gerrit-MessageType: comment