On Wed, Feb 18, 2026 at 6:09 PM Tom Tromey <[email protected]> wrote:
>
> >>>>> Richard Biener via Gcc <[email protected]> writes:
>
> >> (gdb) b warning_at if option_id == OPT_Wuninitialized
>
> > I do know that
>
> > (gdb) cond 5 (opt_code)option_id.m_idx == OPT_Wmaybe_uninitialized
>
> > works, but this is a) hard to remember and b) unwieldy.  A better point
> > to break at is also appreciated given there's of course warning_n and
> > friends as well.
>
> I don't think you should need the cast there, so just
>
>     (gdb) cond 5 option_id.m_idx == OPT_Wmaybe_uninitialized
>
> ought to work.
>
> I looked at this a tiny bit (didn't debug the overload code yet) and I
> think gdb is confused because the operator requires another instance of
> option_id:
>
>   bool operator== (option_id other) const
>
> so maybe gdb doesn't know how to do the implicit conversion.
>
> The "internal error" thing is a bug of course.
>
> I saw this in option-id:
>
>   /* Ideally we'd take an enum opt_code here, but we don't
>      want to depend on its decl.  */
>
> Making the enum visible here would let you write operator==(enum opt_code),
> which I suspect would make gdb work ok; as well as improving type
> safety.
>
> If including options.h is too expensive then maybe the same could be
> done with a forward declaration like
>
>    enum opt_code : unsigned;
>
> and similar in options.h / the generator.  I didn't try this though.

Ah, that's a good improvement suggestion anyway.

Richard.

>
> Tom

Reply via email to