unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15051: 24.3; gdb -mi: breakpoint with in non-existent source file spams terminal incessantly
@ 2013-08-08 13:47 Ryan Johnson
  2020-12-06 15:41 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Ryan Johnson @ 2013-08-08 13:47 UTC (permalink / raw)
  To: 15051

Setting a breakpoint whose target is in a source file that gdb can't
find spams the terminal with failed source listings after every
command. This makes gdb-mode significantly less pleasant to use,
especially since important library functions like abort(),
__cxa_throw(), etc. usually don't have sources available.

To reproduce:

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)

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

The output looks something like the typescript below. Note how gdb
attempts to list bar.c after every command:

<<<--- begin emacs gdb session --->>>
Current directory is ~/experiments/
GNU gdb (GDB) 7.6.50.20130728-cvs (cygwin-special)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-cygwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
..
Reading symbols from /home/Ryan/experiments/bug...done.
(gdb) b bar
Breakpoint 1 at 0x100401114: file bar.c, line 1.
(gdb) list bar.c:1
1       bar.c: No such file or directory.
start
Temporary breakpoint 2 at 0x1004010dd: file foo.c, line 4.
Starting program: /home/Ryan/experiments/bug
[New Thread 4308.0x1038]
[New Thread 4308.0x108c]

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

Breakpoint 1, bar () at bar.c:1
1       in bar.c
(gdb) list bar.c:1
1       in bar.c
fin
Run till exit from #0  bar () at bar.c:1
main () at foo.c:6
6           puts("Called bar");
(gdb) list bar.c:1
1       bar.c: No such file or directory.
n
7           return 0;
(gdb) list bar.c:1
1       bar.c: No such file or directory.
n
8       };
(gdb) list bar.c:1
1       bar.c: No such file or directory.
n
[Inferior 1 (process 4308) exited normally]
(gdb) list bar.c:1
1       in bar.c
quit

Debugger finished
<<<--- end emacs gdb session --->>>

By way of comparison, here is what happens if I run gdb outside emacs 
(gdb startup message removed for brevity):

<<<--- begin standalone gdb session --->>>
Reading symbols from /home/Ryan/experiments/bug...done.
(gdb) b bar
Breakpoint 1 at 0x100401114: file bar.c, line 1.
(gdb) start
Temporary breakpoint 2 at 0x1004010dd: file foo.c, line 4.
Starting program: /home/Ryan/experiments/bug
[New Thread 4676.0x1250]
[New Thread 4676.0x13d0]

Temporary breakpoint 2, main () at foo.c:4
4           puts("About to call bar");
(gdb) n
About to call bar
5           bar();
(gdb) n

Breakpoint 1, bar () at bar.c:1
1       bar.c: No such file or directory.
(gdb) fin
Run till exit from #0  bar () at bar.c:1
main () at foo.c:6
6           puts("Called bar");
(gdb) n
Called bar
7           return 0;
(gdb) n
8       };
(gdb) n
[Thread 4676.0x13d0 exited with code 0]
[Inferior 1 (process 4676) exited normally]
(gdb) quit
<<<--- end standalone gdb session --->>>

In GNU Emacs 24.3.1 (x86_64-unknown-cygwin)
  of 2013-07-05 on desktop-new
Configured using:
  `configure
  '--srcdir=/home/kbrown/src/cygemacs/emacs-24.3-4/src/emacs-24.3'
  '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin'
  '--sbindir=/usr/sbin' '--libexecdir=/usr/lib' '--datadir=/usr/share'
  '--localstatedir=/var' '--sysconfdir=/etc' '--datarootdir=/usr/share'
  '--docdir=/usr/share/doc/emacs' '-C' '--with-x=no' 'CC=gcc'
  'CFLAGS=-ggdb -O2 -pipe
  -fdebug-prefix-map=/home/kbrown/src/cygemacs/emacs-24.3-4/build=/usr/src/debug/emacs-24.3-4
  -fdebug-prefix-map=/home/kbrown/src/cygemacs/emacs-24.3-4/src/emacs-24.3=/usr/src/debug/emacs-24.3-4'
  'LDFLAGS=' 'LIBS=' 'CPPFLAGS=''

Important settings:
   value of $LANG: en_US.UTF-8
   locale-coding-system: utf-8-unix
   default enable-multibyte-characters: t

Major mode: Debugger

Minor modes in effect:
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   transient-mark-mode: t

Recent input:
ESC [ > 7 7 ; 1 0 2 0 0 ; 0 c ESC x g d b RET C-g C-x
C-f C-g ESC x g d b RET DEL DEL DEL DEL . t e DEL e
DEL DEL e x DEL C-z DEL DEL DEL b u g RET b SPC b a
r RET s t a r t RET j x o C-x u C-x o C-x 2 C-x o C-x
o s t DEL DEL n RET n RET n RET n RET f i n RET n RET
n RET n RET ESC x r e p o r t - b u g RET

Recent messages:
("emacs")
For information about GNU Emacs and the GNU system, type C-h C-a.
Quit [2 times]
Target doesn't support non-stop mode.  Turning it off.
(New file)
Loading cc-langs...done
Switched to thread 1
Undo!

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message cl-macs gv format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils cc-langs cl cl-lib cc-mode cc-fonts
easymenu cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs gdb-mi bindat json gud tool-bar easy-mmode comint regexp-opt
ansi-color ring time-date ediff-hook vc-hooks lisp-float-type
tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow
timer select mouse jit-lock font-lock syntax facemenu font-core frame
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind multi-tty emacs)






^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#15051: 24.3; gdb -mi: breakpoint with in non-existent source file spams terminal incessantly
  2013-08-08 13:47 bug#15051: 24.3; gdb -mi: breakpoint with in non-existent source file spams terminal incessantly Ryan Johnson
@ 2020-12-06 15:41 ` Lars Ingebrigtsen
  2020-12-15 17:21   ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2020-12-06 15:41 UTC (permalink / raw)
  To: Ryan Johnson; +Cc: 15051

Ryan Johnson <ryan.johnson@cs.utoronto.ca> 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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#15051: 24.3; gdb -mi: breakpoint with in non-existent source file spams terminal incessantly
  2020-12-06 15:41 ` Lars Ingebrigtsen
@ 2020-12-15 17:21   ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2020-12-15 17:21 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 15051-done, ryan.johnson

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Sun, 06 Dec 2020 16:41:16 +0100
> Cc: 15051@debbugs.gnu.org
> 
> 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.

I've now fixed this on the master branch.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-15 17:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-08 13:47 bug#15051: 24.3; gdb -mi: breakpoint with in non-existent source file spams terminal incessantly Ryan Johnson
2020-12-06 15:41 ` Lars Ingebrigtsen
2020-12-15 17:21   ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).