GNU bug report logs -
#29548
25.2; How to DEBUG get-device-terminal
Previous Next
Reported by: Live System User <nyc4bos <at> aol.com>
Date: Sun, 3 Dec 2017 15:43:01 UTC
Severity: normal
Tags: moreinfo, wontfix
Merged with 22362,
23378
Found in versions 24.5, 25.0.92, 25.2
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #34 received at 29548 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Live System User <nyc4bos <at> 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).
[0001-TEMP-Debugging-for-Bug-29548-terminal-deletion.patch (text/x-diff, inline)]
From 3178fb78ba044efcbf6c986b64b82e4adb36d203 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> 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
This bug report was last modified 6 years and 134 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.