public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-sergiodj-stap: Properly reading the probe's address.  Added assertions to make sure everything is OK.  Added `args' field to the probe struct.
@ 2011-02-10 17:23 sergiodj
  0 siblings, 0 replies; only message in thread
From: sergiodj @ 2011-02-10 17:23 UTC (permalink / raw)
  To: archer-commits

The branch, archer-sergiodj-stap has been updated
       via  9f776ea7da35f9d2e9ca84c512cfffda2c0d230c (commit)
      from  1485d74a5bd6bc4af25082baa440cfafaf3ff007 (commit)

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

- Log -----------------------------------------------------------------
commit 9f776ea7da35f9d2e9ca84c512cfffda2c0d230c
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Thu Feb 10 15:22:27 2011 -0200

    Properly reading the probe's address.  Added assertions to make sure
    everything is OK.  Added `args' field to the probe struct.

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

Summary of changes:
 gdb/elfread.c    |   38 +++++++++++++++++++++++++++++---------
 gdb/stap-probe.h |    3 +++
 2 files changed, 32 insertions(+), 9 deletions(-)

First 500 lines of diff:
diff --git a/gdb/elfread.c b/gdb/elfread.c
index e278c6e..d654067 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -1057,16 +1057,28 @@ handle_probe (struct sdt_note *el, struct stap_probe *ret, bfd *abfd)
   int size = bfd_get_arch_size (abfd) / 8;
   CORE_ADDR off;
 
+  /* Provider and the name of the probe.  */
   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];
+  ret->name = memchr (ret->provider, '\0',
+		      (unsigned long *) el->data
+		      + el->size - (unsigned long *) ret->provider);
+  /* Making sure there is a name.  */
+  gdb_assert (ret->name != NULL);
+  ++ret->name;
+
+  /* Retrieving the probe's address.  */
+  ret->address = ((CORE_ADDR *) el->data)[0];
+  ret->sem_addr = ((CORE_ADDR *) el->data)[2];
+
+  /* Arguments.  */
+  ret->args = memchr (ret->name, '\0',
+		      (unsigned long *) el->data
+		      + el->size - (unsigned long *) ret->name);
+  gdb_assert (ret->args++ != NULL
+	      && memchr (ret->args, '\0',
+			 (unsigned long *) el->data
+			 + el->size - (unsigned long *) ret->name)
+	      == el->data + el->size - 1);
 }
 
 static const struct stap_probe *
@@ -1094,6 +1106,14 @@ elf_get_probes (struct objfile *objfile, int *num_probes)
   return ret;
 }
 
+#if 0
+static int
+elf_get_probe_argument_count (struct objfile *objfile,
+			      const struct stap_probe *probe)
+{
+  return 0;
+}
+#endif
 \f
 static const struct sym_probe_fns elf_probe_fns =
 {
diff --git a/gdb/stap-probe.h b/gdb/stap-probe.h
index e9f0b31..1967e7b 100644
--- a/gdb/stap-probe.h
+++ b/gdb/stap-probe.h
@@ -33,6 +33,9 @@ struct stap_probe
 
   /* The address of the probe's semaphore.  */
   CORE_ADDR sem_addr;
+
+  /* Probe's arguments.  */
+  const char *args;
 };
 
 


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


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

only message in thread, other threads:[~2011-02-10 17:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-10 17:23 [SCM] archer-sergiodj-stap: Properly reading the probe's address. Added assertions to make sure everything is OK. Added `args' field to the probe struct 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).