public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-sergiodj-stap: Parsing the probe arguments.  The code doesn't parse the probe address nor its semaphore address, but the provider and the name parsing already works.
@ 2011-02-09 21:24 sergiodj
  0 siblings, 0 replies; only message in thread
From: sergiodj @ 2011-02-09 21:24 UTC (permalink / raw)
  To: archer-commits

The branch, archer-sergiodj-stap has been updated
       via  b70a9a83d9d202c5770a89a7a3cdfb1080747f76 (commit)
      from  9784d19c3df6d8b7871ccdc70e763ae9f51e5462 (commit)

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

- Log -----------------------------------------------------------------
commit b70a9a83d9d202c5770a89a7a3cdfb1080747f76
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Wed Feb 9 19:23:58 2011 -0200

    Parsing the probe arguments.  The code doesn't parse the probe address
    nor its semaphore address, but the provider and the name parsing already
    works.

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

Summary of changes:
 gdb/elfread.c    |   47 ++++++++++++++++++++++++++++++++++++++++++++++-
 gdb/stap-probe.c |    3 ++-
 gdb/stap-probe.h |    7 +++++--
 3 files changed, 53 insertions(+), 4 deletions(-)

First 500 lines of diff:
diff --git a/gdb/elfread.c b/gdb/elfread.c
index a66547c..5b1b1f7 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -37,6 +37,7 @@
 #include "complaints.h"
 #include "demangle.h"
 #include "psympriv.h"
+#include "stap-probe.h"
 
 extern void _initialize_elfread (void);
 
@@ -1049,6 +1050,50 @@ elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst)
     complaint (&symfile_complaints,
 	       _("elf/stab section information missing for %s"), filename);
 }
+
+static void
+handle_probe (struct sdt_note *el, struct stap_probe *ret, bfd *abfd)
+{
+  int size = bfd_get_arch_size (abfd) / 8;
+  CORE_ADDR off;
+
+  ret->provider = (const char *) &el->data[3 * size];
+  ret->name = (const char *) &ret->provider[strlen (ret->provider) + 1];
+
+  ret->address = (CORE_ADDR) el->data[0] + (CORE_ADDR) el->data[1];
+//  memcpy (&ret->address, &el->data[0], sizeof (CORE_ADDR));
+//  memcpy (&off, &el->data[size], sizeof (CORE_ADDR));
+//  ret->address += off;
+//  memcpy (&ret->sem_addr, &el->data[2 * size], sizeof (CORE_ADDR));
+//  ret->address = el->data[0] + el->data[size];
+//  ret->sem_addr = el->data[size];
+}
+
+static const struct stap_probe *
+elf_get_probes (struct objfile *objfile, int *num_probes)
+{
+  struct stap_probe *ret = NULL;
+  bfd *obfd = objfile->obfd;
+  struct sdt_note *iter;
+  int i;
+
+  *num_probes = 0;
+
+  if (! elf_tdata (obfd)->sdt_note_head)
+    /* There isn't any probe here.  */
+    return NULL;
+
+  /* Allocating space for probe info.  */
+  for (iter = elf_tdata (obfd)->sdt_note_head; iter; iter = iter->next, ++*num_probes);
+
+  ret = xmalloc (*num_probes * sizeof (struct stap_probe));
+
+  for (iter = elf_tdata (obfd)->sdt_note_head, i = 0; iter; iter = iter->next, i++)
+    handle_probe (iter, &ret[i], obfd);
+
+  return ret;
+}
+
 \f
 /* Register that we are able to handle ELF object file formats.  */
 
@@ -1063,7 +1108,7 @@ static const struct sym_fns elf_sym_fns =
   elf_symfile_segments,		/* Get segment information from a file.  */
   NULL,
   default_symfile_relocate,	/* Relocate a debug section.  */
-  NULL,				/* sym_get_probes */
+  elf_get_probes,		/* sym_get_probes */
   NULL,				/* sym_get_probe_argument_count */
   NULL,				/* sym_evaluate_probe_argument */
   &psym_functions
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index b400215..37e1912 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -425,6 +425,7 @@ compute_marker_arg (struct gdbarch *arch, struct internalvar *ivar,
 						   frame, sel);
 }
 
+#if 0
 static void
 handle_probe (struct sdt_note *el, struct stap_probe *ret, bfd *obfd)
 {
@@ -523,7 +524,7 @@ get_stap_probes (struct objfile *objfile, int *num_probes)
 
   return ret;
 }
-
+#endif
 \f
 
 void
diff --git a/gdb/stap-probe.h b/gdb/stap-probe.h
index e9d9b1e..da9ea03 100644
--- a/gdb/stap-probe.h
+++ b/gdb/stap-probe.h
@@ -30,6 +30,9 @@ struct stap_probe
 
   /* The address where the probe is inserted.  */
   CORE_ADDR address;
+
+  /* The address of the probe's semaphore.  */
+  CORE_ADDR sem_addr;
 };
 
 
@@ -43,7 +46,7 @@ extern struct symtabs_and_lines parse_stap_probe (char **argptr);
 /* Try to map the probe section of OBJFILE and parse it.  Return NULL
    if there are no probes, otherwise return an array of probes with
    *NUM_PROBES as an out parameter.  */
-extern struct stap_probe *get_stap_probes (struct objfile *objfile,
-					    int *num_probes);
+/*extern struct stap_probe *get_stap_probes (struct objfile *objfile,
+					    int *num_probes);*/
 
 #endif /* !defined (STAP_PROBE_H) */


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


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

only message in thread, other threads:[~2011-02-09 21:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-09 21:24 [SCM] archer-sergiodj-stap: Parsing the probe arguments. The code doesn't parse the probe address nor its semaphore address, but the provider and the name parsing already works 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).