Subject: bug#75298: GUD doesn't let me answer debuginfod query

From: Eli Zaretskii <[email-masked]>
Date: Fri, 03 Jan 2025 10:09:51 +0200

> From: Daniel Colascione <[email-masked]>
> Cc: [email-masked]
> Date: Thu, 02 Jan 2025 17:28:51 -0500
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> From: Daniel Colascione <[email-masked]>
> >> Date: Thu, 02 Jan 2025 14:04:56 -0500
> >> 
> >> I'd expect to be able to answer the debuginfod query in the affirmative
> >> in the GUD session below, but nothing I put into the buffer seems
> >> acceptable to GDB.
> >
> > Which command did you use: "M-x gdb" or "M-x gud-gdb"?
> 
> The former.  The latter works fine, but doesn't integrate into Emacs.
> 
> > The former is supposed to allow you to answer the question, at least
> > in Emacs 30 (you didn't say which Emacs version you used).
> 
> I'm using master.

Then I cannot reproduce this here.

> > The latter doesn't ask me that question at all.  So I'm unsure
> > what happens in your case.  In case this is GDB-version dependent:
> > I tried with GDB version 12.1.
> 
> debuginfod isn't enabled in all environments, so you might not get
> the question.  I'm using GDB 15.1.

Oh, I do get asked, and I can answer either 'n' or 'y'.  But the
question I see is worded differently:

  Enable querying debuginfod servers for this session? (y or n) y

This question comes from gdb-init-1, in this fragment:

  ;; This needs to be done before we ask GDB for anything that might
  ;; trigger questions about debuginfod queries.
  (if (eq gdb-debuginfod-enable 'ask)
      (setq gdb-debuginfod-enable
            (y-or-n-p "Enable querying debuginfod servers for this session?")))
  (gdb-input (format "-gdb-set debuginfod enabled %s"
                     (if gdb-debuginfod-enable "on" "off"))
             'gdb-debuginfod-message)

It looks like in your case we fail to ask the above question before
GDB asks us about that, but what breaks the above assumption and
triggers GDB's question before we shut it up?  It could be a different
GDB version, I'm not sure.  I don't have GDB 15 on the GNU/Linux
system where I can test this.

Is this in "emacs -Q", btw?  If not, perhaps some customizations get
in the way?  Or maybe some GDB customizations?

Can anyone else reproduce this with the master branch and GDB 15?

Anyway, as a stopgap, you should be able to avoid the question by
customizing gdb-debuginfod-enable-setting.  If that doesn't work
either, it's possible that something causes GDB to ask this question
earlier than we anticipate, and we need to revisit this code (which
was tested at the time with GDB versions that asked about debuginfod).