public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-sergiodj-stap: move all probe-related functions into their own struct
@ 2011-02-09 21:55 tromey
  0 siblings, 0 replies; only message in thread
From: tromey @ 2011-02-09 21:55 UTC (permalink / raw)
  To: archer-commits

The branch, archer-sergiodj-stap has been updated
       via  14d3f1f99d50f1abe79d439c5e2268eb93195011 (commit)
       via  9d905e91d564bd1687d58a3ba3b64d5dc077e828 (commit)
       via  4aed44e3d96cb64f64bb505ccbdc61227561697b (commit)
      from  b70a9a83d9d202c5770a89a7a3cdfb1080747f76 (commit)

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

- Log -----------------------------------------------------------------
commit 14d3f1f99d50f1abe79d439c5e2268eb93195011
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Feb 9 14:50:58 2011 -0700

    move all probe-related functions into their own struct

commit 9d905e91d564bd1687d58a3ba3b64d5dc077e828
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Feb 9 14:37:40 2011 -0700

    remove unnecessary prototype

commit 4aed44e3d96cb64f64bb505ccbdc61227561697b
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Feb 9 14:29:27 2011 -0700

    also fix elf_sym_fns_gdb_index

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

Summary of changes:
 gdb/coffread.c   |    4 +--
 gdb/dbxread.c    |    4 +--
 gdb/elfread.c    |   15 ++++++++-----
 gdb/mipsread.c   |    4 +--
 gdb/stap-probe.c |   21 +++++++++++--------
 gdb/stap-probe.h |    7 ------
 gdb/symfile.h    |   56 +++++++++++++++++++++++++++++++----------------------
 gdb/xcoffread.c  |    4 +--
 8 files changed, 58 insertions(+), 57 deletions(-)

First 500 lines of diff:
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 0845fee..0afa217 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -2199,9 +2199,7 @@ static const struct sym_fns coff_sym_fns =
 
   default_symfile_relocate,	/* sym_relocate: Relocate a debug
 				   section.  */
-  NULL,				/* sym_get_probes */
-  NULL,				/* sym_get_probe_argument_count */
-  NULL,				/* sym_evaluate_probe_argument */
+  NULL,				/* sym_probe_fns */
   &psym_functions
 };
 
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index ad5387e..ad50856 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -3593,9 +3593,7 @@ static const struct sym_fns aout_sym_fns =
   default_symfile_segments,	/* Get segment information from a file.  */
   NULL,
   default_symfile_relocate,	/* Relocate a debug section.  */
-  NULL,				/* sym_get_probes */
-  NULL,				/* sym_get_probe_argument_count */
-  NULL,				/* sym_evaluate_probe_argument */
+  NULL,				/* sym_probe_fns */
   &psym_functions
 };
 
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 5b1b1f7..e278c6e 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -1095,6 +1095,13 @@ elf_get_probes (struct objfile *objfile, int *num_probes)
 }
 
 \f
+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 */
+};
+
 /* Register that we are able to handle ELF object file formats.  */
 
 static const struct sym_fns elf_sym_fns =
@@ -1108,9 +1115,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.  */
-  elf_get_probes,		/* sym_get_probes */
-  NULL,				/* sym_get_probe_argument_count */
-  NULL,				/* sym_evaluate_probe_argument */
+  &elf_probe_fns,		/* sym_probe_fns */
   &psym_functions
 };
 
@@ -1127,9 +1132,7 @@ static const struct sym_fns elf_sym_fns_gdb_index =
   elf_symfile_segments,		/* Get segment information from a file.  */
   NULL,
   default_symfile_relocate,	/* Relocate a debug section.  */
-  NULL,				/* sym_get_probes */
-  NULL,				/* sym_get_probe_argument_count */
-  NULL,				/* sym_evaluate_probe_argument */
+  &elf_probe_fns,		/* sym_probe_fns */
   &dwarf2_gdb_index_functions
 };
 
