public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
To: systemtap@sourceware.org
Cc: hemant@linux.vnet.ibm.com, atrajeev@linux.vnet.ibm.com,
	mjw@redhat.com,        fche@redhat.com, dsmith@redhat.com,
	naveen.n.rao@linux.vnet.ibm.com,
	       Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Subject: [PATCH v3 1/2] ppc64le: Store correct function entry address in symbol_table
Date: Tue, 23 Aug 2016 11:24:00 -0000	[thread overview]
Message-ID: <1471951468-2567-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com> (raw)

PPC64 ELF ABI v2 has a Global Entry Point and a Local Entry Point for
the functions. Debuginfo of ELF contains GEP which is same as entrypc
while symbol table contains GEP and offset, from which we can calculate
LEP. LEP is used to call function within single CU, when TOC pointer
update is not required. Placing a probe on LEP catches call from both
the GEP and the LEP but, by default, systemtap probes on GEP.

For ppc64le, Systemtap stores LEP in symbol table and prioritize symbol
table over debuginfo. But, storing LEP in symbol table has couple of
regression effect. As LEP is only required at a time of adding a probe,
don't store it in symbol table.

No need to prioritize symbol table as well because debuginfo and symbol
table both will contain Global Entry Point.

Revert commit b4c6a4b1cd00 ("Prioritize symbol table lookup for ppc64le")
partially.

Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
---
Changes in v3:
  - Mentioned commit reverted by this patch.

 tapsets.cxx | 62 +------------------------------------------------------------
 1 file changed, 1 insertion(+), 61 deletions(-)

diff --git a/tapsets.cxx b/tapsets.cxx
index 35f562b..997cc88 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -2142,18 +2142,6 @@ query_dwarf_inline_instance (Dwarf_Die * die, dwarf_query * q)
     }
 }
 
-static bool
-is_filtered_func_exists (func_info_map_t const& filtered, func_info *fi)
-{
-  for (unsigned i = 0; i < filtered.size(); i++)
-    {
-      if ((filtered[i].entrypc == fi->entrypc) && (filtered[i].name == fi->name))
-        return true;
-    }
-
-  return false;
-}
-
 static int
 query_dwarf_func (Dwarf_Die * func, dwarf_query * q)
 {
@@ -2206,37 +2194,7 @@ query_dwarf_func (Dwarf_Die * func, dwarf_query * q)
           q->dw.function_line (&func.decl_line);
 
           Dwarf_Addr entrypc;
-
-          func.entrypc = 0;
-          Dwarf_Addr bias;
-          Dwfl_Module *mod = q->dw.module;
-          Elf* elf = (dwarf_getelf (dwfl_module_getdwarf (mod, &bias))
-                     ?: dwfl_module_getelf (mod, &bias));
-
-          GElf_Ehdr ehdr_mem;
-          GElf_Ehdr* em = gelf_getehdr (elf, &ehdr_mem);
-          if (em == NULL) throw SEMANTIC_ERROR (_("Couldn't get elf header"));
-
-          /* Giving priority to sym_table for ppc64*/
-          if ((em->e_machine == EM_PPC64) && ((em->e_flags & EF_PPC64_ABI) == 2)
-              && (q->dw.mod_info->sym_table))
-            {
-              /* The linkage name is the best match for the symbol table. */
-              const string& linkage_name = dwarf_linkage_name(&func.die)
-                ?: dwarf_diename(&func.die) ?: (string)func.name;
-
-              const auto& fis = q->dw.mod_info->sym_table->lookup_symbol(linkage_name);
-              for (auto it=fis.begin(); it!=fis.end() ; ++it)
-                {
-                  func.entrypc = (*it)->entrypc;
-                  if (is_filtered_func_exists(q->filtered_functions, &func))
-                    continue;
-                  q->filtered_functions.push_back(func);
-                }
-            }
-
-          /* If not ppc64 or not found in sym_table, try it directly. */
-          if (!func.entrypc && q->dw.function_entrypc (&entrypc))
+          if (q->dw.function_entrypc (&entrypc))
             {
               func.entrypc = entrypc;
               q->filtered_functions.push_back (func);
@@ -8504,13 +8462,6 @@ symbol_table::get_from_elf()
   int syments = dwfl_module_getsymtab(mod);
   assert(syments);
   prepare_section_rejection(mod);
-  Dwarf_Addr bias;
-  Elf* elf = (dwarf_getelf (dwfl_module_getdwarf (mod, &bias))
-              ?: dwfl_module_getelf (mod, &bias));
-
-  GElf_Ehdr ehdr_mem;
-  GElf_Ehdr* em = gelf_getehdr (elf, &ehdr_mem);
-  if (em == NULL) throw SEMANTIC_ERROR (_("Couldn't get elf header"));
 
   for (int i = 1; i < syments; ++i)
     {
@@ -8543,18 +8494,7 @@ symbol_table::get_from_elf()
         continue;
       interned_string name = n;
 
-     /*
-      * For ELF ABI v2 on PPC64 LE, we need to adjust sym.st_value corresponding
-      * to the bits of sym.st_other. These bits will tell us what's the offset
-      * of the local entry point from the global entry point.
-      *
-      * st_other field is currently only used with ABIv2 on ppc64
-      */
       Dwarf_Addr entrypc = addr;
-      if ((em->e_machine == EM_PPC64) && ((em->e_flags & EF_PPC64_ABI) == 2)
-          && (GELF_ST_TYPE(sym.st_info) == STT_FUNC) && sym.st_other)
-        entrypc += PPC64_LOCAL_ENTRY_OFFSET(sym.st_other);
-
       if (GELF_ST_TYPE(sym.st_info) == STT_FUNC)
         add_symbol(name, (GELF_ST_BIND(sym.st_info) == STB_WEAK),
                    reject, addr, entrypc);
-- 
1.8.3.1


             reply	other threads:[~2016-08-23 11:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-23 11:24 Ravi Bangoria [this message]
2016-08-23 11:24 ` [PATCH v3 2/2] ppc64le: Fix LEP usage for probing Ravi Bangoria
2016-08-25 14:02 ` [PATCH v3 1/2] ppc64le: Store correct function entry address in symbol_table Frank Ch. Eigler

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=1471951468-2567-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com \
    --to=ravi.bangoria@linux.vnet.ibm.com \
    --cc=atrajeev@linux.vnet.ibm.com \
    --cc=dsmith@redhat.com \
    --cc=fche@redhat.com \
    --cc=hemant@linux.vnet.ibm.com \
    --cc=mjw@redhat.com \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=systemtap@sourceware.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).