Re: [PATCH 2/9] gdb: add all_breakpoints_safe function

Simon Marchi via Gdb-patches
2021-05-27T17:58:19Z

On 2021-05-27 1:35 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Simon> @@ -3143,9 +3154,7 @@ remove_breakpoints (void)
> Simon> static void
> Simon> remove_threaded_breakpoints (struct thread_info *tp, int silent)
> Simon> {
> Simon> - struct breakpoint *b, *b_tmp;
> Simon> -
> Simon> - ALL_BREAKPOINTS_SAFE (b, b_tmp)
> Simon> + for (breakpoint *b : all_breakpoints ())
> Simon> {
> Simon> if (b->thread == tp->global_num && user_breakpoint_p (b))
> Simon> {
>
> I had to go look, but this one is ok to convert to the non-safe
> iterator, as it doesn't modify the collection in the loop.

I don't think it was intentional to use all_breakpoints and not
all_breakpoints_safe here. I'm leaning towards changing it back to
all_breakpoints_safe, because it's not the goal of this patch to change
the behavior.

Simon