all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@users.sourceforge.net>
To: Live System User <nyc4bos@aol.com>
Cc: 29548@debbugs.gnu.org
Subject: bug#29548: 25.2; How to DEBUG get-device-terminal
Date: Thu, 04 Jan 2018 21:12:28 -0500	[thread overview]
Message-ID: <874lo1rr3n.fsf@users.sourceforge.net> (raw)
In-Reply-To: <87y3ldbsgk.fsf@aol.com> (Live System User's message of "Thu, 04 Jan 2018 09:37:31 -0500")

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

Live System User <nyc4bos@aol.com> writes:

>   Here's a new occurrance (see below):

Hmm, if you can reproduce this semi-regularly, then perhaps the
following patch can catch the reason for the problem.  It sets a
breakpoint in Fsignal while the terminal is in the process of being
deleted (requires reproducing the problem under gdb with the patched
.gdbinit loaded).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 2098 bytes --]

From 3178fb78ba044efcbf6c986b64b82e4adb36d203 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Thu, 4 Jan 2018 21:09:03 -0500
Subject: [PATCH] [TEMP] Debugging for Bug#29548 (terminal deletion)

---
 src/.gdbinit   | 22 ++++++++++++++++++++++
 src/terminal.c | 12 ++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/src/.gdbinit b/src/.gdbinit
index 83341c795a..4cfd2ca88a 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -1279,3 +1279,25 @@ commands
   end
   continue
 end
+
+break signal_or_quit
+set $bp_signal_or_quit_num = $bpnum
+disable $bp_signal_or_quit_num
+
+break begin_delete_terminal
+set $bp_begin_delete_terminal_num = $bpnum
+commands $bp_begin_delete_terminal_num
+  if delete_terminal_count == 0
+    enable $bp_signal_or_quit_num
+  end
+  continue
+end
+
+break end_delete_terminal
+set $bp_end_delete_terminal_num = $bpnum
+commands $bp_end_delete_terminal_num
+  if delete_terminal_count == 1
+    disable $bp_signal_or_quit_num
+  end
+  continue
+end
diff --git a/src/terminal.c b/src/terminal.c
index 0b1cbe7b79..3bf18c562d 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -311,6 +311,16 @@ create_terminal (enum output_method type, struct redisplay_interface *rif)
 /* Low-level function to close all frames on a terminal, remove it
    from the terminal list and free its memory.  */
 
+static int delete_terminal_count = 0;
+static void begin_delete_terminal (void)
+{
+    delete_terminal_count++;
+}
+static void end_delete_terminal (void)
+{
+    delete_terminal_count--;
+}
+
 void
 delete_terminal (struct terminal *terminal)
 {
@@ -321,6 +331,7 @@ delete_terminal (struct terminal *terminal)
      delete_terminal_hook when we delete our last frame.  */
   if (!terminal->name)
     return;
+  begin_delete_terminal();
   xfree (terminal->name);
   terminal->name = NULL;
 
@@ -339,6 +350,7 @@ delete_terminal (struct terminal *terminal)
     if (! *tp)
       emacs_abort ();
   *tp = terminal->next_terminal;
+  end_delete_terminal();
 
   xfree (terminal->keyboard_coding);
   terminal->keyboard_coding = NULL;
-- 
2.11.0


  reply	other threads:[~2018-01-05  2:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-03 15:42 bug#29548: 25.2; How to DEBUG get-device-terminal Live System User
2017-12-03 16:09 ` Noam Postavsky
2017-12-06 18:49   ` Live System User
2017-12-06 19:56     ` Noam Postavsky
2017-12-07  0:25       ` Live System User
2017-12-15  1:37         ` Noam Postavsky
2018-01-04 14:37           ` Live System User
2018-01-05  2:12             ` Noam Postavsky [this message]
2018-01-06 10:16               ` Live System User
2018-01-10  3:51                 ` Noam Postavsky
2018-02-14 17:26                   ` Live System User
2018-02-18 22:41                     ` Noam Postavsky
2017-12-07  9:27       ` martin rudalics
2017-12-07  9:35         ` Noam Postavsky

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=874lo1rr3n.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=29548@debbugs.gnu.org \
    --cc=nyc4bos@aol.com \
    /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.