diff --git a/gdb/mipsread.c b/gdb/mipsread.c
index 379747d..c1942a5 100644
--- a/gdb/mipsread.c
+++ b/gdb/mipsread.c
@@ -401,9 +401,7 @@ static const struct sym_fns ecoff_sym_fns =
   default_symfile_segments,	/* Get segment information from a file.  */
   NULL,
   default_symfile_relocate,	/* Relocate a debug section.  */
-  NULL,				/* sym_get_probes */
-  NULL,				/* sym_get_probe_argument_count */
-  NULL,				/* sym_evaluate_probe_argument */
+  NULL,				/* sym_probe_fns */
   &psym_functions
 };
 
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index 37e1912..0a36804 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -132,7 +132,7 @@ collect_probes (char *objname, char *provider, char *probe)
     const struct stap_probe *probes;
     int i, num_probes;
 
-    if (! objfile->sf || ! objfile->sf->sym_get_probes)
+    if (! objfile->sf || ! objfile->sf->sym_probe_fns)
       continue;
 
     if (objname)
@@ -141,7 +141,7 @@ collect_probes (char *objname, char *provider, char *probe)
 	  continue;
       }
 
-    probes = objfile->sf->sym_get_probes (objfile, &num_probes);
+    probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile, &num_probes);
     for (i = 0; i < num_probes; ++i)
       {
 	stap_entry entry;
@@ -323,7 +323,7 @@ parse_stap_probe (char **argptr)
     const struct stap_probe *probes;
     int i, num_probes;
 
-    if (! objfile->sf || ! objfile->sf->sym_get_probes)
+    if (! objfile->sf || ! objfile->sf->sym_probe_fns)
       continue;
 
     if (objfile_name
@@ -331,7 +331,7 @@ parse_stap_probe (char **argptr)
 	&& FILENAME_CMP (lbasename (objfile->name), objfile_name) != 0)
       continue;
 
-    probes = objfile->sf->sym_get_probes (objfile, &num_probes);
+    probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile, &num_probes);
     for (i = 0; i < num_probes; ++i)
       {
 	struct symtab_and_line *sal;
@@ -393,11 +393,11 @@ compute_marker_arg (struct gdbarch *arch, struct internalvar *ivar,
     int i, num_probes;
     stap_entry entry;
 
-    if (! objfile->sf || ! objfile->sf->sym_get_probes)
+    if (! objfile->sf || ! objfile->sf->sym_probe_fns)
       continue;
 
     /* If this proves too inefficient, we can replace with a hash.  */
-    probes = objfile->sf->sym_get_probes (objfile, &num_probes);
+    probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile, &num_probes);
     for (i = 0; i < num_probes; ++i)
       {
 	if (probes[i].address == pc)
@@ -411,7 +411,9 @@ compute_marker_arg (struct gdbarch *arch, struct internalvar *ivar,
   if (pc_probe == NULL)
     error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc));
 
-  n_probes = objfile->sf->sym_get_probe_argument_count (objfile, pc_probe);
+  n_probes
+    = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile,
+								pc_probe);
   if (sel == 0)
     return value_from_longest (builtin_type (arch)->builtin_int, n_probes);
 
@@ -421,8 +423,9 @@ compute_marker_arg (struct gdbarch *arch, struct internalvar *ivar,
     error (_("Invalid probe argument %d -- probe has %d arguments available"),
 	   sel, n_probes);
 
-  return objfile->sf->sym_evaluate_probe_argument (objfile, pc_probe,
-						   frame, sel);
+  return objfile->sf->sym_probe_fns->sym_evaluate_probe_argument (objfile,
+								  pc_probe,
+								  frame, sel);
 }
 
 #if 0
diff --git a/gdb/stap-probe.h b/gdb/stap-probe.h
index da9ea03..e9f0b31 100644
--- a/gdb/stap-probe.h
+++ b/gdb/stap-probe.h
@@ -42,11 +42,4 @@ struct stap_probe
 
 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);*/
