public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-sergiodj-stap: Implementing the relocation for probes.
@ 2011-02-16 21:41 sergiodj
  0 siblings, 0 replies; only message in thread
From: sergiodj @ 2011-02-16 21:41 UTC (permalink / raw)
  To: archer-commits

The branch, archer-sergiodj-stap has been updated
       via  5aa8ec25412e39d9c99df5a7a274b47403aef824 (commit)
      from  21cb8f37bbdc1e2e6017c78649b95be84a4fe4df (commit)

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

- Log -----------------------------------------------------------------
commit 5aa8ec25412e39d9c99df5a7a274b47403aef824
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Wed Feb 16 19:41:01 2011 -0200

    Implementing the relocation for probes.

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

Summary of changes:
 gdb/elfread.c  |   23 +++++++++++++++++++++++
 gdb/objfiles.c |    5 +++++
 gdb/symfile.h  |    5 +++++
 3 files changed, 33 insertions(+), 0 deletions(-)

First 500 lines of diff:
diff --git a/gdb/elfread.c b/gdb/elfread.c
index cb21c06..1b1df1b 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -1227,6 +1227,28 @@ elf_get_probe_argument_count (struct objfile *objfile,
 #endif
 
 static void
+elf_symfile_relocate_probe (struct objfile *objfile,
+			    struct section_offsets *new_offsets,
+			    struct section_offsets *delta)
+{
+  int i;
+  struct stap_probe_per_objfile *p
+    = (struct stap_probe_per_objfile *) objfile_data (objfile,
+						      stap_probe_key);
+
+  if (!p)
+    /* No probe to relocate.  */
+    return;
+
+  for (i = 0; i < p->stap_num_probes; i++)
+    {
+      p->probes[i].address += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
+      if (p->probes[i].sem_addr)
+	p->probes[i].sem_addr += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
+    }
+}
+
+static void
 stap_probe_key_free (struct objfile *objfile, void *d)
 {
   struct stap_probe_per_objfile *data = (struct stap_probe_per_objfile *) d;
@@ -1241,6 +1263,7 @@ static const struct sym_probe_fns elf_probe_fns =
   elf_get_probes,		/* sym_get_probes */
   NULL,				/* sym_get_probe_argument_count */
   NULL,				/* sym_evaluate_probe_argument */
+  elf_symfile_relocate_probe,	/* sym_relocate_probe */
 };
 
 /* Register that we are able to handle ELF object file formats.  */
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 4f70d3f..77e9634 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -846,6 +846,11 @@ objfile_relocate1 (struct objfile *objfile,
 				obj_section_addr (s));
     }
 
+  /* Relocating Systemtap probes.  */
+  if (objfile->sf && objfile->sf->sym_probe_fns)
+    objfile->sf->sym_probe_fns->sym_relocate_probe (objfile,
+						    new_offsets, delta);
+
   /* Data changed.  */
   return 1;
 }
diff --git a/gdb/symfile.h b/gdb/symfile.h
index 81c2de4..167b3b4 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -327,6 +327,11 @@ struct sym_probe_fns
 						const struct stap_probe *probe,
 						struct frame_info *frame,
 						int n);
+
+  /* Relocate the probe section of OBJFILE.  */
+  void (*sym_relocate_probe) (struct objfile *objfile,
+			      struct section_offsets *new_offsets,
+			      struct section_offsets *delta);
 };
 
 /* Structure to keep track of symbol reading functions for various


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


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

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

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-16 21:41 [SCM] archer-sergiodj-stap: Implementing the relocation for 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).