This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: fix PR python/13351


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]