public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* frame.c assertion failure
@ 2003-05-07 22:25 Kevin Buettner
  2003-05-07 23:40 ` Kevin Buettner
  0 siblings, 1 reply; 7+ messages in thread
From: Kevin Buettner @ 2003-05-07 22:25 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb

Any idea what to do about the following assertion failure?

    ../../src/gdb/frame.c:2083:  internal-error:  get_frame_type: 
    Assertion `frame->unwind->type != UNKNOWN_FRAME' failed.

Here are the details:

(top gdb) bt 7
#0  internal_error (file=0x82acccd "../../src/gdb/frame.c", line=2083, 
    string=0x82accb2 "%s%sAssertion `%s' failed.") at ../../src/gdb/utils.c:800
#1  0x08141d9f in get_frame_type (frame=0x87af19c) at ../../src/gdb/frame.c:2083
#2  0x080f39d6 in mips_init_extra_frame_info (fromleaf=0, fci=0x87af19c)
    at ../../src/gdb/mips-tdep.c:2504
#3  0x080e39a7 in gdbarch_deprecated_init_extra_frame_info (gdbarch=0x8346560, 
    fromleaf=0, frame=0x87af19c) at ../../src/gdb/gdbarch.c:4577
#4  0x0814129f in legacy_get_prev_frame (this_frame=0x87af138)
    at ../../src/gdb/frame.c:1602
#5  0x081417d8 in get_prev_frame (this_frame=0x87af138)
    at ../../src/gdb/frame.c:1846
#6  0x080d5a52 in backtrace_command_1 (count_exp=0x0, show_locals=0, from_tty=1)
    at ../../src/gdb/stack.c:981
(More stack frames follow...)
(top gdb) up
#1  0x08141d9f in get_frame_type (frame=0x87af19c) at ../../src/gdb/frame.c:2083
2083    ../../src/gdb/frame.c: No such file or directory.
        in ../../src/gdb/frame.c
(top gdb) p frame->unwind
$1 = (struct frame_unwind *) 0x82ad184
(top gdb) p *frame->unwind
$2 = {type = UNKNOWN_FRAME, this_id = 0x81406fc <legacy_saved_regs_this_id>, 
  prev_register = 0x8140424 <legacy_saved_regs_prev_register>}
(top gdb) p legacy_saved_regs_unwind
$3 = (struct frame_unwind *) 0x82ad184

AFAICT, we're going to see this problem whenever frame_unwind_find_by_pc()
returns legacy_saved_regs_unwind.

Kevin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: frame.c assertion failure
  2003-05-07 22:25 frame.c assertion failure Kevin Buettner
@ 2003-05-07 23:40 ` Kevin Buettner
  2003-05-08  0:03   ` Andrew Cagney
  0 siblings, 1 reply; 7+ messages in thread
From: Kevin Buettner @ 2003-05-07 23:40 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb

On May 7,  3:25pm, Kevin Buettner wrote:

>     ../../src/gdb/frame.c:2083:  internal-error:  get_frame_type: 
>     Assertion `frame->unwind->type != UNKNOWN_FRAME' failed.

FWIW, this problem is "fixed" by backing out the following change:

2003-04-16  Andrew Cagney  <cagney@redhat.com>

	* frame.c (get_prev_frame): Do not initialize "unwind" or "type",
	update comments.
	(get_frame_type): Initialize unwind and type when needed.
	(get_frame_id, frame_register_unwind): Ditto.

Kevin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: frame.c assertion failure
  2003-05-07 23:40 ` Kevin Buettner
@ 2003-05-08  0:03   ` Andrew Cagney
  2003-05-08  0:22     ` Andrew Cagney
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Cagney @ 2003-05-08  0:03 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb

