linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Hemant Kumar <hemant@linux.vnet.ibm.com>
To: "平松雅巳 / HIRAMATU,MASAMI" <masami.hiramatsu.pt@hitachi.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "mjw@redhat.com" <mjw@redhat.com>,
	"sukadev@linux.vnet.ibm.com" <sukadev@linux.vnet.ibm.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"srikar@linux.vnet.ibm.com" <srikar@linux.vnet.ibm.com>,
	"acme@kernel.org" <acme@kernel.org>
Subject: Re: [PATCH v2] perf/probe: Search both .eh_frame and .debug_frame sections for probe location
Date: Wed, 13 Jan 2016 15:29:48 +0530	[thread overview]
Message-ID: <56962014.5040702@linux.vnet.ibm.com> (raw)
In-Reply-To: <50399556C9727B4D88A595C8584AAB37526926A9@GSjpTKYDCembx32.service.hitachi.net>



On 01/12/2016 04:34 PM, 平松雅巳 / HIRAMATU,MASAMI wrote:
> Hi Hemant,
>
>> From: Hemant Kumar [mailto:hemant@linux.vnet.ibm.com]
>>
>> perf probe through debuginfo__find_probes() in util/probe-finder.c
>> checks for the functions' frame descriptions in either .eh_frame section
>> of an ELF or the .debug_frame. The check is based on whether either one
>> of these sections is present. Depending on distro, toolchain defaults,
>> architetcutre, build flags, etc., CFI might be found in either .eh_frame
>> and/or .debug_frame. Sometimes, it may happen that, .eh_frame, even if
>> present, may not be complete and may miss some descriptions. Therefore,
>> to be sure, to find the CFI covering an address we will always have to
>> investigate both if available.
> OK, so we'd better check both cfi's.
>   [...]
>> +/* Find probe points from debuginfo */
>> +static int debuginfo__find_probes(struct debuginfo *dbg,
>> +				  struct probe_finder *pf)
>> +{
>> +	int ret = 0;
>> +
>> +#if _ELFUTILS_PREREQ(0, 142)
>> +	Elf *elf;
>> +	GElf_Ehdr ehdr;
>> +	GElf_Shdr shdr;
>> +
>> +	if (pf->cfi_eh || pf->cfi_dbg)
>> +		return debuginfo__find_probe_location(dbg, pf);
>> +
>> +	/* Get the call frame information from this dwarf */
>> +	elf = dwarf_getelf(dbg->dbg);
>> +	if (elf == NULL)
>> +		return -EINVAL;
>> +
>> +	if (gelf_getehdr(elf, &ehdr) == NULL)
>> +		return -EINVAL;
>> +
>> +	if (elf_section_by_name(elf, &ehdr, &shdr, ".eh_frame", NULL) &&
>> +	    shdr.sh_type == SHT_PROGBITS) {
>> +		pf->cfi_eh = dwarf_getcfi_elf(elf);
>> +	} else {
>> +		pf->cfi_dbg = dwarf_getcfi(dbg->dbg);
>> +	}
> Hmm, if you want to check both of those cfi's, don't we have to do below?
>
> 	if (elf_section_by_name(elf, &ehdr, &shdr, ".eh_frame", NULL) &&
> 	    shdr.sh_type == SHT_PROGBITS)
> 		pf->cfi_eh = dwarf_getcfi_elf(elf);
>
> 	pf->cfi_dbg = dwarf_getcfi(dbg->dbg);
>
> Then, both of pf->cfi_* will be filled (if the elf has ".eh_frame").
>
> Thanks!

Ah, right. Fixed in v3.

>
>

-- 
Thanks,
Hemant Kumar

      reply	other threads:[~2016-01-13 10:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-04  9:48 [PATCH v2] perf/probe: Search both .eh_frame and .debug_frame sections for probe location Hemant Kumar
2016-01-12 11:04 ` 平松雅巳 / HIRAMATU,MASAMI
2016-01-13  9:59   ` Hemant Kumar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56962014.5040702@linux.vnet.ibm.com \
    --to=hemant@linux.vnet.ibm.com \
    --cc=acme@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mjw@redhat.com \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=sukadev@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).