From patchwork Thu Jan 22 04:52:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Kamensky X-Patchwork-Id: 5682131 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 98F9C9F357 for ; Thu, 22 Jan 2015 04:56:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BF96F20353 for ; Thu, 22 Jan 2015 04:56:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A31CD20351 for ; Thu, 22 Jan 2015 04:56:49 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YE9n0-00031r-VH; Thu, 22 Jan 2015 04:54:42 +0000 Received: from mail-pa0-f44.google.com ([209.85.220.44]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YE9mB-0001MB-6T for linux-arm-kernel@lists.infradead.org; Thu, 22 Jan 2015 04:53:53 +0000 Received: by mail-pa0-f44.google.com with SMTP id et14so57606465pad.3 for ; Wed, 21 Jan 2015 20:53:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KEtvjOwS23narIa9fwUQW9rgrtBgffd5hfoG6V3pitM=; b=bomuR/5eK0g0EPbIiXaLojzTlHMiFTdE9/rcZh8rjr8CEvti8UHHDAtxyPKiazT+WW Kf7qBn6qchthGqLrQ9x+g51wnZtE68svxy66icUzfewT74jvJD0MH2qG8R/Kb1xthVfu widBjMGz3LZm6wappaXK7U+ELUPuDDVzzz05Pp2PH4YWHz7G2BpeYU9zrU/b4yw+0Gbd 35DuOErVv7YPjwQcZG77xYpX77SdF7Ow0v5oPf3n1iQyYEQVb2CyK5Gsbl5xSGPNL0f+ TjJ2YQnBkAMZ8BRU9dC5hlx/9G40VlBBl/BGNBNEBJR+5odS6pEUwb5eSqit95IC4NUX HF0g== X-Gm-Message-State: ALoCoQk5SLP+CLwFyRaxwwLSRx0zFC4/Iy/LES9snNpFcO+uxevmMalRfSVG4C4SOaqMsFqYmxiV X-Received: by 10.66.252.67 with SMTP id zq3mr62883696pac.60.1421902410029; Wed, 21 Jan 2015 20:53:30 -0800 (PST) Received: from kamensky-w530.hsd1.ca.comcast.net ([24.6.73.122]) by mx.google.com with ESMTPSA id or4sm7800278pab.30.2015.01.21.20.53.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Jan 2015 20:53:29 -0800 (PST) From: Victor Kamensky To: Arnaldo Carvalho de Melo , Namhyung Kim , David Ahern , Will Deacon Subject: [PATCH V2 3/3] perf symbols: debuglink should take symfs option into account Date: Wed, 21 Jan 2015 20:52:58 -0800 Message-Id: <1421902378-3634-4-git-send-email-victor.kamensky@linaro.org> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1421902378-3634-1-git-send-email-victor.kamensky@linaro.org> References: <1421902378-3634-1-git-send-email-victor.kamensky@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150121_205351_341303_045E41CB X-CRM114-Status: GOOD ( 10.03 ) X-Spam-Score: -0.7 (/) Cc: Waiman Long , Avi Kivity , Russell King , Peter Zijlstra , Victor Kamensky , Adrian Hunter , linux-kernel@vger.kernel.org, Ingo Molnar , Paul Mackerras , Anton Blanchard , Jiri Olsa , Masami Hiramatsu , Jiri Olsa , Dave Martin , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently code that tries to read corresponding debug symbol file from .gnu_debuglink section (DSO_BINARY_TYPE__DEBUGLINK) does not take in account symfs option, so filename__read_debuglink function cannot open ELF file, if symfs option is used. Fix is to add proper handling of symfs as it is done in other places: use __symbol__join_symfs function to get real file name of target ELF file. Signed-off-by: Victor Kamensky Cc: Peter Zijlstra Cc: Paul Mackerras Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Namhyung Kim Cc: Adrian Hunter Cc: Waiman Long Cc: David Ahern Acked-and-tested-by: David Ahern --- tools/perf/util/dso.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index 45be944..ca8d8d5 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -45,13 +45,13 @@ int dso__read_binary_type_filename(const struct dso *dso, case DSO_BINARY_TYPE__DEBUGLINK: { char *debuglink; - strncpy(filename, dso->long_name, size); - debuglink = filename + dso->long_name_len; + len = __symbol__join_symfs(filename, size, dso->long_name); + debuglink = filename + len; while (debuglink != filename && *debuglink != '/') debuglink--; if (*debuglink == '/') debuglink++; - ret = filename__read_debuglink(dso->long_name, debuglink, + ret = filename__read_debuglink(filename, debuglink, size - (debuglink - filename)); } break;