> On May 7,  3:25pm, Kevin Buettner wrote:
> 
> 
>>     ../../src/gdb/frame.c:2083:  internal-error:  get_frame_type: 
>>     Assertion `frame->unwind->type != UNKNOWN_FRAME' failed.
> 
> 
> FWIW, this problem is "fixed" by backing out the following change:
> 
> 2003-04-16  Andrew Cagney  <cagney@redhat.com>
> 
> 	* frame.c (get_prev_frame): Do not initialize "unwind" or "type",
> 	update comments.
> 	(get_frame_type): Initialize unwind and type when needed.
> 	(get_frame_id, frame_register_unwind): Ditto.

The code is:

> enum frame_type
> get_frame_type (struct frame_info *frame)
> {
>   /* Some targets still don't use [generic] dummy frames.  Catch them
>      here.  */
>   if (!DEPRECATED_USE_GENERIC_DUMMY_FRAMES
>       && deprecated_frame_in_dummy (frame))
>     return DUMMY_FRAME;
>   if (frame->unwind == NULL)
>     {

I'd only expect the d10v to execute the following.

>       /* Initialize the frame's unwinder because it is that which
>          provides the frame's type.  */
>       frame->unwind = frame_unwind_find_by_pc (current_gdbarch,
>                                                get_frame_pc (frame));

For the d10v, this never returns legacy_saved_regs_unwinder and so ....

>       /* FIXME: cagney/2003-04-02: Rather than storing the frame's
>          type in the frame, the unwinder's type should be returned
>          directly.  Unfortunatly, legacy code, called by
>          legacy_get_prev_frame, explicitly set the frames type using
>          the method deprecated_set_frame_type().  */
>       gdb_assert (frame->unwind->type != UNKNOWN_FRAME);

... this can never be UNKNOWN_FRAME.

>       frame->type = frame->unwind->type;
>     }
>   if (frame->type == UNKNOWN_FRAME)
>     return NORMAL_FRAME;
>   else
>     return frame->type;
> }

What should happen is:

int
legacy_frame_p (struct gdbarch *current_gdbarch)
{
   return (DEPRECATED_INIT_FRAME_PC_P ()
           || DEPRECATED_INIT_FRAME_PC_FIRST_P ()
           || DEPRECATED_INIT_EXTRA_FRAME_INFO_P ()
           || DEPRECATED_FRAME_CHAIN_P ()
           || !gdbarch_unwind_dummy_id_p (current_gdbarch)
           || !SAVE_DUMMY_FRAME_TOS_P ());

should return true, and hence get_prev_frame should call 
legacy_get_prev_frame() which should always set ->unwind?

'set debug frame 1'

Will at least indicate which type of frame is being created.

(unless you're trying to get code to use the new unwinder that is, or 
its some sort of inner most frame edge case?).

Andrew


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: frame.c assertion failure
  2003-05-08  0:03   ` Andrew Cagney
@ 2003-05-08  0:22     ` Andrew Cagney
  2003-05-08  5:49       ` Kevin Buettner
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Cagney @ 2003-05-08  0:22 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb


> (unless you're trying to get code to use the new unwinder that is, or its some sort of inner most frame edge case?).

Nope, the backtrace tells all ...

> #0  internal_error (file=0x82acccd "../../src/gdb/frame.c", line=2083, 
>     string=0x82accb2 "%s%sAssertion `%s' failed.") at ../../src/gdb/utils.c:800
> #1  0x08141d9f in get_frame_type (frame=0x87af19c) at ../../src/gdb/frame.c:2083
> #2  0x080f39d6 in mips_init_extra_frame_info (fromleaf=0, fci=0x87af19c)
>     at ../../src/gdb/mips-tdep.c:2504

The legacy mips target is calling get_frame_type() on a frame that 
hasn't yet had it's type initialized.  I can think of:

-- Tweaking the below if to also test !legacy_frame_p().

> enum frame_type
> get_frame_type (struct frame_info *frame)
...
>   if (frame->unwind == NULL)

-- Tweaking the assignment to also check !legacy_frame_p().

>       /* FIXME: cagney/2003-04-02: Rather than storing the frame's
>          type in the frame, the unwinder's type should be returned
>          directly.  Unfortunatly, legacy code, called by
>          legacy_get_prev_frame, explicitly set the frames type using
>          the method deprecated_set_frame_type().  */
>       gdb_assert (frame->unwind->type != UNKNOWN_FRAME);

-- explicitly setting ->unwind to legacy_... in legacy_get_prev_frame.

I think the first is best:

- the second causes a get_frame_pc() call when, quite possibly, the 
legacy code isn't ready for this (see comments in legacy_get_prev_frame).

- the third leaves things open to gdb unintentionally calling a legacy 
unwind method.

