From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753057AbcHXHaQ (ORCPT ); Wed, 24 Aug 2016 03:30:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35118 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751032AbcHXHaO (ORCPT ); Wed, 24 Aug 2016 03:30:14 -0400 Date: Wed, 24 Aug 2016 09:30:10 +0200 From: Jiri Olsa To: Matija Glavinic Pecotic Cc: acme@redhat.com, linux-kernel@vger.kernel.org, Namhyung Kim , Masami Hiramatsu Subject: Re: [PATCH RFC RESEND] Perf: lookup dwarf unwind stack info in debug file pointed by .gnu_debuglink Message-ID: <20160824073010.GA3202@krava> References: <2d72fb64-9b9c-7aa1-5ac5-ac710ec5a900@nokia.com> <20160822151919.GA614@krava> <20160823112204.GC6486@krava> <69a799bb-1c54-928e-f58b-fdc8bb3fac0c@nokia.com> <83fbb2b5-df77-220f-7157-6675560f7e72@nokia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83fbb2b5-df77-220f-7157-6675560f7e72@nokia.com> User-Agent: Mutt/1.7.0 (2016-08-17) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 24 Aug 2016 07:30:13 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 23, 2016 at 06:18:10PM +0200, Matija Glavinic Pecotic wrote: SNIP > - ret = filename__read_debuglink(filename, debuglink, > - size - (debuglink - filename)); > + ret = filename__read_debuglink(filename, symfile, PATH_MAX); > + if (ret) > + break; > + > + /* Check predefined locations where debug file might reside: > + * - if debuglink is absolute path, check only that one > + * If debuglink provides name w/o path, look for debug file: > + * - in the same directory as dso > + * - in the .debug subdirectory of dso directory > + * - in the /usr/lib/debug/[dso directory] > + * */ > + ret = 0; > + if (symfile[0] == '/') { > + if (!is_regular_file(symfile)) > + ret = -1; > + else > + strncpy(filename, symfile, size); > + break; > } > + > + snprintf(filename, size, "%s/%s", dso_dir, symfile); > + if(is_regular_file(filename)) > + break; > + > + snprintf(filename, size, "%s/.debug/%s", dso_dir, symfile); > + if(is_regular_file(filename)) > + break; > + > + snprintf(filename, size, "/usr/lib/debug/%s/%s", > + dso_dir, symfile); > + if(is_regular_file(filename)) > + break; it might be more clear to follow the same way we do for vmlinux search, like array of possible paths and generic code to check.. search for vmlinux_path in symbol.c jirka