public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] avoid infinite loop with bad debuginfo
Date: Tue, 19 Nov 2013 15:10:00 -0000	[thread overview]
Message-ID: <528B7F15.7040605@redhat.com> (raw)
In-Reply-To: <87d2lxpo1l.fsf@fleche.redhat.com>

On 11/18/2013 06:23 PM, Tom Tromey wrote:
>>> +	  if (VALUE_LVAL (new_val) == lval_register
>>> +	      && value_lazy (new_val)
>>> +	      && frame_id_eq (VALUE_FRAME_ID (new_val), last_frame_id))
> 
> Pedro> I think this should also check the regnum:
> 
> Barf.  I have a memory of actually writing that.  False memory I guess.
> Sigh.
> 
>>> #4  0x0000007fb7f0956c in clone () from /lib64/libc.so.6
>>> #5  0x0000007fb7f0956c in clone () from /lib64/libc.so.6
>>> Backtrace stopped: previous frame identical to this frame (corrupt stack?)
> 
> Pedro> Doesn't this all then mean that we somehow ended up with two identical
> Pedro> frames with the same id on the frame chain (#4 and #5) ?
> Pedro> That seems very wrong to me.
> 
> Pedro> It seems to be a better fix would be to make
> Pedro> get_prev_frame_1/get_prev_frame_raw discard frame #5 before it
> Pedro> was ever linked in.  Either that, or, if we really need to keep
> Pedro> #5 linked in, we should find a way for frame_id_eq (#4, #5) to
> Pedro> return false.
> 
> I will look into it, but my recollection is that last time we got into
> this area, it was somehow undesirable to undo whatever changes were done
> by existing frame sniffers.

Hmm, I don't think that's the same issue.   I'm just talking about
something like moving the frame_id_eq check to the end of
get_prev_frame_1, after calling get_prev_frame_raw.  Something
like:

  prev_frame = get_prev_frame_raw (this_frame);

  /* Check that this and the prev frame are not identical.  If they
     are, there is most likely a stack cycle.  */
  if (prev_frame != NULL
      && frame_id_eq (get_frame_id (prev_frame),
		      get_frame_id (this_frame)))
    {
      if (frame_debug)
	{
	  fprintf_unfiltered (gdb_stdlog, "-> ");
	  fprint_frame (gdb_stdlog, NULL);
	  fprintf_unfiltered (gdb_stdlog, " // this frame has same ID }\n");
	}
      this_frame->stop_reason = UNWIND_SAME_ID;
      /* Unlink.  */
      this_frame->prev = NULL;
      return NULL;
    }

  return prev_frame;
}

-- 
Pedro Alves

  reply	other threads:[~2013-11-19 15:09 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-13 20:51 [PATCH 0/2] fix multi-threaded unwinding on AArch64 Tom Tromey
2013-11-13 20:51 ` [PATCH 2/2] handle an unspecified return address column Tom Tromey
2013-11-22 18:22   ` Tom Tromey
2013-11-26 13:55   ` Joel Brobecker
2013-11-26 14:30     ` Mark Kettenis
2013-11-26 14:37       ` Joel Brobecker
2013-11-26 14:41         ` Mark Kettenis
2013-11-26 14:42           ` Joel Brobecker
2013-11-26 14:50           ` Tom Tromey
2013-11-26 15:05           ` Tom Tromey
2013-11-26 15:16       ` Tom Tromey
2013-11-26 16:11         ` Joel Brobecker
2013-11-13 22:03 ` [PATCH 1/2] avoid infinite loop with bad debuginfo Tom Tromey
2013-11-14 17:34   ` Pedro Alves
2013-11-18 18:25     ` Tom Tromey
2013-11-19 15:10       ` Pedro Alves [this message]
2013-11-19 15:47         ` Tom Tromey
2013-11-19 16:33           ` Pedro Alves
2013-11-19 19:07             ` Tom Tromey
2013-11-19 20:24               ` Pedro Alves
2013-11-19 20:56                 ` Tom Tromey
2013-11-20 18:27                   ` [PATCH] Don't let two frames with the same id end up in the frame chain. (Re: [PATCH 1/2] avoid infinite loop with bad debuginfo) Pedro Alves
2013-11-21  0:33                     ` Tom Tromey
2013-11-21 16:40                       ` Pedro Alves
2013-11-21 19:25                         ` Tom Tromey
2013-11-22 14:13                           ` [COMMITTED] Make use of the frame stash to detect wider stack cycles. (was: Re: [PATCH] Don't let two frames with the same id end up in the frame chain. (Re: [PATCH 1/2] avoid infinite loop with bad debuginfo)) Pedro Alves
2013-11-22 14:29                         ` [PATCH] Don't let two frames with the same id end up in the frame chain. (Re: [PATCH 1/2] avoid infinite loop with bad debuginfo) Pedro Alves
2013-11-22 14:52       ` [PATCH 1/2] avoid infinite loop with bad debuginfo Pedro Alves
2013-11-22 17:16         ` Tom Tromey
2013-11-22 17:56           ` Pedro Alves
2013-11-19 15:52     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=528B7F15.7040605@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).