This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] frame.c (find_frame_sal): Check return value of get_frame_function.
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Michael Snyder <msnyder at vmware dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 15 Mar 2011 09:26:09 -0700
- Subject: Re: [RFA] frame.c (find_frame_sal): Check return value of get_frame_function.
- References: <4D719288.6050301@vmware.com>
> 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