bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61973: M-x gdb ends up with infinite prompts before starting the pro


From: Dmitry Gutov
Subject: bug#61973: M-x gdb ends up with infinite prompts before starting the process
Date: Sun, 5 Mar 2023 15:18:48 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1

On 05/03/2023 10:04, Eli Zaretskii wrote:
Date: Sun, 5 Mar 2023 03:13:35 +0200
From: Dmitry Gutov <dgutov@yandex.ru>

1. Run compiled 'emacs' from 'src'.
2. M-x gdb
3. Answer prompt: Run gdb (like this): gdb -i=mi ./emacs
4. See this prompt repeated indefinitely, no matter what I answer:

This GDB supports auto-downloading debuginfo from the following URLs:
https://debuginfod.ubuntu.com
Enable debuginfod for this session? (y or [n]) Please answer y or [n].

(Emacs 29, more or less latest.)

What GDB version is that?  If this is a recent problem, did it start
happening because you upgraded to a newer GDB version?

$ gdb --version
GNU gdb (Ubuntu 12.1-3ubuntu2) 12.1

I never really use 'M-x gdb', all the time before I just used it from the terminal. But I saw some recent GDB related post on Reddit where you asked for bug reports and decided to give it a try.

What I _can_ say, though, is that Emacs 25-28 all behave the same way.

All that as long as my src/.gdbinit is added with add-auto-load-safe-path in ~/.config/gdb/gdbinit.

Without it, 'M-x gdb' can start Emacs, but then all the special commands are unavailable, of course.

By "no matter what I answer, do you mean you tried both "y RET" and
"n RET", and the question is repeated regardless?

That's right.

I don't have access to a system with a new enough GDB where debuginfod
is enabled, so I need you to please test the possible solutions.

First, if you invoke GDB from the shell's prompt in the same way,
i.e.

   $ gdb -i=mi ./emacs

does it then ask the same question?  And if you then type "y RET",
does it stop asking, and does debugging Emacs then works as expected?

It only stops at prompt, in which I'm supposed to input 'run -Q'.

After I do that, it doesn't ask me anything anymore. There is a lot of input there, but these lines look relevant (see the end):

(gdb)
run -Q
&"run -Q\n"
~"Starting program: /home/dgutov/vc/emacs/src/emacs -Q\n"
=thread-group-started,id="i1",pid="1352423"
=thread-created,id="1",group-id="i1"
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00005555555a5522",func="terminate_due_to_signal",file="emacs.c",fullname="/home/dgutov/vc/emacs/src/emacs.c",line="426",thread-groups=["i1"],times="0",original-location="terminate_due_to_signal"}
=breakpoint-modified,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x0000555555699f70",func="x_error_quitter",file="xterm.c",fullname="/home/dgutov/vc/emacs/src/xterm.c",line="26119",thread-groups=["i1"],times="0",original-location="x_error_quitter"}
=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffff7fc80a0",to="0x00007ffff7ff0465"}]
~"Debuginfod has been enabled.\nTo make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.\n"
^running
*running,thread-id="all"

Can you show me the entire output of this session invoked from the
shell's prompt, up to and including the reaction to your "y RET"
response?

$ gdb emacs
GNU gdb (Ubuntu 12.1-3ubuntu2) 12.1
Copyright (C) 2022 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-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://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 emacs...
warning: File "/home/dgutov/vc/emacs-28/src/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/home/dgutov/vc/emacs/src/.gdbinit:/home/dgutov/vc/emacs-master/src/.gdbinit".
To enable execution of this file add
        add-auto-load-safe-path /home/dgutov/vc/emacs-28/src/.gdbinit
line to your configuration file "/home/dgutov/.config/gdb/gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "/home/dgutov/.config/gdb/gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the shell:
        info "(gdb)Auto-loading safe path"
(gdb) run -Q
Starting program: /home/dgutov/vc/emacs-28/src/emacs -Q

This GDB supports auto-downloading debuginfo from the following URLs:
https://debuginfod.ubuntu.com
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

