[PATCH 8/9] gdb: remove iterate_over_breakpoints function

Tom de Vries tdevries@suse.de
Thu Oct 21 10:20:53 GMT 2021


On 5/27/21 5:35 PM, Simon Marchi via Gdb-patches wrote:
>  /* Create and register solib event breakpoints.  PROBES is an array
> diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
> index 738f69156485..afd51e95980c 100644
> --- a/gdb/tui/tui-winsource.c
> +++ b/gdb/tui/tui-winsource.c
> @@ -457,7 +457,7 @@ tui_source_window_base::update_breakpoint_info
>  	 do with it.  Identify enable/disabled breakpoints as well as
>  	 those that we already hit.  */
>        tui_bp_flags mode = 0;
> -      iterate_over_breakpoints ([&] (breakpoint *bp) -> bool
> +      for (breakpoint *bp : all_breakpoints ())
>  	{
>  	  if (bp == being_deleted)
>  	    return false;
> @@ -479,7 +479,8 @@ tui_source_window_base::update_breakpoint_info
>  		}
>  	    }
>  	  return false;
> -	});
> +	}
> +
>        if (line->break_mode != mode)
>  	{
>  	  line->break_mode = mode;
> -- 

This changes a lambda function body to a loop body, but fails to update
the two returns.  Consequently, showing breakpoints in tui is broken
(and unfortunately there's no test-case to detect that).

This works for me:
...
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index afd51e95980..955b68901fe 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -460,7 +460,7 @@ tui_source_window_base::update_breakpoint_info
       for (breakpoint *bp : all_breakpoints ())
        {
          if (bp == being_deleted)
-           return false;
+           continue;

          for (bp_location *loc : bp->locations ())
            {
@@ -478,7 +478,6 @@ tui_source_window_base::update_breakpoint_info
                    mode |= TUI_BP_HARDWARE;
                }
            }
-         return false;
        }

       if (line->break_mode != mode)
...

Thanks,
- Tom


More information about the Gdb-patches mailing list