From: Tom Tromey <tromey@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Paul Koning <paulkoning@comcast.net>,
pmuldoon@redhat.com, gdb-patches@sourceware.org
Subject: Re: Python: fetch value when building gdb.Value object
Date: Tue, 04 Oct 2011 15:40:00 -0000 [thread overview]
Message-ID: <m3aa9grcji.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20111001090443.GA11227@host1.jankratochvil.net> (Jan Kratochvil's message of "Sat, 1 Oct 2011 11:04:43 +0200")
>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
Paul> If so, most of the Python code seems to be a candidate for
Paul> RETURN_MASK_ERROR.
Jan> In fact I do not know, it is a Python thing.
Jan> RETURN_MASK_ALL is right if returned PyExc_KeyboardInterrupt will really abort
Jan> any execution of Python code. It is probably so, as suggested by:
Jan> http://docs.python.org/library/exceptions.html#exceptions.KeyboardInterrupt
Jan> RETURN_MASK_ERROR is right otherwise, but only if it is safe to
Jan> longjmp out from a code called by Python. This may not be true.
Jan> Python may be C++ exceptions throwing safe but it cannot be safe
Jan> for the GDB longjmp exceptions. But this case would mean Python is
Jan> buggy for CTRL-C on its own so RETURN_MASK_ERROR probably is not
Jan> right.
I think the Python code in GDB should use RETURN_MASK_ALL in all cases.
The C-c case should be turned into PyExc_KeyboardInterrupt.
Other exceptions should either be ignored or turned into the appropriate
Python exception, depending on the situation.
Letting the C-c case longjmp over the Python implementation is bad, I
would imagine it will result in crashes. Ignoring it is also bad.
Paul> Probably related: I just tried an infinite Python loop and found
Paul> that control-C had no effect. I wonder if the Python interpreter
Paul> is setting up its own control-C trap (quite possibly -- that's a
Paul> Python exception after all) and we're losing it somewhere along
Paul> the lines.
Jan> Yes, this is the kind of bug from it, thanks for checking it.
I suspect we have to override Python's SIGINT handling.
I haven't investigated.
Jan> 2011-10-01 Jan Kratochvil <jan.kratochvil@redhat.com>
Jan> * python/py-value.c (valpy_getitem): New variable back_to. Register
Jan> xfree of field to it. Call do_cleanups for it. Use RETURN_MASK_ERROR
Jan> instead of RETURN_MASK_ALL.
This patch runs the cleanups too late. They have to be done before
GDB_PY_HANDLE_EXCEPTION, as that has an early return in it. Cleanest is
probably doing it all inside the TRY_CATCH.
Tom
next prev parent reply other threads:[~2011-10-04 15:40 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-21 16:17 Paul Koning
2011-09-28 19:29 ` Phil Muldoon
2011-09-28 20:06 ` Paul Koning
2011-10-04 15:43 ` Tom Tromey
2011-09-28 20:42 ` Paul Koning
2011-10-01 9:05 ` Jan Kratochvil
2011-10-03 10:22 ` Phil Muldoon
2011-10-04 15:40 ` Tom Tromey [this message]
2011-10-01 9:29 ` Jan Kratochvil
2011-10-01 10:23 ` Pedro Alves
2011-10-01 11:03 ` Jan Kratochvil
2011-10-01 12:17 ` Python: fetch value when building gdb.Value object [rediff] Jan Kratochvil
2011-10-01 18:58 ` Paul Koning
2011-10-03 10:19 ` Phil Muldoon
2011-10-03 16:16 ` Paul Koning
2011-10-01 1:00 ` [PING] [RFA] Re: Python: fetch value when building gdb.Value object Paul Koning
2011-10-04 15:45 ` Tom Tromey
2011-10-04 15:51 ` Paul Koning
2011-10-14 20:03 ` Tom Tromey
2011-10-14 20:30 ` Paul Koning
2011-10-19 20:56 ` Tom Tromey
2011-10-19 20:58 ` Paul Koning
2011-10-20 15:09 ` Tom Tromey
2011-10-21 7:46 ` Paul Koning
2011-10-21 17:13 ` Tom Tromey
2011-10-14 23:36 ` Jim Blandy
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=m3aa9grcji.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=paulkoning@comcast.net \
--cc=pmuldoon@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