frame_register_unwind(): "frame != NULL" assertion failure
Andrew Cagney
ac131313@redhat.com
Fri Feb 14 14:58:00 GMT 2003
> Here's one possible "fix" for the assertion failure. I've come to the
> conclusion that the real culprit is get_next_frame(), but, unfortunately,
> the rest of gdb is not yet ready for it to return the sentinel frame.
> (See the comment in the patch for more info.) So, until it is, I propose
> that we use this hack...
>
> * frame.c (create_sentinel_frame): Make static. Add forward
> declaration.
> (frame_register_unwind): Add hack for converting NULL frames
> into a sentinel frame.
I think, if there is going to be a hac, then it should be in
read_next_frame_reg().
However, can you please first investigate modifying the start of
mips_init_extra_frame_info() where it does:
proc_desc = get_next_frame (fci) ? .....
to, when get_next_frame(fci) is null, call:
find_proc_desc (get_frame_pc (fci), fci, 1);
that is the current, and not prev frame.
Andrew
> Index: frame.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/frame.c,v
> retrieving revision 1.66
> diff -u -p -r1.66 frame.c
> --- frame.c 2 Feb 2003 20:31:43 -0000 1.66
> +++ frame.c 13 Feb 2003 23:20:22 -0000
> @@ -39,6 +39,8 @@
> #include "command.h"
> #include "gdbcmd.h"
>
> +static struct frame_info * create_sentinel_frame (struct regcache *regcache);
> +
> /* Flag to indicate whether backtraces should stop at main. */
>
> static int backtrace_below_main;
> @@ -180,6 +182,15 @@ frame_register_unwind (struct frame_info
> gdb_assert (realnump != NULL);
> /* gdb_assert (bufferp != NULL); */
>
> + /* Note: kevinb/2003-02-13: This is a hack. The problem is that
> + get_next_frame() can return NULL when it really ought to be
> + returning the sentinel frame. So, when we detect frame == NULL,
> + just use the sentinel frame instead.
> + FIXME: Remove this hack once get_next_frame() has been fixed
> + to never return NULL. */
> + if (frame == NULL)
> + frame = create_sentinel_frame (current_regcache);
> +
> /* NOTE: cagney/2002-11-27: A program trying to unwind a NULL frame
> is broken. There is always a frame. If there, for some reason,
> isn't, there is some pretty busted code as it should have
> @@ -429,7 +440,7 @@ frame_map_regnum_to_name (int regnum)
>
> /* Create a sentinel frame. */
>
> -struct frame_info *
> +static struct frame_info *
> create_sentinel_frame (struct regcache *regcache)
> {
> struct frame_info *frame = FRAME_OBSTACK_ZALLOC (struct frame_info);
>
>
More information about the Gdb
mailing list