This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFA: fix PR python/13351
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 01 Feb 2012 16:11:42 +0000
- Subject: Re: RFA: fix PR python/13351
- References: <m339avednx.fsf@fleche.redhat.com> <4F2916BE.6020105@redhat.com> <m3pqdybkv6.fsf@fleche.redhat.com>
On 02/01/2012 04:04 PM, Tom Tromey wrote:
> I don't understand why get_selected_frame is the preferred API. To me
> it seems clearly worse: passing in an error message is ugly, and it
> isn't really possible to distinguish "no frames" from "an exception was
> thrown for some other reason". Neither of these problems would affect
> get_selected_frame_if_set.
>
> Perhaps I can do the detection by checking has_stack_frames? Is that safe?
Yes. Though you could just call get_selected_block instead (which does the
has_stack_frames check).
TRY_CATCH (except, RETURN_MASK_ALL)
{
- selected_frame = get_selected_frame (_("No frame selected."));
- block = get_frame_block (selected_frame, NULL);
+ block = get_selected_block (NULL);
}
GDB_PY_HANDLE_EXCEPTION (except);
--
Pedro Alves