all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Manuel Giraud <manuel@ledu-giraud.fr>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 59838@debbugs.gnu.org
Subject: bug#59838: 30.0.50; [PATCH] Save history in GDB session
Date: Fri, 09 Dec 2022 10:02:40 +0100	[thread overview]
Message-ID: <87pmctkkzz.fsf@ledu-giraud.fr> (raw)
In-Reply-To: <87mt805wnu.fsf@ledu-giraud.fr> (Manuel Giraud's message of "Tue,  06 Dec 2022 17:23:01 +0100")

[-- Attachment #1: Type: text/plain, Size: 247 bytes --]

Hi,

I think I have found the right place.  I've tested it with "M-x gdb"
doing an explicit "quit" or using `C-d'.  I've also tested with "M-x
gud-gdb".  Now I think we'll need a patch to gitignore the .gbd_history
files into the emacs directory.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-GDB-save-history-bug-59838.patch --]
[-- Type: text/x-patch, Size: 1782 bytes --]

From 38d29bb31a821e0b03444e4008b80b39834ef842 Mon Sep 17 00:00:00 2001
From: Manuel Giraud <manuel@ledu-giraud.fr>
Date: Mon, 5 Dec 2022 17:48:15 +0100
Subject: [PATCH] Fix GDB save history (bug#59838)

* lisp/progmodes/gdb-mi.el (gdb-reset): Save GDB comint history.
(gdb-delchar-or-quit): Remove useless progn and add comment.
---
 lisp/progmodes/gdb-mi.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index e8d8f9104e..a7839c34af 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1113,13 +1113,13 @@ gdb-delchar-or-quit
              (process-live-p proc)
 	     (not gud-running)
 	     (= (point) (marker-position (process-mark proc))))
-	;; Sending an EOF does not work with GDB-MI; submit an
-	;; explicit quit command.
-	(progn
-          (if (> gdb-control-level 0)
-              (process-send-eof proc)
-            (insert "quit")
-            (comint-send-input t t)))
+      ;; Exit a recursive reading loop or quit.
+      (if (> gdb-control-level 0)
+          (process-send-eof proc)
+        ;; Sending an EOF does not work with GDB-MI; submit an
+        ;; explicit quit command.
+        (insert "quit")
+        (comint-send-input t t))
       (delete-char arg))))
 
 (defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.")
@@ -5124,6 +5124,8 @@ gdb-restore-windows
 (defun gdb-reset ()
   "Exit a debugging session cleanly.
 Kills the gdb buffers, and resets variables and the source buffers."
+  ;; Save GDB history
+  (comint-write-input-ring)
   ;; The gdb-inferior buffer has a pty hooked up to the main gdb
   ;; process.  This pty must be deleted explicitly.
   (let ((pty (get-process "gdb-inferior")))
-- 
2.38.1


[-- Attachment #3: Type: text/plain, Size: 18 bytes --]

-- 
Manuel Giraud

  parent reply	other threads:[~2022-12-09  9:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05 16:53 bug#59838: 30.0.50; [PATCH] Save history in GDB session Manuel Giraud
2022-12-05 17:19 ` Eli Zaretskii
2022-12-05 17:53   ` Manuel Giraud
2022-12-05 19:35     ` Eli Zaretskii
2022-12-06 10:30       ` Manuel Giraud
2022-12-06 12:27         ` Eli Zaretskii
2022-12-06 16:23           ` Manuel Giraud
2022-12-08 10:28             ` Manuel Giraud
2022-12-09  9:02             ` Manuel Giraud [this message]
2022-12-10 13:40               ` 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

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

  git send-email \
    --in-reply-to=87pmctkkzz.fsf@ledu-giraud.fr \
    --to=manuel@ledu-giraud.fr \
    --cc=59838@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.