[v2,2/4] Don't erase empty indices in DWARF reader

Message ID 20230110183338.2623088-3-tromey@adacore.com
State Committed
Headers
Series Fix regression in new DWARF reader |

Commit Message

Tom Tromey Jan. 10, 2023, 6:33 p.m. UTC
  The DWARF reader has some code to remove empty indices.  However, I
think this code has been obsolete since some earlier changes to
parallel_for_each.  This patch removes this code.
---
 gdb/dwarf2/read.c | 10 ----------
 1 file changed, 10 deletions(-)
  

Comments

Joel Brobecker Jan. 14, 2023, 6:05 a.m. UTC | #1
On Tue, Jan 10, 2023 at 11:33:36AM -0700, Tom Tromey via Gdb-patches wrote:
> The DWARF reader has some code to remove empty indices.  However, I
> think this code has been obsolete since some earlier changes to
> parallel_for_each.  This patch removes this code.

I don't think this code needs a re-review, since it's already been
approved by me, and I think also by Andrew, but just in case,
OK for me :).


> ---
>  gdb/dwarf2/read.c | 10 ----------
>  1 file changed, 10 deletions(-)
> 
> diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
> index 851852404eb..c3f246fedf7 100644
> --- a/gdb/dwarf2/read.c
> +++ b/gdb/dwarf2/read.c
> @@ -7170,16 +7170,6 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile)
>      print_tu_stats (per_objfile);
>  
>    indexes.push_back (index_storage.release ());
> -  /* Remove any NULL entries.  This might happen if parallel-for
> -     decides to throttle the number of threads that were used.  */
> -  indexes.erase
> -    (std::remove_if (indexes.begin (),
> -		     indexes.end (),
> -		     [] (const std::unique_ptr<cooked_index> &entry)
> -		     {
> -		       return entry == nullptr;
> -		     }),
> -     indexes.end ());
>    indexes.shrink_to_fit ();
>  
>    cooked_index_vector *vec = new cooked_index_vector (std::move (indexes));
> -- 
> 2.38.1
>
  
Tom Tromey Jan. 17, 2023, 1:53 p.m. UTC | #2
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

>> The DWARF reader has some code to remove empty indices.  However, I
>> think this code has been obsolete since some earlier changes to
>> parallel_for_each.  This patch removes this code.

Joel> I don't think this code needs a re-review, since it's already been
Joel> approved by me, and I think also by Andrew, but just in case,
Joel> OK for me :).

Thanks.

I think somewhere we discussed the possibility of not merging this patch
to gdb-13.  I'm planning to leave this one out there, as it's safe to do
so.

Tom
  

Patch

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 851852404eb..c3f246fedf7 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -7170,16 +7170,6 @@  dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile)
     print_tu_stats (per_objfile);
 
   indexes.push_back (index_storage.release ());
-  /* Remove any NULL entries.  This might happen if parallel-for
-     decides to throttle the number of threads that were used.  */
-  indexes.erase
-    (std::remove_if (indexes.begin (),
-		     indexes.end (),
-		     [] (const std::unique_ptr<cooked_index> &entry)
-		     {
-		       return entry == nullptr;
-		     }),
-     indexes.end ());
   indexes.shrink_to_fit ();
 
   cooked_index_vector *vec = new cooked_index_vector (std::move (indexes));