This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Python: fetch value when building gdb.Value object
- From: Tom Tromey <tromey at redhat dot com>
- To: Paul Koning <paulkoning at comcast dot net>
- Cc: pmuldoon at redhat dot com, gdb-patches at sourceware dot org
- Date: Tue, 04 Oct 2011 09:42:53 -0600
- Subject: Re: Python: fetch value when building gdb.Value object
- References: <36B29E9D-F2B3-446F-AF8A-97254A3AAEE2@comcast.net> <m3ipocii6a.fsf@redhat.com> <F2A2A221-1124-4284-B6E7-06A07500549B@comcast.net>
>>>>> "Paul" == Paul Koning <paulkoning@comcast.net> writes:
Paul> The first of those two has a traceback because the gdb.Value
Paul> arithmetic operations have a TRY_CATCH in them. The second one
Paul> has no traceback because the "nonzero" method of gdb.Value doesn't
Paul> do TRY_CATCH.
It is a bug that nonzero doesn't use TRY_CATCH.
In the Python-facing code, the rule is that any calls into gdb proper
which may throw must be wrapped in TRY_CATCH and then must have
exception-conversion code, usually just GDB_PY_HANDLE_EXCEPTION.
This rule is needed to interface properly between gdb exceptions (which
longjmp) and Python exceptions (which do not). Omitting it can lead, I
believe, to crashes.
Tom