(emacs:1350264): dbind-WARNING **: 14:41:06.146: Couldn't connect to accessibility bus: Failed to connect to socket /root/.cache/at-spi/bus_1: Permission denied
[New Thread 0x7ffff0dff6c0 (LWP 1350270)]
[New Thread 0x7fffebfff6c0 (LWP 1350271)]
[New Thread 0x7fffeb7fe6c0 (LWP 1350272)]
[New Thread 0x7fffeaffd6c0 (LWP 1350273)]
[Thread 0x7fffeaffd6c0 (LWP 1350273) exited]
[New Thread 0x7fffeaffd6c0 (LWP 1350274)]
[New Thread 0x7fffea7fc6c0 (LWP 1350275)]
[Thread 0x7fffeaffd6c0 (LWP 1350274) exited]
[Thread 0x7fffea7fc6c0 (LWP 1350275) exited]
[New Thread 0x7fffea7fc6c0 (LWP 1350276)]

Next, can you enable gdb-enable-debug minor mode, and post the
contents of gdb-debug-log (formatted with pp, please) after these
questions are asked and you answer them?

Seems to be pretty-printed already (note that I only pressed 'y' twice):

((recv . "~\"Please answer y or [n].\\n\"
~\"\\nThis GDB supports auto-downloading debuginfo from the following URLs:\\nhttps://debuginfod.ubuntu.com \\nEnable debuginfod for this session? (y or [n]) \"
")
 (mi-send .
          #("-interpreter-exec console \"y\"
" 27 28
(fontified t)))
 (recv . "~\"Please answer y or [n].\\n\"
~\"\\nThis GDB supports auto-downloading debuginfo from the following URLs:\\nhttps://debuginfod.ubuntu.com \\nEnable debuginfod for this session? (y or [n]) \"
")
 (mi-send .
          #("-interpreter-exec console \"y\"
" 27 28
(fontified t)))
 (recv . "~\"Please answer y or [n].\\n\"
~\"\\nThis GDB supports auto-downloading debuginfo from the following URLs:\\nhttps://debuginfod.ubuntu.com \\nEnable debuginfod for this session? (y or [n]) \"
~\"Please answer y or [n].\\n\"
~\"\\nThis GDB supports auto-downloading debuginfo from the following URLs:\\nhttps://debuginfod.ubuntu.com \\nEnable debuginfod for this session? (y or [n]) \"
~\"Please answer y or [n].\\n\"
~\"\\nThis GDB supports auto-downloading debuginfo from the following URLs:\\nhttps://debuginfod.ubuntu.com \\nEnable debuginfod for this session? (y or [n]) \"
~\"Please answer y or [n].\\n\"
~\"\\nThis GDB supports auto-downloading debuginfo from the following URLs:\\nhttps://debuginfod.ubuntu.com \\nEnable debuginfod for this session? (y or [n]) \"
")
 (send-item "17-list-target-features" gdb-check-target-async)
 (send-item "16-gdb-set target-async 1" ignore)
 (send-item "15-break-list" #f(compiled-function
                               (&rest args)
                               #<bytecode 0x991682c1965c328>))
 (send-item "14-thread-info" #f(compiled-function
                                (&rest args)
                                #<bytecode 0x991682cb100d328>))
 (recv . "~\"Breakpoint 2 at 0x145f70: file xterm.c, line 26119.\\n\"
=breakpoint-created,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x0000000000145f70\",func=\"x_error_quitter\",file=\"xterm.c\",fullname=\"/home/dgutov/vc/emacs/src/xterm.c\",line=\"26119\",thread-groups=[\"i1\"],times=\"0\",original-location=\"x_error_quitter\"}
(gdb)
1^done
(gdb)
2^done
(gdb)
3^done
(gdb)
4^done
(gdb)
5^done
(gdb)
~\"\\nThis GDB supports auto-downloading debuginfo from the following URLs:\\nhttps://debuginfod.ubuntu.com \\nEnable debuginfod for this session? (y or [n]) \"
~\"Please answer y or [n].\\n\"
~\"\\nThis GDB supports auto-downloading debuginfo from the following URLs:\\nhttps://debuginfod.ubuntu.com \\nEnable debuginfod for this session? (y or [n]) \"
~\"Please answer y or [n].\\n\"
~\"\\nThis GDB supports auto-downloading debuginfo from the following URLs:\\nhttps://debuginfod.ubuntu.com \\nEnable debuginfod for this session? (y or [n]) \"
~\"Please answer y or [n].\\n\"
~\"\\nThis GDB supports auto-downloading debuginfo from the following URLs:\\nhttps://debuginfod.ubuntu.com \\nEnable debuginfod for this session? (y or [n]) \"
~\"Please answer y or [n].\\n\"
~\"\\nThis GDB supports auto-downloading debuginfo from the following URLs:\\nhttps://debuginfod.ubuntu.com \\nEnable debuginfod for this session? (y or [n]) \"
~\"Please answer y or [n].\\n\"
~\"\\nThis GDB supports auto-downloading debuginfo from the following URLs:\\nhttps://debuginfod.ubuntu.com \\nEnable debuginfod for this session? (y or [n]) \"
~\"Please answer y or [n].\\n\"
~\"\\nThis GDB supports auto-downloading debuginfo from the following URLs:\\nhttps://debuginfod.ubuntu.com \\nEnable debuginfod for this session? (y or [n]) \"
~\"Please answer y or [n].\\n\"
~\"\\nThis GDB supports auto-downloading debuginfo from the following URLs:\\nhttps://debuginfod.ubuntu.com \\nEnable debuginfod for this session? (y or [n]) \"
")
 (recv . "=cmd-param-changed,param=\"print pretty\",value=\"on\"
=cmd-param-changed,param=\"print sevenbit-strings\",value=\"on\"
~\"DISPLAY = :1\\n\"
~\"TERM = dumb\\n\"
=breakpoint-created,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x0000000000051522\",func=\"terminate_due_to_signal\",file=\"emacs.c\",fullname=\"/home/dgutov/vc/emacs/src/emacs.c\",line=\"426\",thread-groups=[\"i1\"],times=\"0\",original-location=\"terminate_due_to_signal\"}
")
(recv . "~\"SIGINT is used by the debugger.\\nAre you sure you want to change it? \"
~\"(y or n) [answered Y; input not from terminal]\\n\"
")
(recv . "=cmd-param-changed,param=\"directories\",value=\"/home/dgutov/vc/emacs/src/../lwlib:$cdir:$cwd\"
")
 (recv . "~\"Reading symbols from emacs...\\n\"
")
 (recv . "=thread-group-added,id=\"i1\"
~\"GNU gdb (Ubuntu 12.1-3ubuntu2) 12.1\\n\"
~\"Copyright (C) 2022 Free Software Foundation, Inc.\\n\"
~\"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\\nThis is free software: you are free to change and redistribute it.\\nThere is NO WARRANTY, to the extent permitted by law.\"
~\"\\nType \\\"show copying\\\" and \\\"show warranty\\\" for details.\\n\"
~\"This GDB was configured as \\\"x86_64-linux-gnu\\\".\\n\"
~\"Type \\\"show configuration\\\" for configuration details.\\n\"
~\"For bug reporting instructions, please see:\\n\"
~\"<https://www.gnu.org/software/gdb/bugs/>.\\n\"
~\"Find the GDB manual and other documentation resources online at:\\n <http://www.gnu.org/software/gdb/documentation/>.\"
~\"\\n\\n\"
~\"For help, type \\\"help\\\".\\n\"
~\"Type \\\"apropos word\\\" to search for commands related to \\\"word\\\"...\\n\"
")
 (send-item "13-break-list" #f(compiled-function
                               (&rest args)
                               #<bytecode 0x991682c1965c328>))
 (send-item "12-thread-info" #f(compiled-function
                                (&rest args)
                                #<bytecode 0x991682cb100d328>))
 (send-item "11-break-list" #f(compiled-function
                               (&rest args)
                               #<bytecode 0x991682c1965c328>))
 (send-item "10-thread-info" #f(compiled-function
                                (&rest args)
                                #<bytecode 0x991682cb100d328>))
 (send-item "9-stack-info-frame" gdb-frame-handler)
 (send-item "8-gdb-show prompt" gdb-get-prompt)
 (send-item "7-file-list-exec-source-file" gdb-get-source-file)
 (send-item "6-file-list-exec-source-files" gdb-get-source-file-list)
 (send-item "5-enable-frame-filters" ignore)
 (send-item "4-enable-pretty-printing" ignore)
 (send-item "3-gdb-set non-stop 1" gdb-non-stop-handler)
 (send-item "2-gdb-set height 0" ignore)
 (send-item "1-inferior-tty-set /dev/pts/10" ignore))

Finally, if you add the following line to your ~/.gdbinit, does the
problem go away?

   set debuginfod enabled on

That helps. 'set debuginfod enabled off' also works.

(If you don't have a ~/.gdbinit file, create it and add this single
line to it.)  With this line, GDB should not ask the question at all.

I had to use ~/.config/gdb/gdbinit, on account of its existence.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]