public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-sergiodj-stap: Implementing objfile registry cache inside elf_get_probes.
@ 2011-02-15 20:12 sergiodj
  0 siblings, 0 replies; only message in thread
From: sergiodj @ 2011-02-15 20:12 UTC (permalink / raw)
  To: archer-commits

The branch, archer-sergiodj-stap has been updated
       via  3229d50f5f11e7d5b02dc1a041eb56f012f85b9e (commit)
      from  9e4a836b7d6f330781826c6058c874dbee886b4a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 3229d50f5f11e7d5b02dc1a041eb56f012f85b9e
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Tue Feb 15 18:12:16 2011 -0200

    Implementing objfile registry cache inside elf_get_probes.

-----------------------------------------------------------------------

Summary of changes:
 gdb/elfread.c |   49 +++++++++++++++++++++++++++++++++++++------------
 1 files changed, 37 insertions(+), 12 deletions(-)

First 500 lines of diff:
diff --git a/gdb/elfread.c b/gdb/elfread.c
index c48e9ce..16bd81d 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -57,6 +57,10 @@ struct elfinfo
     asection *mdebugsect;	/* Section pointer for .mdebug section */
   };
 
+static const struct objfile_data *stap_probe_key = NULL;
+
+static int stap_num_probes = 0;
+
 static void free_elfinfo (void *);
 
 /* Locate the segments in ABFD.  */
@@ -1139,23 +1143,33 @@ elf_get_probes (struct objfile *objfile, int *num_probes)
   struct sdt_note *iter;
   int i;
 
+  ret = (struct stap_probe *) objfile_data (objfile, stap_probe_key);
   *num_probes = 0;
 
-  if (! elf_tdata (obfd)->sdt_note_head)
-    /* There isn't any probe here.  */
-    return NULL;
+  if (!ret)
+    {
+      stap_num_probes = 0;
 
-  /* Allocating space for probe info.  */
-  for (iter = elf_tdata (obfd)->sdt_note_head;
-       iter;
-       iter = iter->next, ++*num_probes);
+      if (! elf_tdata (obfd)->sdt_note_head)
+	/* There isn't any probe here.  */
+	return NULL;
 
-  ret = xmalloc (*num_probes * sizeof (struct stap_probe));
+      /* Allocating space for probe info.  */
+      for (iter = elf_tdata (obfd)->sdt_note_head;
+	   iter;
+	   iter = iter->next, ++stap_num_probes);
 
-  for (iter = elf_tdata (obfd)->sdt_note_head, i = 0;
-       iter;
-       iter = iter->next, i++)
-    handle_probe (objfile, iter, &ret[i], base);
+      ret = xmalloc (stap_num_probes * sizeof (struct stap_probe));
+
+      for (iter = elf_tdata (obfd)->sdt_note_head, i = 0;
+	   iter;
+	   iter = iter->next, i++)
+	handle_probe (objfile, iter, &ret[i], base);
+
+      set_objfile_data (objfile, stap_probe_key, ret);
+    }
+
+  *num_probes = stap_num_probes;
 
   return ret;
 }
@@ -1169,6 +1183,15 @@ elf_get_probe_argument_count (struct objfile *objfile,
 }
 #endif
 
+static void
+stap_probe_key_free (struct objfile *objfile, void *d)
+{
+  struct stap_probe *data = (struct stap_probe *) d;
+
+  xfree (data);
+  stap_num_probes = 0;
+}
+
 \f
 static const struct sym_probe_fns elf_probe_fns =
 {
@@ -1214,5 +1237,7 @@ static const struct sym_fns elf_sym_fns_gdb_index =
 void
 _initialize_elfread (void)
 {
+  stap_probe_key
+    = register_objfile_data_with_cleanup (NULL, stap_probe_key_free);
   add_symtab_fns (&elf_sym_fns);
 }


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-02-15 20:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-15 20:12 [SCM] archer-sergiodj-stap: Implementing objfile registry cache inside elf_get_probes sergiodj

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).