RFA: fix PR python/13351

Pedro Alves palves@redhat.com
Wed Feb 1 10:41:00 GMT 2012


On 01/31/2012 09:59 PM, Tom Tromey wrote:
> --- a/gdb/python/py-symbol.c
> +++ b/gdb/python/py-symbol.c
> @@ -292,8 +292,9 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
>  
>        TRY_CATCH (except, RETURN_MASK_ALL)
>  	{
> -	  selected_frame = get_selected_frame (_("No frame selected."));
> -	  block = get_frame_block (selected_frame, NULL);
> +	  selected_frame = get_selected_frame_if_set ();
> +	  if (selected_frame)
> +	    block = get_frame_block (selected_frame, NULL);
>  	}

I'm getting a bit nervous about get_selected_frame_if_set usages getting spread
around.  (It feels a bit like we're going back in time, to a time before the
always-a-frame work.)  The selected frame may not be set, while we still may have
a current frame, so get_selected_frame would lazily select it, and so the lookup
would still start on a frame block.  If you don't want an error, you can pass NULL
to get_selected_frame.

-- 
Pedro Alves



More information about the Gdb-patches mailing list