From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23368 invoked by alias); 11 Feb 2016 16:14:50 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 23235 invoked by uid 89); 11 Feb 2016 16:14:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=H*r:sk:mmetzge, Hx-languages-length:2299 X-HELO: mga14.intel.com Received: from mga14.intel.com (HELO mga14.intel.com) (192.55.52.115) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 11 Feb 2016 16:14:49 +0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 11 Feb 2016 08:14:45 -0800 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 11 Feb 2016 08:14:44 -0800 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u1BGEimh025800; Thu, 11 Feb 2016 16:14:44 GMT Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id u1BGEhch012931; Thu, 11 Feb 2016 17:14:43 +0100 Received: (from mmetzger@localhost) by ulvlx001.iul.intel.com with œ id u1BGEh2W012927; Thu, 11 Feb 2016 17:14:43 +0100 From: Markus Metzger To: palves@redhat.com Cc: gdb-patches@sourceware.org Subject: [PATCH v3 1/3] frame: add skip_tailcall_frames Date: Thu, 11 Feb 2016 16:14:00 -0000 Message-Id: <1455207283-12660-1-git-send-email-markus.t.metzger@intel.com> X-IsSubscribed: yes X-SW-Source: 2016-02/txt/msg00361.txt.bz2 Add a new function skip_tailcall_frames to skip TAILCALL_FRAME frames. 2016-02-11 Markus Metzger 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