[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50399556C9727B4D88A595C8584AAB37526926A9@GSjpTKYDCembx32.service.hitachi.net>
Date: Tue, 12 Jan 2016 11:04:30 +0000
From: 平松雅巳 / HIRAMATU,MASAMI
<masami.hiramatsu.pt@...achi.com>
To: "'Hemant Kumar'" <hemant@...ux.vnet.ibm.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: "mjw@...hat.com" <mjw@...hat.com>,
"sukadev@...ux.vnet.ibm.com" <sukadev@...ux.vnet.ibm.com>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
"srikar@...ux.vnet.ibm.com" <srikar@...ux.vnet.ibm.com>,
"acme@...nel.org" <acme@...nel.org>
Subject: RE: [PATCH v2] perf/probe: Search both .eh_frame and .debug_frame
sections for probe location
Hi Hemant,
>From: Hemant Kumar [mailto:hemant@...ux.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!
Powered by blists - more mailing lists