unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#69327: 29.2.50; Emacs crashes when running gdb with comint-prompt-read-only
       [not found] <wjo88r3bpk1b.fsf@oracle.com>
@ 2024-02-23 15:41 ` Eli Zaretskii
  2024-02-23 20:16   ` Knut Anders Hatlen
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2024-02-23 15:41 UTC (permalink / raw)
  To: Knut Anders Hatlen; +Cc: 69327

> 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?

> 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?

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 <http://gnu.org/licenses/gpl.html>\\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).

> 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?

Thanks.





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

* bug#69327: 29.2.50; Emacs crashes when running gdb with comint-prompt-read-only
  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
  2024-02-24  8:40     ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Knut Anders Hatlen @ 2024-02-23 20:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 69327

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





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

* bug#69327: 29.2.50; Emacs crashes when running gdb with comint-prompt-read-only
  2024-02-23 20:16   ` Knut Anders Hatlen
@ 2024-02-24  8:40     ` Eli Zaretskii
  2024-02-24 12:41       ` Knut Anders Hatlen
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2024-02-24  8:40 UTC (permalink / raw)
  To: Knut Anders Hatlen; +Cc: 69327

> From: Knut Anders Hatlen <kahatlen@gmail.com>
> Cc: 69327@debbugs.gnu.org
> Date: Fri, 23 Feb 2024 21:16:50 +0100
> 
> 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)

OK, so please try this change, it seems to fix the problem for me:

diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index d119eeb..312b71b 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1849,7 +1849,8 @@ gdb-io-eof
 
 (defun gdb-clear-inferior-io ()
   (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io)
-    (erase-buffer)))
+    (let ((inhibit-read-only t))
+      (erase-buffer))))
 \f
 
 (defconst breakpoint-xpm-data
@@ -2819,7 +2820,8 @@ gdb-append-to-partial-output
 
 (defun gdb-clear-partial-output ()
   (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
-    (erase-buffer)))
+    (let ((inhibit-read-only t))
+      (erase-buffer))))
 
 ;; Parse GDB/MI result records: this process converts
 ;;  list      [...]      ->  list





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

* bug#69327: 29.2.50; Emacs crashes when running gdb with comint-prompt-read-only
  2024-02-24  8:40     ` Eli Zaretskii
@ 2024-02-24 12:41       ` Knut Anders Hatlen
  2024-02-24 13:14         ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Knut Anders Hatlen @ 2024-02-24 12:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 69327

Eli Zaretskii <eliz@gnu.org> writes:

> OK, so please try this change, it seems to fix the problem for me:
>
> diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
> index d119eeb..312b71b 100644
> --- a/lisp/progmodes/gdb-mi.el
> +++ b/lisp/progmodes/gdb-mi.el
> @@ -1849,7 +1849,8 @@ gdb-io-eof
>  
>  (defun gdb-clear-inferior-io ()
>    (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io)
> -    (erase-buffer)))
> +    (let ((inhibit-read-only t))
> +      (erase-buffer))))
>  \f
>  
>  (defconst breakpoint-xpm-data
> @@ -2819,7 +2820,8 @@ gdb-append-to-partial-output
>  
>  (defun gdb-clear-partial-output ()
>    (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
> -    (erase-buffer)))
> +    (let ((inhibit-read-only t))
> +      (erase-buffer))))
>  
>  ;; Parse GDB/MI result records: this process converts
>  ;;  list      [...]      ->  list

It fixes the problem for me too. Thanks a lot!

-- 
Knut Anders





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

* bug#69327: 29.2.50; Emacs crashes when running gdb with comint-prompt-read-only
  2024-02-24 12:41       ` Knut Anders Hatlen
@ 2024-02-24 13:14         ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2024-02-24 13:14 UTC (permalink / raw)
  To: Knut Anders Hatlen; +Cc: 69327-done

> From: Knut Anders Hatlen <kahatlen@gmail.com>
> Cc: 69327@debbugs.gnu.org
> Date: Sat, 24 Feb 2024 13:41:01 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > OK, so please try this change, it seems to fix the problem for me:
> >
> > diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
> > index d119eeb..312b71b 100644
> > --- a/lisp/progmodes/gdb-mi.el
> > +++ b/lisp/progmodes/gdb-mi.el
> > @@ -1849,7 +1849,8 @@ gdb-io-eof
> >  
> >  (defun gdb-clear-inferior-io ()
> >    (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io)
> > -    (erase-buffer)))
> > +    (let ((inhibit-read-only t))
> > +      (erase-buffer))))
> >  \f
> >  
> >  (defconst breakpoint-xpm-data
> > @@ -2819,7 +2820,8 @@ gdb-append-to-partial-output
> >  
> >  (defun gdb-clear-partial-output ()
> >    (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
> > -    (erase-buffer)))
> > +    (let ((inhibit-read-only t))
> > +      (erase-buffer))))
> >  
> >  ;; Parse GDB/MI result records: this process converts
> >  ;;  list      [...]      ->  list
> 
> It fixes the problem for me too. Thanks a lot!

Thanks, installed on the emacs-29 branch, and closing the bug.





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

end of thread, other threads:[~2024-02-24 13:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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
2024-02-24  8:40     ` Eli Zaretskii
2024-02-24 12:41       ` Knut Anders Hatlen
2024-02-24 13:14         ` 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).