unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Knut Anders Hatlen <kahatlen@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 69327@debbugs.gnu.org
Subject: bug#69327: 29.2.50; Emacs crashes when running gdb with comint-prompt-read-only
Date: Fri, 23 Feb 2024 21:16:50 +0100	[thread overview]
Message-ID: <875xyfndfx.fsf@oracle.com> (raw)
In-Reply-To: <868r3b1943.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 23 Feb 2024 17:41:16 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Knut Anders Hatlen <knut.hatlen@oracle.com>
>> Date: Fri, 23 Feb 2024 10:12:25 +0000
>> 
>> Then run emacs -Q and evaluate:
>> 
>> (progn
>>   (setopt gdb-debuginfod-enable-setting nil
>>           comint-prompt-read-only t)
>>   (gdb "gdb -i=mi a.out")
>>   (insert "r")
>>   (comint-send-input)
>>   (sit-for 2)
>>   (gdb "gdb -i=mi b.out"))
>
> Does gdb-mi.el really support several debugging sessions in parallel?

I'm not sure, but I don't think so. But I sometimes forget that I
already have a debugging session running in Emacs, and start a new one.
I would be fine with getting an error if it's not supported. But
preferably not a crash. :)

>> According to git bisect, it has crashed since the
>> gdb-debuginfod-enable-setting option was introduced in:
>> 
>> commit ab417c8a6eeb7df7ccce3e5f8416f48544a5174e
>> Author: Eli Zaretskii <eliz@gnu.org>
>> Date:   Tue Mar 7 14:39:27 2023 +0200
>> 
>>     Fix problem with debuginfod queries in "M-x gdb"
>>     
>>     * lisp/progmodes/gdb-mi.el (gdb-debuginfod-enable-setting): New
>>     defcustom.
>>     (gdb-debuginfod-message): New function.
>>     (gdb-init-1): Initialize gdb-debuginfod-enable.  Ask the user
>>     about debuginfod queries and display any error messages.
>>     (Bug#61973)
>>     
>>     * etc/NEWS: Announce the change.
>
> Does replacing defvar with defvar-local for
> gdb-debuginfod-enable-setting helps to resolve the problem?

I assume you meant gdb-debuginfod-enable (the defvar), not
gdb-debuginfod-enable-setting (the defcustom)? Unfortunately, no, it
didn't seem to change anything. (For completeness, I also tried to
change the defcustom to defvar-local, even though I don't think that's
what you requested. That didn't help either.)

> If not, please tell what are the errors that Emacs wants to report,
> here:
>
>   #10685 0x00005555557a971b in read_process_output_error_handler (error_val=<optimized out>) at ../../src/process.c:6140
>   #10686 0x000055555575462c in internal_condition_case_1 (bfun=bfun@entry=0x5555557a97a0 <read_process_output_call>, arg=XIL(0x7fffef130093), handlers=handlers@entry=XIL(0x90), hfun=hfun@entry=0x5555557a96e0 <read_process_output_error_handler>) at ../../src/eval.c:1557
> 	  val = <optimized out>
> 	  c = 0x555555ebab70
>   #10687 0x00005555557ac215 in read_and_dispose_of_process_output (coding=<optimized out>, nbytes=157, chars=0x7fffffffc420 "=cmd-param-changed,param=\"debuginfod enabled\",value=\"off\"\n~\"Reading symbols from b.out...\\n\"\n~\"(No debugging symbols found in b.out)\\n\"\n(gdb) \n1^done\n(gdb) \nater <https://urldefense.com/v3/__http://gnu.org/licenses/gpl.html__;!!ACWV5N9M2RV99hQ!L1QMwwawGjh56jglEvTNy8xaiRP1Yrb2WvksE8JcbvnoIbAgcTriclAWSIQjJEZ0LLxIF3V4Tr-L$ >\\nTh"..., p=0x5555561b66f8) at ../../src/process.c:6354
>
> and here:
>
>   #10679 0x00005555557a971b in read_process_output_error_handler (error_val=<optimized out>) at ../../src/process.c:6140
>   #10680 0x000055555575462c in internal_condition_case_1 (bfun=bfun@entry=0x5555557a97a0 <read_process_output_call>, arg=XIL(0x7fffef12d703), handlers=handlers@entry=XIL(0x90), hfun=hfun@entry=0x5555557a96e0 <read_process_output_error_handler>) at ../../src/eval.c:1557
> 	  val = <optimized out>
> 	  c = 0x555555ebab70
>   #10681 0x00005555557ac215 in read_and_dispose_of_process_output (coding=<optimized out>, nbytes=14, chars=0x7fffffffae40 "1^done\n(gdb) \n", p=0x5555561b66f8) at ../../src/process.c:6354
>
> I'm asking about the value of error_val with which
> read_process_output_error_handler is called in these two frames.  It
> is possible that you will need to rebuild Emacs without optimizations,
> to be able to show these values.  The error_val argument is a Lisp
> object, so please use the "pp" command to show it (if GDB says it
> doesn't know about "pp", you need to "source .gdbinit" where .gdbinit
> is the file that comes with the Emacs source tarball, in the 'src'
> directory).

It apparently tries to report "error in process filter: Text is
read-only" in all of the read_process_output_error_handler() frames that
I looked at. error_val contains the same in all of them:

(gdb) pp error_val
(text-read-only)

>> When setting comint-prompt-read-only to nil, it seems to behave fine
>> regardless of which value gdb-debuginfod-enable-setting has.
>
> Why are you setting comint-prompt-read-only non-nil?

It's just a preference of mine. I like that the prompt is preserved even
if I hit backspace a few times too many, or hit C-k in the wrong spot,
in M-x shell or M-x gdb. Makes it feel a little more similar to running
a shell in a terminal, without going all the way to term or vterm.

Thanks,

-- 
Knut Anders





  reply	other threads:[~2024-02-23 20:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <wjo88r3bpk1b.fsf@oracle.com>
2024-02-23 15:41 ` bug#69327: 29.2.50; Emacs crashes when running gdb with comint-prompt-read-only Eli Zaretskii
2024-02-23 20:16   ` Knut Anders Hatlen [this message]
2024-02-24  8:40     ` Eli Zaretskii
2024-02-24 12:41       ` Knut Anders Hatlen
2024-02-24 13:14         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875xyfndfx.fsf@oracle.com \
    --to=kahatlen@gmail.com \
    --cc=69327@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).