Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Markus Metzger <markus.t.metzger@intel.com>
To: palves@redhat.com
Cc: gdb-patches@sourceware.org
Subject: [PATCH v2 1/3] frame: add skip_tailcall_frames
Date: Fri, 05 Feb 2016 14:18:00 -0000	[thread overview]
Message-ID: <1454681922-2228-1-git-send-email-markus.t.metzger@intel.com> (raw)

Add a new function skip_tailcall_frames to skip TAILCALL_FRAME frames.

2016-02-05  Markus Metzger  <markus.t.metzger@intel.com>

gdb/
	* frame.h (skip_tailcall_frames): New.
	* frame.c (skip_tailcall_frames): New.
	(frame_pop): Call skip_tailcall_frames.
	* infcmd.c: Call skip_tailcall_frames.
---
 gdb/frame.c  | 14 ++++++++++++--
 gdb/frame.h  |  4 ++++
 gdb/infcmd.c |  3 +--
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/gdb/frame.c b/gdb/frame.c
index 48c9b33..b7832c7 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -438,6 +438,17 @@ skip_artificial_frames (struct frame_info *frame)
   return frame;
 }
 
+/* See frame.h.  */
+
+struct frame_info *
+skip_tailcall_frames (struct frame_info *frame)
+{
+  while (get_frame_type (frame) == TAILCALL_FRAME)
+    frame = get_prev_frame (frame);
+
+  return frame;
+}
+
 /* Compute the frame's uniq ID that can be used to, later, re-find the
    frame.  */
 
@@ -972,8 +983,7 @@ frame_pop (struct frame_info *this_frame)
 
   /* Ignore TAILCALL_FRAME type frames, they were executed already before
      entering THISFRAME.  */
-  while (get_frame_type (prev_frame) == TAILCALL_FRAME)
-    prev_frame = get_prev_frame (prev_frame);
+  prev_frame = skip_tailcall_frames (prev_frame);
 
   /* Make a copy of all the register values unwound from this frame.
      Save them in a scratch buffer so that there isn't a race between
diff --git a/gdb/frame.h b/gdb/frame.h
index 2e05dfa..7e8b01e 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -820,5 +820,9 @@ extern int frame_unwinder_is (struct frame_info *fi,
 
 extern enum language get_frame_language (struct frame_info *frame);
 
+/* Return the first non-tailcall frame above FRAME or FRAME if it is not a
+   tailcall frame.  */
+
+extern struct frame_info *skip_tailcall_frames (struct frame_info *frame);
 
 #endif /* !defined (FRAME_H)  */
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index df13896..930dc61 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2002,8 +2002,7 @@ finish_command (char *arg, int from_tty)
 
   /* Ignore TAILCALL_FRAME type frames, they were executed already before
      entering THISFRAME.  */
-  while (get_frame_type (frame) == TAILCALL_FRAME)
-    frame = get_prev_frame (frame);
+  frame = skip_tailcall_frames (frame);
 
   /* Find the function we will return from.  */
 
-- 
1.8.3.1


             reply	other threads:[~2016-02-05 14:18 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-05 14:18 Markus Metzger [this message]
2016-02-05 14:18 ` [PATCH v2 2/3] frame: use get_prev_frame_always in skip_tailcall_frames Markus Metzger
2016-02-07 13:01   ` Joel Brobecker
2016-02-08  8:14     ` Metzger, Markus T
2016-02-09 11:42       ` Pedro Alves
2016-02-09 11:58         ` Joel Brobecker
2016-02-09 14:25           ` Metzger, Markus T
2016-02-09 14:41             ` Pedro Alves
     [not found]               ` <A78C989F6D9628469189715575E55B233325FCA0@IRSMSX104.ger.corp.intel.com>
2016-02-15  9:51                 ` Metzger, Markus T
2016-02-17 15:32                   ` Pedro Alves
2016-02-19 11:36                     ` Metzger, Markus T
2016-02-09 14:44             ` Joel Brobecker
2016-02-05 14:19 ` [PATCH v2 3/3] btrace, frame: fix crash in get_frame_type Markus Metzger
2016-02-09 12:05   ` Pedro Alves
2016-02-09 14:43     ` Metzger, Markus T
2016-02-09 22:01       ` Pedro Alves
2016-02-10  7:40         ` Metzger, Markus T
2016-02-10  9:59           ` Pedro Alves
2016-02-10 10:29             ` Metzger, Markus T
2016-02-10 15:02               ` Metzger, Markus T
2016-02-10 15:34                 ` Pedro Alves
2016-02-11  9:51                   ` Metzger, Markus T
2016-02-11 13:39                     ` Pedro Alves
2016-02-11 15:42                       ` Metzger, Markus T
2016-02-11 15:58                         ` Pedro Alves
2016-02-11 16:07                           ` Metzger, Markus T
2016-02-07 13:00 ` [PATCH v2 1/3] frame: add skip_tailcall_frames Joel Brobecker

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=1454681922-2228-1-git-send-email-markus.t.metzger@intel.com \
    --to=markus.t.metzger@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@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