This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix mapped_index::find_name_components_bounds upper bound computation


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e6b2f5efa97c7f3de8a3947c6782c40ec6172686

commit e6b2f5efa97c7f3de8a3947c6782c40ec6172686
Author: Pedro Alves <palves@redhat.com>
Date:   Tue Nov 21 00:02:46 2017 +0000

    Fix mapped_index::find_name_components_bounds upper bound computation
    
    Here we want to find where we'd insert "after", so we want
    std::lower_bound, not std::upper_bound.
    
    gdb/ChangeLog:
    2017-11-21  Pedro Alves  <palves@redhat.com>
    
    	* dwarf2read.c (mapped_index::find_name_components_bounds)
    	<completion mode, upper bound>: Use std::lower_bound instead of
    	std::upper_bound.
    	(test_mapped_index_find_name_component_bounds): Remove incorrect
    	"t1_fund" from expected symbols.

Diff:
---
 gdb/ChangeLog    | 8 ++++++++
 gdb/dwarf2read.c | 5 ++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 196abc9..d3b7b42 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
 2017-11-21  Pedro Alves  <palves@redhat.com>
 
+	* dwarf2read.c (mapped_index::find_name_components_bounds)
+	<completion mode, upper bound>: Use std::lower_bound instead of
+	std::upper_bound.
+	(test_mapped_index_find_name_component_bounds): Remove incorrect
+	"t1_fund" from expected symbols.
+
+2017-11-21  Pedro Alves  <palves@redhat.com>
+
 	* dwarf2read.c (mapped_index::name_components_casing): New field.
 	(mapped_index) <build_name_components,
 	find_name_components_bounds): Declare new methods.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 865e929..334d8c2 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -4339,8 +4339,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);
@@ -4680,7 +4680,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 (),


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]