[00/10] Some simple changes to use gdb's unordered set and map

Message ID 20250225-source-cache-hash-v1-0-f937ce22b0e9@tromey.com
Headers
Series Some simple changes to use gdb's unordered set and map |

Message

Tom Tromey Feb. 26, 2025, 1:08 a.m. UTC
  This converts a few spots to use gdb::unordered_set or
gdb::unordered_map.  I also noticed one spot where C++-ification
cleaned up the code, so that's included as well.

Regression tested on x86-64 Fedora 40.

Signed-off-by: Tom Tromey <tom@tromey.com>
---
Tom Tromey (10):
      Use gdb set and map in source_cache
      Use gdb set and map in TUI
      Use gdb::function_view in iterate_over_threads
      Use gdb set and map in mi-main.c
      Use gdb set and map in remote.c
      Use gdb map in target-connection.c
      Use gdb set in all_non_exited_process_targets
      Use gdb set in dwarf2/aranges.c
      Use gdb map in py-connection.c
      Use gdb map in mi-cmds.c

 gdb/aix-thread.c             |  15 ++----
 gdb/breakpoint.c             |  16 ++----
 gdb/dwarf2/aranges.c         |   2 +-
 gdb/fbsd-tdep.c              |  10 ++--
 gdb/gdbthread.h              |   4 +-
 gdb/infcmd.c                 |  12 ++---
 gdb/infrun.c                 |   8 ++-
 gdb/mi/mi-cmds.c             |   4 +-
 gdb/mi/mi-main.c             | 114 ++++++++++++++++---------------------------
 gdb/process-stratum-target.c |   4 +-
 gdb/process-stratum-target.h |   5 +-
 gdb/python/py-connection.c   |   7 ++-
 gdb/remote.c                 |   5 +-
 gdb/sol-thread.c             |  23 +++------
 gdb/source-cache.h           |   8 +--
 gdb/target-connection.c      |   5 +-
 gdb/thread.c                 |   5 +-
 gdb/tui/tui-layout.c         |   4 +-
 gdb/tui/tui-layout.h         |   5 +-
 19 files changed, 99 insertions(+), 157 deletions(-)
---
base-commit: 0ec9aa4ac33872e90c572f95b738c59aa7568b71
change-id: 20250225-source-cache-hash-6e19c5c5323b

Best regards,
  

Comments

Simon Marchi Feb. 26, 2025, 5:06 p.m. UTC | #1
On 2/25/25 8:08 PM, Tom Tromey wrote:
> This converts a few spots to use gdb::unordered_set or
> gdb::unordered_map.  I also noticed one spot where C++-ification
> cleaned up the code, so that's included as well.
> 
> Regression tested on x86-64 Fedora 40.
> 
> Signed-off-by: Tom Tromey <tom@tromey.com>

I got this when applying the series...

/home/smarchi/src/binutils-gdb/.git/rebase-apply/patch:257: indent with spaces.
        {
/home/smarchi/src/binutils-gdb/.git/rebase-apply/patch:295: indent with spaces.
        {

Those are in functions mi_cmd_exec_interrupt and mi_cmd_target_detach.

Simon
  
Simon Marchi Feb. 26, 2025, 5:46 p.m. UTC | #2
On 2/26/25 12:06 PM, Simon Marchi wrote:
> On 2/25/25 8:08 PM, Tom Tromey wrote:
>> This converts a few spots to use gdb::unordered_set or
>> gdb::unordered_map.  I also noticed one spot where C++-ification
>> cleaned up the code, so that's included as well.
>>
>> Regression tested on x86-64 Fedora 40.
>>
>> Signed-off-by: Tom Tromey <tom@tromey.com>
> 
> I got this when applying the series...
> 
> /home/smarchi/src/binutils-gdb/.git/rebase-apply/patch:257: indent with spaces.
>         {
> /home/smarchi/src/binutils-gdb/.git/rebase-apply/patch:295: indent with spaces.
>         {
> 
> Those are in functions mi_cmd_exec_interrupt and mi_cmd_target_detach.
> 
> Simon

My only real concern is in patch 6, where I think that switching to an
unordered map could affect the order in the "info connections" output.
But other than that:

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon
  
Tom Tromey March 11, 2025, 2:40 p.m. UTC | #3
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

Simon> My only real concern is in patch 6, where I think that switching to an
Simon> unordered map could affect the order in the "info connections" output.
Simon> But other than that:

Simon> Approved-By: Simon Marchi <simon.marchi@efficios.com>

I dropped that one patch and I fixed all the other things you pointed
out, so I am going to check this in.

Tom