From patchwork Tue Jan 27 06:34:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Kamensky X-Patchwork-Id: 5714941 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 588E8C058D for ; Tue, 27 Jan 2015 06:36:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 87B90201CE for ; Tue, 27 Jan 2015 06:36:54 +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 5DC8B201EC for ; Tue, 27 Jan 2015 06:36:53 +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 1YFzjo-0007Z7-Jk; Tue, 27 Jan 2015 06:35:00 +0000 Received: from mail-pd0-f181.google.com ([209.85.192.181]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YFzjY-0007Fk-M4 for linux-arm-kernel@lists.infradead.org; Tue, 27 Jan 2015 06:34:45 +0000 Received: by mail-pd0-f181.google.com with SMTP id g10so16932144pdj.12 for ; Mon, 26 Jan 2015 22:34:22 -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=PLiCiFYph8XLS1yb8zmEwlETlpzAa3xxxVAPv852CO+gVkxFSX7rYSff8TFAVzj6TY tZngK+wgU0JEL/G5Uux7aiyVrz0Gx7PmzwysqtUs6Kd55Z3yxmlHJ/bFyIP7Ky/MNLlI O1CSF85Ttd0+iL2tET7mU9MF0ksj63K7NAvuS3nUTGwmWCFy2zuiDWv3Wg2Eb75x97Xw RRl9G/g7CD35dFUTZVE5Upzc1dVhRoUEahtRvCA85EiRAT1Igq0XFGq5t/u4n+ChJ8RH GFxVG/Ysjg9ljyylWSKfR34ZTWUbklSLuJZsDmSMGmHdONf35z8Cr+hN7+w1IBpIfzou bnnQ== X-Gm-Message-State: ALoCoQnArk2BC8T0JmUeP1R45vrlKVPSYgrYRhkjbcKfXUhTWLm6r9ZzA4EKQIOHgm0FBpSmldBu X-Received: by 10.68.134.234 with SMTP id pn10mr38355394pbb.150.1422340462543; Mon, 26 Jan 2015 22:34:22 -0800 (PST) Received: from kamensky-w530.hsd1.ca.comcast.net ([24.6.73.122]) by mx.google.com with ESMTPSA id vk4sm410289pbc.74.2015.01.26.22.34.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Jan 2015 22:34:21 -0800 (PST) From: Victor Kamensky To: Arnaldo Carvalho de Melo , Russell King , Namhyung Kim , David Ahern , Will Deacon Subject: [PATCH V3 2/2] perf symbols: debuglink should take symfs option into account Date: Mon, 26 Jan 2015 22:34:02 -0800 Message-Id: <1422340442-4673-3-git-send-email-victor.kamensky@linaro.org> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1422340442-4673-1-git-send-email-victor.kamensky@linaro.org> References: <1422340442-4673-1-git-send-email-victor.kamensky@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150126_223444_776473_661CBDF0 X-CRM114-Status: GOOD ( 10.78 ) X-Spam-Score: -0.7 (/) Cc: Waiman Long , Avi Kivity , 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 Acked-by: Namhyung Kim --- 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;