Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Andy Wingo <wingo@igalia.com>
Cc: Alexander Smundak <asmundak@google.com>,
	gdb-patches <gdb-patches@sourceware.org>
Subject: Unwinding through multiple stacks
Date: Wed, 25 Mar 2015 00:00:00 -0000	[thread overview]
Message-ID: <CADPb22ROU+XoYhNhRqLWJycC43nuk9m15GEE3o7f_y_Oie8EzQ@mail.gmail.com> (raw)

Hi.

A topic came up on #gdb that the current patches don't cover.
What if the frame we're trying to unwind through has a different stack?
If the different stack is below the "normal" stack gdb will complain:
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

The code to catch this is in frame.c:

  /* Check that this frame's ID isn't inner to (younger, below, next)
     the next frame.  This happens when a frame unwind goes backwards.
     This check is valid only if this frame and the next frame are
NORMAL.
     See the comment at frame_id_inner for details.  */
  if (get_frame_type (this_frame) == NORMAL_FRAME
      && this_frame->next->unwind->type == NORMAL_FRAME
      && frame_id_inner (get_frame_arch (this_frame->next),
                         get_frame_id (this_frame),
                         get_frame_id (this_frame->next)))
    {
      CORE_ADDR this_pc_in_block;
      struct minimal_symbol *morestack_msym;
      const char *morestack_name = NULL;

      /* gcc -fsplit-stack __morestack can continue the stack anywhere.  */
      this_pc_in_block = get_frame_address_in_block (this_frame);
      morestack_msym = lookup_minimal_symbol_by_pc (this_pc_in_block).minsym;
      if (morestack_msym)
        morestack_name = MSYMBOL_LINKAGE_NAME (morestack_msym);
      if (!morestack_name || strcmp (morestack_name, "__morestack") != 0)
        {
          if (frame_debug)
            {
              fprintf_unfiltered (gdb_stdlog, "-> ");
              fprint_frame (gdb_stdlog, NULL);
              fprintf_unfiltered (gdb_stdlog,
                                  " // this frame ID is inner }\n");
            }
          this_frame->stop_reason = UNWIND_INNER_ID;
          return NULL;
        }
    }

We need to generalize the __morestack solution
and provide it through the unwinders.


             reply	other threads:[~2015-03-25  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-25  0:00 Doug Evans [this message]
2015-03-25  7:35 ` Andy Wingo

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=CADPb22ROU+XoYhNhRqLWJycC43nuk9m15GEE3o7f_y_Oie8EzQ@mail.gmail.com \
    --to=dje@google.com \
    --cc=asmundak@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=wingo@igalia.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