public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM] archer-sergiodj-stap: Fixing the objfile's cache usage inside gdb/elfread.c.
@ 2011-02-15 23:54 sergiodj
0 siblings, 0 replies; only message in thread
From: sergiodj @ 2011-02-15 23:54 UTC (permalink / raw)
To: archer-commits
The branch, archer-sergiodj-stap has been updated
via 641217605682bc0c41759e9811d99f11f551277c (commit)
from 111aa0c205d55562fd61b400b6329baf10e21304 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit 641217605682bc0c41759e9811d99f11f551277c
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Tue Feb 15 21:53:32 2011 -0200
Fixing the objfile's cache usage inside gdb/elfread.c.
-----------------------------------------------------------------------
Summary of changes:
gdb/elfread.c | 44 +++++++++++++++++++++++++++++++++-----------
1 files changed, 33 insertions(+), 11 deletions(-)
First 500 lines of diff:
diff --git a/gdb/elfread.c b/gdb/elfread.c
index e46692a..cb21c06 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -61,9 +61,16 @@ struct elfinfo
static const struct objfile_data *stap_probe_key = NULL;
-/* Number of Systemtap probes found on the objfile. */
+/* Per-objfile data about Systemtap probes. */
-static int stap_num_probes = 0;
+struct stap_probe_per_objfile
+ {
+ /* The number of probes in this objfile. */
+ int stap_num_probes;
+
+ /* The probes themselves. */
+ struct stap_probe *probes;
+ };
static void free_elfinfo (void *);
@@ -1154,22 +1161,28 @@ static const struct stap_probe *
elf_get_probes (struct objfile *objfile, int *num_probes)
{
struct stap_probe *ret = NULL;
+ struct stap_probe_per_objfile *probes_per_objfile;
bfd *obfd = objfile->obfd;
bfd_vma base = get_base_address (obfd);
struct sdt_note *iter;
int i;
- ret = (struct stap_probe *) objfile_data (objfile, stap_probe_key);
+ /* Initially, no probes. */
*num_probes = 0;
- if (!ret)
+ /* Have we parsed this objfile's probes already? */
+ probes_per_objfile
+ = (struct stap_probe_per_objfile *) objfile_data (objfile,
+ stap_probe_key);
+
+ if (!probes_per_objfile)
{
/* If we are here, then this is the first time we are parsing the
probe's information. We basically have to count how many probes
the objfile has, and then fill in the necessary information
for each one. */
- stap_num_probes = 0;
+ int n = 0;
if (! elf_tdata (obfd)->sdt_note_head)
/* There isn't any probe here. */
@@ -1178,19 +1191,28 @@ elf_get_probes (struct objfile *objfile, int *num_probes)
/* Allocating space for probe info. */
for (iter = elf_tdata (obfd)->sdt_note_head;
iter;
- iter = iter->next, ++stap_num_probes);
+ iter = iter->next, ++n);
- ret = xmalloc (stap_num_probes * sizeof (struct stap_probe));
+ ret = xmalloc (n * sizeof (struct stap_probe));
+ /* Parsing each probe's information. */
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);
+ /* Creating a cache for these probes in the objfile's registry. */
+ probes_per_objfile = xmalloc (sizeof (struct stap_probe_per_objfile));
+
+ probes_per_objfile->stap_num_probes = n;
+ probes_per_objfile->probes = ret;
+
+ set_objfile_data (objfile, stap_probe_key, probes_per_objfile);
}
+ else
+ ret = probes_per_objfile->probes;
- *num_probes = stap_num_probes;
+ *num_probes = probes_per_objfile->stap_num_probes;
return ret;
}
@@ -1207,10 +1229,10 @@ elf_get_probe_argument_count (struct objfile *objfile,
static void
stap_probe_key_free (struct objfile *objfile, void *d)
{
- struct stap_probe *data = (struct stap_probe *) d;
+ struct stap_probe_per_objfile *data = (struct stap_probe_per_objfile *) d;
+ xfree (data->probes);
xfree (data);
- stap_num_probes = 0;
}
\f
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 23:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-15 23:54 [SCM] archer-sergiodj-stap: Fixing the objfile's cache usage inside gdb/elfread.c 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).