Subject: bug#15051: 24.3; gdb -mi: breakpoint with in non-existent source file spams terminal incessantly

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 06 Dec 2020 16:41:16 +0100

Ryan Johnson <[email-masked]> writes:

> 1. Create the following two files:
>
> /* <<<--- foo.c --->>> */
> #include <stdio.h>
> extern void bar();
> int main() {
> puts("Thinking about calling bar");;
> puts("Planning to call bar");
> puts("About to call bar");
> bar();
> puts("Called bar");
> return 0;
> };
> /* <<<--- end foo.c --->>> */
>
> /* <<<--- bar.c --->>> */
> void bar() { }
> /* <<<--- end bar.c --->>> */
>
> 2. Compile them: `gcc -g foo.c bar.c -o bug'
>
> 3. Delete or move bar.c: `rm bar.c'
>
> 4. Invoke emacs: `emacs -Q'
>
> 5. M-x gdb (giving `bug' as the executable to debug)

(This bug report unfortunately got no response at the time.)

Thanks for the clear recipe to reproduce this bug.  It is still present
in Emacs 28, but has changed, and is now even worse, I think.

First of all:

>
> 6. Execute the following commands in gdb:
> b bar
> start
> n
> n
> fin
> n
> n
> n
> quit

After "b bar", Emacs says:

File /tmp/"/tmp/bar.c" is read-only on disk.  Make buffer read-only, too? (y or n) n

Then, it's these, as you point out:

(gdb) b bar
Breakpoint 1 at 0x117e: file bar.c, line 1.
(gdb) list bar.c:1
1	bar.c: No such file or directory.
start
Temporary breakpoint 2 at 0x1139: file foo.c, line 4.
Starting program: /tmp/bug 

Temporary breakpoint 2, main () at foo.c:4
4	puts("Thinking about calling bar");;
(gdb) list bar.c:1
1	bar.c: No such file or directory.
n
5	puts("Planning to call bar");
(gdb) list bar.c:1
1	bar.c: No such file or directory.
n
6	puts("About to call bar");
(gdb) list bar.c:1
1	bar.c: No such file or directory.
n
7	bar();

And then I got 20K copies of:

list bar.c:1
1	in bar.c
list bar.c:1
1	in bar.c
list bar.c:1
1	in bar.c
list bar.c:1
1	in bar.c

which continued until I killed gdb.

So this problem is still present in Emacs 28, but is now somewhat
different.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no