Andrew


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: frame.c assertion failure
  2003-05-08  0:22     ` Andrew Cagney
@ 2003-05-08  5:49       ` Kevin Buettner
  2003-05-08 14:05         ` Andrew Cagney
  0 siblings, 1 reply; 7+ messages in thread
From: Kevin Buettner @ 2003-05-08  5:49 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb

On May 7,  8:22pm, Andrew Cagney wrote:

> The legacy mips target is calling get_frame_type() on a frame that 
> hasn't yet had it's type initialized.  I can think of:
> 
> -- Tweaking the below if to also test !legacy_frame_p().
> 
> > enum frame_type
> > get_frame_type (struct frame_info *frame)
> ...
> >   if (frame->unwind == NULL)

This works.  Here's the patch:

	* frame.c (get_frame_type): Don't attempt to lazily initialize
	frame's unwinder for legacy frames.

Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.111
diff -u -p -r1.111 frame.c
--- frame.c	5 May 2003 18:33:10 -0000	1.111
+++ frame.c	8 May 2003 05:45:52 -0000
@@ -2069,7 +2069,7 @@ get_frame_type (struct frame_info *frame
   if (!DEPRECATED_USE_GENERIC_DUMMY_FRAMES
       && deprecated_frame_in_dummy (frame))
     return DUMMY_FRAME;
-  if (frame->unwind == NULL)
+  if (frame->unwind == NULL && !legacy_frame_p (current_gdbarch))
     {
       /* Initialize the frame's unwinder because it is that which
          provides the frame's type.  */

Okay?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: frame.c assertion failure
  2003-05-08  5:49       ` Kevin Buettner
@ 2003-05-08 14:05         ` Andrew Cagney
  2003-05-08 15:39           ` Kevin Buettner
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Cagney @ 2003-05-08 14:05 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb


> This works.  Here's the patch:
> 
> 	* frame.c (get_frame_type): Don't attempt to lazily initialize
> 	frame's unwinder for legacy frames.

Don't forget a comment :-)

> Index: frame.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/frame.c,v
> retrieving revision 1.111
> diff -u -p -r1.111 frame.c
> --- frame.c	5 May 2003 18:33:10 -0000	1.111
> +++ frame.c	8 May 2003 05:45:52 -0000
> @@ -2069,7 +2069,7 @@ get_frame_type (struct frame_info *frame
>    if (!DEPRECATED_USE_GENERIC_DUMMY_FRAMES
>        && deprecated_frame_in_dummy (frame))
>      return DUMMY_FRAME;
> -  if (frame->unwind == NULL)
> +  if (frame->unwind == NULL && !legacy_frame_p (current_gdbarch))
>      {
>        /* Initialize the frame's unwinder because it is that which
>           provides the frame's type.  */
> 
> Okay?

yup.

Andrew


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: frame.c assertion failure
  2003-05-08 14:05         ` Andrew Cagney
@ 2003-05-08 15:39           ` Kevin Buettner
  0 siblings, 0 replies; 7+ messages in thread
From: Kevin Buettner @ 2003-05-08 15:39 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb

On May 8, 10:05am, Andrew Cagney wrote:

> Don't forget a comment :-)
[...]
> > Okay?
> 
> yup.

It's in.  This is what I committed...

	* frame.c (get_frame_type): Don't attempt to lazily initialize
	frame's unwinder for legacy frames.

Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.111
diff -u -p -r1.111 frame.c
--- frame.c	5 May 2003 18:33:10 -0000	1.111
+++ frame.c	8 May 2003 15:32:59 -0000
@@ -2069,7 +2069,12 @@ get_frame_type (struct frame_info *frame
   if (!DEPRECATED_USE_GENERIC_DUMMY_FRAMES
       && deprecated_frame_in_dummy (frame))
     return DUMMY_FRAME;
-  if (frame->unwind == NULL)
+
+  /* Some legacy code, e.g, mips_init_extra_frame_info() wants
+     to determine the frame's type prior to it being completely
+     initialized.  Don't attempt to lazily initialize ->unwind for
+     legacy code.  It will be initialized in legacy_get_prev_frame().  */
+  if (frame->unwind == NULL && !legacy_frame_p (current_gdbarch))
     {
       /* Initialize the frame's unwinder because it is that which
          provides the frame's type.  */

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-05-08 15:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-07 22:25 frame.c assertion failure Kevin Buettner
2003-05-07 23:40 ` Kevin Buettner
2003-05-08  0:03   ` Andrew Cagney
2003-05-08  0:22     ` Andrew Cagney
2003-05-08  5:49       ` Kevin Buettner
2003-05-08 14:05         ` Andrew Cagney
2003-05-08 15:39           ` Kevin Buettner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).