From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alain Schneble Newsgroups: gmane.emacs.devel Subject: Re: SIGTRAP in kill emulation on MS Windows Date: Mon, 22 Aug 2016 08:36:50 +0200 Message-ID: <86r39hia2l.fsf@realize.ch> References: <86vaytj1lu.fsf@realize.ch> <83lgzpbkaq.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1471847903 4567 195.159.176.226 (22 Aug 2016 06:38:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 22 Aug 2016 06:38:23 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 22 08:38:19 2016 Return-path: Envelope-to: ged-emacs-devel@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 1bbisE-0000pz-VW for ged-emacs-devel@m.gmane.org; Mon, 22 Aug 2016 08:38:19 +0200 Original-Received: from localhost ([::1]:39809 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbisB-0002Ql-5k for ged-emacs-devel@m.gmane.org; Mon, 22 Aug 2016 02:38:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbira-0002Qf-89 for emacs-devel@gnu.org; Mon, 22 Aug 2016 02:37:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bbirY-0007NB-8w for emacs-devel@gnu.org; Mon, 22 Aug 2016 02:37:37 -0400 Original-Received: from clientmail.realize.ch ([46.140.89.53]:2644) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1bbirS-0007LP-Rt; Mon, 22 Aug 2016 02:37:31 -0400 Original-Received: from rintintin.hq.realize.ch.lan.rit ([192.168.0.105]) by clientmail.realize.ch ; Mon, 22 Aug 2016 08:37:20 +0200 Original-Received: from MYNGB (192.168.250.224) by rintintin.hq.realize.ch.lan.rit (192.168.0.105) with Microsoft SMTP Server (TLS) id 15.0.516.32; Mon, 22 Aug 2016 08:36:54 +0200 In-Reply-To: <83lgzpbkaq.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 22 Aug 2016 05:37:49 +0300") X-ClientProxiedBy: rintintin.hq.realize.ch.lan.rit (192.168.0.105) To rintintin.hq.realize.ch.lan.rit (192.168.0.105) X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] X-Received-From: 46.140.89.53 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:206741 Archived-At: Eli Zaretskii writes: >> From: Alain Schneble >> Date: Sun, 21 Aug 2016 22:42:05 +0200 >> >> sys_kill in w32proc.c maps some signals (SIGINT, SIGKILL, SIGQUIT, >> SIGHUP) to the appropriate W32 API calls. Couldn't it handle SIGTRAP as >> well and map it to a call to DebugBreakProcess >> (https://msdn.microsoft.com/en-us/library/windows/desktop/ms679298(v=vs.85).aspx)? > > It could, but what would be the use case for this functionality? Who > or what would trigger that signal, and what would that trigger do on a > Posix system? On a Posix system, it's already possible to send a SIGTRAP to a process. It just invokes kill with SIGTRAP. AFAIK, this dumps a backtrace and terminates the process or it returns control to the debugger process if one has been attached. Hence, IMHO, calling DebugBreakProcess sounds like the natural thing to do on MS Windows. Use cases: 1. In M-x proced, M-x proced-send-signal RET TRAP RET 2. New command M-x gud-suspend-debuggee (or a better name?). This one would invoke `signal-process' with the debugee process and SIGTRAP as the arguments. This would -- at any point in time -- return control back to the debugger when called.