-
 #endif /* !defined (STAP_PROBE_H) */
diff --git a/gdb/symfile.h b/gdb/symfile.h
index ae8bf4a..81c2de4 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -299,6 +299,36 @@ struct quick_symbol_functions
 				void *data);
 };
 
+/* Structure of functions used for SystemTap probe support.  If one of
+   these functions is provided, all must be.  */
+
+struct sym_probe_fns
+{
+  /* If non-NULL, return an array of SystemTap probe objects.  The
+     number of objects is returned in *NUM_PROBES.  */
+  const struct stap_probe *(*sym_get_probes) (struct objfile *,
+					      int *num_probes);
+
+  /* Return the number of arguments available to PROBE.  PROBE will
+     have come from a call to this objfile's sym_get_probes method.
+     If you provide an implementation of sym_get_probes, you must
+     implement this method as well.  */
+  int (*sym_get_probe_argument_count) (struct objfile *objfile,
+				       const struct stap_probe *probe);
+
+  /* Evaluate the Nth argument available to PROBE.  PROBE will have
+     come from a call to this objfile's sym_get_probes method.  N will
+     be between 0 and the number of arguments available to this probe.
+     FRAME is the frame in which the evaluation is done; the frame's
+     PC will match the address of the probe.  If you provide an
+     implementation of sym_get_probes, you must implement this method
+     as well.  */
+  struct value *(*sym_evaluate_probe_argument) (struct objfile *objfile,
+						const struct stap_probe *probe,
+						struct frame_info *frame,
+						int n);
+};
+
 /* Structure to keep track of symbol reading functions for various
    object file types.  */
 
@@ -362,29 +392,9 @@ struct sym_fns
 
   bfd_byte *(*sym_relocate) (struct objfile *, asection *sectp, bfd_byte *buf);
 
-  /* If non-NULL, return an array of SystemTap probe objects.  The
-     number of objects is returned in *NUM_PROBES.  */
-  const struct stap_probe *(*sym_get_probes) (struct objfile *,
-					      int *num_probes);
-
-  /* Return the number of arguments available to PROBE.  PROBE will
-     have come from a call to this objfile's sym_get_probes method.
-     If you provide an implementation of sym_get_probes, you must
-     implement this method as well.  */
-  int (*sym_get_probe_argument_count) (struct objfile *objfile,
-				       const struct stap_probe *probe);
-
-  /* Evaluate the Nth argument available to PROBE.  PROBE will have
-     come from a call to this objfile's sym_get_probes method.  N will
-     be between 0 and the number of arguments available to this probe.
-     FRAME is the frame in which the evaluation is done; the frame's
-     PC will match the address of the probe.  If you provide an
-     implementation of sym_get_probes, you must implement this method
-     as well.  */
-  struct value *(*sym_evaluate_probe_argument) (struct objfile *objfile,
-						const struct stap_probe *probe,
-						struct frame_info *frame,
-						int n);
+  /* If non-NULL, this objfile has probe support, and all the probe
+     functions referred to here will be non-NULL.  */
+  const struct sym_probe_fns *sym_probe_fns;
 
   /* The "quick" (aka partial) symbol functions for this symbol
      reader.  */
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 61c80bd..4544935 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -3086,9 +3086,7 @@ static const struct sym_fns xcoff_sym_fns =
   default_symfile_segments,	/* Get segment information from a file.  */
   aix_process_linenos,
   default_symfile_relocate,	/* Relocate a debug section.  */
-  NULL,				/* sym_get_probes */
-  NULL,				/* sym_get_probe_argument_count */
-  NULL,				/* sym_evaluate_probe_argument */
+  NULL,				/* sym_probe_fns */
   &psym_functions
 };
 


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:55 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:55 [SCM] archer-sergiodj-stap: move all probe-related functions into their own struct tromey

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