From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#29548: 25.2; How to DEBUG get-device-terminal Date: Thu, 04 Jan 2018 21:12:28 -0500 Message-ID: <874lo1rr3n.fsf@users.sourceforge.net> References: <87d13v24zb.fsf@aol.com> <87k1y3iyj0.fsf@users.sourceforge.net> <87609j1yla.fsf@aol.com> <87609jtmea.fsf@aol.com> <874losdb5c.fsf@users.sourceforge.net> <87y3ldbsgk.fsf@aol.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1515118283 5013 195.159.176.226 (5 Jan 2018 02:11:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 5 Jan 2018 02:11:23 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) Cc: 29548@debbugs.gnu.org To: Live System User Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 05 03:11:18 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eXHTU-0000YN-F7 for geb-bug-gnu-emacs@m.gmane.org; Fri, 05 Jan 2018 03:11:12 +0100 Original-Received: from localhost ([::1]:34752 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXHVR-00034F-UF for geb-bug-gnu-emacs@m.gmane.org; Thu, 04 Jan 2018 21:13:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXHVL-0002z8-88 for bug-gnu-emacs@gnu.org; Thu, 04 Jan 2018 21:13:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eXHVH-0008KW-4p for bug-gnu-emacs@gnu.org; Thu, 04 Jan 2018 21:13:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55750) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eXHVG-0008Js-IC for bug-gnu-emacs@gnu.org; Thu, 04 Jan 2018 21:13:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eXHVF-0005Hf-K9 for bug-gnu-emacs@gnu.org; Thu, 04 Jan 2018 21:13:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Jan 2018 02:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29548 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 29548-submit@debbugs.gnu.org id=B29548.151511835920284 (code B ref 29548); Fri, 05 Jan 2018 02:13:01 +0000 Original-Received: (at 29548) by debbugs.gnu.org; 5 Jan 2018 02:12:39 +0000 Original-Received: from localhost ([127.0.0.1]:36198 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eXHUt-0005H5-7X for submit@debbugs.gnu.org; Thu, 04 Jan 2018 21:12:39 -0500 Original-Received: from mail-it0-f51.google.com ([209.85.214.51]:39025) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eXHUr-0005Gp-8N for 29548@debbugs.gnu.org; Thu, 04 Jan 2018 21:12:37 -0500 Original-Received: by mail-it0-f51.google.com with SMTP id 68so4555476ite.4 for <29548@debbugs.gnu.org>; Thu, 04 Jan 2018 18:12:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=T4ubh729qoy2ofPhanmWEIcL/3PDJiDgUfQtpvHlhgM=; b=gJXDjHXELAt3UTtmlMMx0wE5QtNO3vQ626HOovSlcaigywn72nvE5ovRpRKAf6Wt7g 60SrmnO8Tg8Uj1/3Cng6+hSjcwaDuc87YE3TNMR3juBkz13qobp6PzCGANKZGYgzJf36 HKChSzFEQzdh64uTJPNQuCxgyIMSZj1PLIVyoUlDghoEkcsj+OZC2UZfeDUJAr5vzPVN KY4+PwX1A+vubZO2dNU2L2jU0mMHeBsRSubkkiQ30WYXBVn3sWAuApXLWwalgaTk8QJy bYGRfK0oPa1nMBQWHOQbKnIc2DBby0lTzfLFdFzmkzvhHzDjfsaJLMSNOZUFKYoNN4vD KPjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=T4ubh729qoy2ofPhanmWEIcL/3PDJiDgUfQtpvHlhgM=; b=CXrzocQ8VQsJRBWjPO+h+cVzhGc1sFzd8pgl7itgGjCJfrsXnMPyyMmtM9mQvNsY+3 yLLeP9OBBV4B6e4FMhfbiaCYu35stmraccN9VnuhjwG1lIr2oTsraEEQtClhjAwwaYdW cimmZydB4u5xnPN+VpSY2jnlnho/9gXqdF6YglYzbV/g64oSsatanH0rU5cqpuXWwZtD 5/mnqa+4g91NayojyWqTbCiloV+yU1bAFwVjZnD+y9hA9aRbLLIUmhoOlJcVRDJvYM7C bY9nDug+sSiYg7KH48u20vsmqmUzxJldFOK8xSoCA745gg/KitxLnFGgMNdHDHPT3WGL 9q9g== X-Gm-Message-State: AKGB3mLAlT3CTXQqxXr60/hrchzH3uq9NYtiRoaYBl3iJLISSJadPmoH SDOLWFXN5r4cUDpHyH9/icMC4A== X-Google-Smtp-Source: ACJfBoswUFGTuBvldLPd40lIhSGi45FlCW5uGK9h4nKRG+BKpiRL0PiaNNst9Kp9CbOoVSg4XiXazQ== X-Received: by 10.36.83.21 with SMTP id n21mr1728312itb.74.1515118351491; Thu, 04 Jan 2018 18:12:31 -0800 (PST) Original-Received: from zebian ([45.2.119.34]) by smtp.googlemail.com with ESMTPSA id 140sm1504121itx.3.2018.01.04.18.12.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Jan 2018 18:12:30 -0800 (PST) In-Reply-To: <87y3ldbsgk.fsf@aol.com> (Live System User's message of "Thu, 04 Jan 2018 09:37:31 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:141788 Archived-At: --=-=-= Content-Type: text/plain Live System User 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). --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-TEMP-Debugging-for-Bug-29548-terminal-deletion.patch Content-Description: patch >From 3178fb78ba044efcbf6c986b64b82e4adb36d203 Mon Sep 17 00:00:00 2001 From: Noam Postavsky 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 --=-=-=--