From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67634 invoked by alias); 22 Jul 2016 08:12:27 -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 67537 invoked by uid 89); 22 Jul 2016 08:12:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=2016-07-22 X-HELO: mga02.intel.com Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 22 Jul 2016 08:12:12 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 22 Jul 2016 01:12:04 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 22 Jul 2016 01:12:02 -0700 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 u6M8C13p019884; Fri, 22 Jul 2016 09:12:01 +0100 Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id u6M8C1MT019949; Fri, 22 Jul 2016 10:12:01 +0200 Received: (from mmetzger@localhost) by ulvlx001.iul.intel.com with œ id u6M8C1Ud019945; Fri, 22 Jul 2016 10:12:01 +0200 From: Markus Metzger To: gdb-patches@sourceware.org Cc: palves@redhat.com Subject: [PATCH 3/5] btrace: update tail call heuristic Date: Fri, 22 Jul 2016 08:12:00 -0000 Message-Id: <1469175120-19657-4-git-send-email-markus.t.metzger@intel.com> In-Reply-To: <1469175120-19657-1-git-send-email-markus.t.metzger@intel.com> References: <1469175120-19657-1-git-send-email-markus.t.metzger@intel.com> X-IsSubscribed: yes X-SW-Source: 2016-07/txt/msg00277.txt.bz2 An unconditional jump to the start of a function typically indicates a tail call. If we can't determine the start of the function at the destination address, we used to treat it as a tail call, as well. This results in lots of tail calls for code for which we don't have symbol information. Restrict the heuristic to only consider jumps as tail calls that switch functions in the case where we can't determine the start of a function. This effectively disables tail call detection for code without symbol information. 2016-07-22 Markus Metzger gdb/ * btrace.c (ftrace_update_function): Update tail call heuristic. --- gdb/btrace.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gdb/btrace.c b/gdb/btrace.c index e0d0f27..e817f09 100644 --- a/gdb/btrace.c +++ b/gdb/btrace.c @@ -528,10 +528,17 @@ ftrace_update_function (struct btrace_function *bfun, CORE_ADDR pc) start = get_pc_function_start (pc); + /* A jump to the start of a function is (typically) a tail call. */ + if (start == pc) + return ftrace_new_tailcall (bfun, mfun, fun); + /* If we can't determine the function for PC, we treat a jump at - the end of the block as tail call. */ - if (start == 0 || start == pc) + the end of the block as tail call if we're switching functions + and as an intra-function branch if we don't. */ + if (start == 0 && ftrace_function_switched (bfun, mfun, fun)) return ftrace_new_tailcall (bfun, mfun, fun); + + break; } } } -- 1.8.3.1