From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#61973: M-x gdb ends up with infinite prompts before starting the process Date: Sun, 5 Mar 2023 15:18:48 +0200 Message-ID: <0ad69ade-528f-e14e-1841-66c6967bb672@yandex.ru> References: <7e2c2b51-f389-191e-9048-4021232a06e6@yandex.ru> <83v8jf8vz8.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12940"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Cc: 61973@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 05 14:19:19 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pYoGl-0003BJ-7u for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Mar 2023 14:19:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pYoGX-00049h-V2; Sun, 05 Mar 2023 08:19:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pYoGU-00047F-Lh for bug-gnu-emacs@gnu.org; Sun, 05 Mar 2023 08:19:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pYoGU-00075O-Dl for bug-gnu-emacs@gnu.org; Sun, 05 Mar 2023 08:19:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pYoGU-0000Fu-8Z for bug-gnu-emacs@gnu.org; Sun, 05 Mar 2023 08:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Mar 2023 13:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61973 X-GNU-PR-Package: emacs Original-Received: via spool by 61973-submit@debbugs.gnu.org id=B61973.1678022340971 (code B ref 61973); Sun, 05 Mar 2023 13:19:02 +0000 Original-Received: (at 61973) by debbugs.gnu.org; 5 Mar 2023 13:19:00 +0000 Original-Received: from localhost ([127.0.0.1]:38734 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pYoGR-0000Fa-7b for submit@debbugs.gnu.org; Sun, 05 Mar 2023 08:19:00 -0500 Original-Received: from mail-wr1-f44.google.com ([209.85.221.44]:46598) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pYoGO-0000F9-It for 61973@debbugs.gnu.org; Sun, 05 Mar 2023 08:18:57 -0500 Original-Received: by mail-wr1-f44.google.com with SMTP id bw19so6283457wrb.13 for <61973@debbugs.gnu.org>; Sun, 05 Mar 2023 05:18:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678022330; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=JPmQQ51ukJcoX9mmotjNF5I4IBaTZYBpUubFjJWliw8=; b=JC62eurD31TKP+bVnZbnBJlKowDl1tImhWDYktSO/JNZOUQHFbh+bZBhrAaRyH8isI NJB9MpUEKmM1CFF4FXNNe35eL1hECvBUgR93/rLUBj+FOnG054wrZTOwGKfM/gYpbvLM By3bITwJI2cldXxk3mYKpNHCDPoulciw0wvWVBZgbq8oQOZ0b773O3d9y1xCMVaba257 OuMydCMN+nGV8FAO0PloGs6eCX50jDc0sZZIOdJ+A6U2EhwBK6WNW1amIZwhdqpyuJBg EUZMmyR4ZWhaukXeLw3EylqyEpGtKB5ql+MjtyErn23dRu+lSDKarCkvtEJ3g0mBrWsx dVsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678022330; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JPmQQ51ukJcoX9mmotjNF5I4IBaTZYBpUubFjJWliw8=; b=KWs9I53IQDsl9NNu8/ckjh3nhaTLuIoB8BWQDgBGHtrq16bBfRHh6gL4WTpAx9EtTA 1a3Sjw1e7YNOUJMpZ85ctdpDPkPe2b1GW48mdyA70XK0KBJ9M2xPV6NCaieMLCOakmVQ St+bjEecmWEpczKdPRjHIeJiCxT1YG0gq0DXEHtet5M8Rlj6fCQuthRQuMYzhtNtwOha c04N6GMDGsy/8rgPM1LHNJttTHqe7IDa5Khyamyhc4lwTEVnI6oF0JQyu82+FhrtUEtv cmqt+EX7+eGBD/WlbgYH9dnUWN/otxzMN6nkfRV+rKwvaRTBhs2ALDNEEt70Xuw4NDMf iWyw== X-Gm-Message-State: AO0yUKV3kTNk10eYDVFTqaV1JTyMG8vvrPmnUDTHWT/4JCeq1PHM0Meg L+UP68qe2WEbk3Pi31j43Z4= X-Google-Smtp-Source: AK7set/jftMXTTSAHR4zTFBSCn2feCD+h68TTk4WvgMkOQSRnCl0niPgkfevRYtRsrWxS5lL1Gjpsw== X-Received: by 2002:a5d:5917:0:b0:2c7:69b:317f with SMTP id v23-20020a5d5917000000b002c7069b317fmr4957528wrd.60.1678022330126; Sun, 05 Mar 2023 05:18:50 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id j6-20020a05600c42c600b003eb192787bfsm7535059wme.25.2023.03.05.05.18.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 05 Mar 2023 05:18:49 -0800 (PST) Content-Language: en-US In-Reply-To: <83v8jf8vz8.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:257350 Archived-At: On 05/03/2023 10:04, Eli Zaretskii wrote: >> Date: Sun, 5 Mar 2023 03:13:35 +0200 >> From: Dmitry Gutov >> >> 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 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: . Find the GDB manual and other documentation resources online at: . 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) #)) (send-item "14-thread-info" #f(compiled-function (&rest args) #)) (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 \\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\" ~\".\\n\" ~\"Find the GDB manual and other documentation resources online at:\\n .\" ~\"\\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) #)) (send-item "12-thread-info" #f(compiled-function (&rest args) #)) (send-item "11-break-list" #f(compiled-function (&rest args) #)) (send-item "10-thread-info" #f(compiled-function (&rest args) #)) (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.