From: Alain Schneble <a.s@realize.ch>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: SIGTRAP in kill emulation on Windows
Date: Fri, 26 Aug 2016 10:58:58 +0200 [thread overview]
Message-ID: <86zinzhpnx.fsf@realize.ch> (raw)
In-Reply-To: <83wpj4c4yz.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 26 Aug 2016 11:24:52 +0300")
Eli Zaretskii <eliz@gnu.org> writes:
>> Sending SIGTRAP to a process -- whether it's an unrelated, child or the
>> calling Emacs process itself -- does not seem to have any effect as long
>> as no debugger is attached to the receiving process.
>
> Do you see the same with the debugbreak program you've built earlier?
> If not, then that program does something that your patch doesn't.
Yes, debugbreak and the proposed implementation behave identically.
> Also, were all the programs you tried built with MinGW? If so,
> perhaps try with other programs, like Python or one of the programs
> that came with Windows. I think the results of the call depend on the
> exception handlers installed by the program when it starts, so
> different programs and different ways of building programs might have
> different effects.
I tried it with different programs (e.g. notepad, calculator as well as
programs built with MinGW such as Emacs and find). Yes, I think as well
that it depends on the exception handlers installed by the programs. So
there might be programs out there that will terminate. But I had no
luck in finding one so far...
> And finally, what happens if you signal the calling Emacs process that
> is itself being debugged? I guess the debugger will kick in, but if
> you then continue execution, does Emacs continues to run normally?
Exactly, the control will be passed to the debugger. I did not see any
strange behavior when resuming it ( (gdb) cont ). After all, this will
be used by one of the use cases I have in mind, to be able to switch
back to the debugger from within the debuggee.
>> At least this is what I observe on Windows 10. Shall I test on
>> other OS versions as well?
>
> We could ask people here to test on other versions and report their
> results.
FWIW, I tested on Windows 7 in addition to Windows 10. Same behavior
on both systems.
>> If so, I would have to install say an Win XP first as I do not
>> have one available right now.
>
> I could test on XP here.
Thanks. That would save me some time.
>> Unfortunately, on MSDN the remark on
>> DebugBreakProcess says it causes the receiving process to terminate in
>> most cases, see
>> https://msdn.microsoft.com/en-us/library/windows/desktop/ms679298(v=vs.85).aspx
>>
>> But with all processes I tried, none of them was ever terminated.
>
> That's a pity; on GNU/Linux the target program does terminate. If
> there's nothing that can be done, we will just have to document this
> quirk, at least for many/most programs Emacs users will meet on their
> systems.
Yes, and on GNU/Linux I observed that it prints a backtrace prior to
termination. But that's kind of irrelevant here I guess. Where would
be the best place to document this quirk (c, signal-process, info
manual)?
FWIW, there is probably something we could do about it -- query if the
process in question is attached to a debugger. If not, we could
terminate it.
>> >From ecf00b52957bb0bf15735180a67cc9ce7027ff19 Mon Sep 17 00:00:00 2001
>> From: Alain Schneble <a.s@realize.ch>
>> Date: Thu, 25 Aug 2016 21:31:48 +0200
>> Subject: [PATCH] Support SIGTRAP in kill emulation on Windows
>
> The (latest version of) your patch looks fine to me, modulo the issues
> mentioned above. If nothing new and no other comments come up within
> a week, let's install this, with the necessary updates for the NEWS
> entry.
Thanks, Eli.
next prev parent reply other threads:[~2016-08-26 8:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-25 15:08 SIGTRAP in kill emulation on Windows Alain Schneble
2016-08-25 16:18 ` Eli Zaretskii
2016-08-25 20:02 ` Alain Schneble
2016-08-25 20:09 ` Alain Schneble
2016-08-26 8:24 ` Eli Zaretskii
2016-08-26 8:58 ` Alain Schneble [this message]
2016-08-26 9:13 ` Eli Zaretskii
2016-08-26 9:31 ` Eli Zaretskii
2016-08-26 9:47 ` Alain Schneble
2016-08-26 10:19 ` Alain Schneble
2016-10-08 13:54 ` Eli Zaretskii
2016-10-08 14:36 ` Alain Schneble
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86zinzhpnx.fsf@realize.ch \
--to=a.s@realize.ch \
--cc=eliz@gnu.org \
--cc=emacs-devel@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).