From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64972 invoked by alias); 20 Nov 2017 03:17:15 -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 64963 invoked by uid 89); 20 Nov 2017 03:17:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KB_WAM_FROM_NAME_SINGLEWORD,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 Nov 2017 03:17:13 +0000 Received: from [10.0.0.11] (192-222-251-162.qc.cable.ebox.net [192.222.251.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 52A031E4C4; Sun, 19 Nov 2017 22:17:12 -0500 (EST) Subject: Re: [PATCH 3/3] Fix mapped_index::find_name_components_bounds upper bound computation To: Pedro Alves , gdb-patches@sourceware.org References: <5d721d13-d886-0400-db6b-76485c545142@redhat.com> <1511138515-25996-3-git-send-email-palves@redhat.com> From: Simon Marchi Message-ID: <44cc0989-d075-51fc-298b-bdaf227131a8@simark.ca> Date: Mon, 20 Nov 2017 03:17:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <1511138515-25996-3-git-send-email-palves@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-11/txt/msg00391.txt.bz2 On 2017-11-19 07:41 PM, Pedro Alves wrote: > Here we want to find where we'd insert "after", so we want > std::lower_bound, not std::upper_bound. > > gdb/ChangeLog: > yyyy-mm-dd Pedro Alves > > * dwarf2read.c (mapped_index::find_name_components_bounds) > : Use std::lower_bound instead of > std::upper_bound. > (test_mapped_index_find_name_component_bounds): Remove incorrect > "t1_fund" from expected symbols. > --- > gdb/dwarf2read.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c > index 53548ca..c4d1254 100644 > --- a/gdb/dwarf2read.c > +++ b/gdb/dwarf2read.c > @@ -4319,8 +4319,8 @@ mapped_index::find_name_components_bounds > std::string after = make_sort_after_prefix_name (cplus); > if (after.empty ()) > return end; > - return std::upper_bound (lower, end, after.c_str (), > - lookup_compare_upper); > + return std::lower_bound (lower, end, after.c_str (), > + lookup_compare_lower); > } > else > return std::upper_bound (lower, end, cplus, lookup_compare_upper); > @@ -4659,7 +4659,6 @@ test_mapped_index_find_name_component_bounds () > static const char *expected_syms[] = { > "t1_func", > "t1_func1", > - "t1_fund", /* This one's incorrect. */ > }; > > SELF_CHECK (check_find_bounds_finds (mock_index.index (), > LGTM.