[RFA] frame.c (find_frame_sal): Check return value of get_frame_function.

Joel Brobecker brobecker@adacore.com
Tue Mar 15 16:49:00 GMT 2011


> 2011-03-04  Michael Snyder  <msnyder@vmware.com>
> 
> 	* frame.c (find_frame_sal): Check return value of get_frame_function.

I think that the change is correct, but I'm not completely sure,
so a second pair of eyes would be nice.

My thinking: It is entirely plausible that get_next_frame (frame)
returns a frame with a PC for which there is no debugging info.
In that case, it's the same as not having line info.

> Index: frame.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/frame.c,v
> retrieving revision 1.291
> diff -u -p -r1.291 frame.c
> --- frame.c	7 Jan 2011 19:36:17 -0000	1.291
> +++ frame.c	5 Mar 2011 01:27:39 -0000
> @@ -1892,15 +1892,16 @@ find_frame_sal (struct frame_info *frame
>  	sym = inline_skipped_symbol (inferior_ptid);
>  
>        init_sal (sal);
> -      if (SYMBOL_LINE (sym) != 0)
> +      if (sym && SYMBOL_LINE (sym) != 0)
>  	{
>  	  sal->symtab = SYMBOL_SYMTAB (sym);
>  	  sal->line = SYMBOL_LINE (sym);
>  	}
>        else
> -	/* If the symbol does not have a location, we don't know where
> -	   the call site is.  Do not pretend to.  This is jarring, but
> -	   we can't do much better.  */
> +	/* If the symbol does not have a location (or we didn't find a
> +	   symbol), we don't know where the call site is.  Do not
> +	   pretend to.  This is jarring, but we can't do much
> +	   better.  */
>  	sal->pc = get_frame_pc (frame);
>  
>        return;


-- 
Joel



More information about the Gdb-patches mailing list