From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: Pedro Alves <pedro@codesourcery.com>,
gdb-patches@sourceware.org, tromey@redhat.com,
Joel Brobecker <brobecker@adacore.com>
Subject: Re: RFC: next/finish/etc -vs- exceptions
Date: Thu, 25 Nov 2010 04:54:00 -0000 [thread overview]
Message-ID: <20101125045306.GA2549@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <20090610171328.GA32661@caradoc.them.org>
On Wed, 10 Jun 2009 19:13:28 +0200, Daniel Jacobowitz wrote:
[...]
> exceptions can be thrown through
> signal handlers on many platforms; so yes, they might switch stack.
On Fedora 14 x86_64 getting instead of a caught exception-from-sighandler:
terminate called after throwing an instance of 'int'
from the testcase below and ISO C++ says:
The common subset of the C and C++ languages consists of all
declarations, definitions, and expressions that may appear in a well
formed C++ program and also in a conforming C program. A POF (“plain
old function”) is a function that uses only features from this common
subset, and that does not directly or indirectly use any function that
is not a POF, except that it may use functions defined in Clause 29
that are not member functions. All signal handlers shall have
C linkage. A POF that could be used as a signal handler in
a conforming C program does not produce undefined behavior when used
as a signal handler in a C++ program. The behavior of any other
function used as a signal handler in a C++ program is
implementation-defined.228
228) In particular, a signal handler using exception handling is very
-------------------------------------------------
likely to have problems. Also, invoking std::exit may cause
-----------------------
destruction of objects, including those of the standard library
implementation, which, in general, yields undefined behavior in
a signal handler (see 1.9).
If this really does not have to work it means for GDB the sigaltstack case is
unrelated to this "next/finish/etc -vs- exceptions" patch.
Thanks,
Jan
#include <signal.h>
#include <assert.h>
#include <iostream>
using namespace std;
static void
handler (int signo)
{
throw 1;
}
int
main (void)
{
sighandler_t sigvar;
sigvar = signal (SIGUSR1, handler);
assert (sigvar == SIG_DFL);
try
{
int i;
i = raise (SIGUSR1);
assert (i == 0);
}
catch (...)
{
cout << "caught" << endl;
}
cout << "done" << endl;
}
next prev parent reply other threads:[~2010-11-25 4:54 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-29 22:32 Tom Tromey
2009-05-30 21:08 ` Doug Evans
2009-05-30 23:18 ` Tom Tromey
2009-06-10 16:13 ` Joel Brobecker
2009-06-10 16:50 ` Tom Tromey
2009-06-10 17:05 ` Pedro Alves
2009-06-10 17:13 ` Daniel Jacobowitz
2009-06-10 17:47 ` Pedro Alves
2009-06-10 18:32 ` Tom Tromey
2009-06-10 18:49 ` Pedro Alves
2009-06-12 20:49 ` Tom Tromey
2009-06-12 21:51 ` Pedro Alves
2009-06-12 22:07 ` Pedro Alves
2010-11-25 4:54 ` Jan Kratochvil [this message]
2009-06-11 14:45 ` Joel Brobecker
2009-06-11 15:47 ` Tom Tromey
2009-07-24 17:38 ` Tom Tromey
2009-07-24 18:54 ` Pedro Alves
2009-07-24 19:18 ` Tom Tromey
2009-09-09 18:56 ` Tom Tromey
2010-10-07 1:37 Tom Tromey
2010-11-24 17:53 ` Joel Brobecker
2010-11-24 18:24 ` Tom Tromey
2010-11-25 7:59 ` Jan Kratochvil
2010-11-27 17:25 ` Doug Evans
2010-11-28 8:29 ` Joel Brobecker
2010-11-30 16:43 ` Tom Tromey
2010-11-30 17:02 ` Jan Kratochvil
2010-11-30 17:15 ` Phil Muldoon
2010-11-30 20:15 ` Tom Tromey
2010-12-01 13:42 ` Jan Kratochvil
2010-12-01 21:40 ` Tom Tromey
2010-11-30 18:23 ` Tom Tromey
2010-11-30 18:55 ` Tom Tromey
2010-12-02 15:32 ` Tom Tromey
2010-12-09 16:37 ` Tom Tromey
2010-12-10 4:52 ` Jan Kratochvil
2010-12-10 20:07 ` Tom Tromey
2010-12-11 5:27 ` Jan Kratochvil
2010-12-15 21:18 ` Tom Tromey
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=20101125045306.GA2549@host0.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=brobecker@adacore.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.com \
--cc=tromey@redhat.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox