Subject: bug#50622: 27.2; GDB lists source code infinitely after setting a breakpoint

From: Eli Zaretskii <[email-masked]>
Date: Thu, 16 Sep 2021 18:29:00 +0300

> Date: Thu, 16 Sep 2021 01:36:10 -0500
> From: Luis Sebastián Martínez Vega
>  <[email-masked]>
> 
> The following was executed on emacs without customizations.
> First, I opened a C program, compiled it with the -g file, and ran
> "gdb -i=mi lagrange -s input.c". Lagrange being the binary. I can
> provide the files, but I've had this problem with any C program I try to
> debug. After invoking gdb, I set a breakpoint, mainly:
> b input.c:33
> after setting it, I get a query in the minibuffer, asking me if I wish
> to make the buffer of the current file read-only (this message is
> appended in the recent messages section). After choosing either yes or
> no, gdb executes the list command ad infinitum, either long enough for
> emacs to hang, or until I C-d the process.

I think this is due to non-ASCII characters in your file names, as
evidenced by this:

> error in process filter: Quit [2 times]
> Bad JSON object: ",", 34
> WARNING! Discarding GDB handler with token #28
> 
> The program is not being run.
> File /home/luis/Documentos/LCC/5to Semestre/Análisis 
> Numérico/lagrange/"/mnt/Personal/Documentos/LCC/5to 
> Semestre/An\303\241lisis Num\303\251rico/lagrange/input.c" is read-only 
> on disk. Make buffer read-only, too? (y or n) n

Does it help to set gdb-mi-decode-strings to 'utf-8'?

If this doesn't help, would it be feasible for you to try the current
master branch of the Emacs Git repository?  I think this issue got a
thorough treatment there.