Introduce display_mi_prompt
[deliverable/binutils-gdb.git] / gdb / probe.h
index 38cc95018ee3e1a6ca09f2a00f31b5f45aee6be6..1e15328ffb062e255ff8de82fa0e22fc2d0c69ed 100644 (file)
@@ -1,6 +1,6 @@
 /* Generic SDT probe support for GDB.
 
-   Copyright (C) 2012-2014 Free Software Foundation, Inc.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -20,6 +20,8 @@
 #if !defined (PROBE_H)
 #define PROBE_H 1
 
+struct event_location;
+
 #include "gdb_vecs.h"
 
 /* Definition of a vector of probes.  */
@@ -64,12 +66,14 @@ struct probe_ops
 
     void (*get_probes) (VEC (probe_p) **probes, struct objfile *objfile);
 
-    /* Function used to relocate addresses from PROBE according to some DELTA
-       provided.  */
+    /* Compute the probe's relocated address.  OBJFILE is the objfile
+       in which the probe originated.  */
 
-    void (*relocate) (struct probe *probe, CORE_ADDR delta);
+    CORE_ADDR (*get_probe_address) (struct probe *probe,
+                                   struct objfile *objfile);
 
-    /* Return the number of arguments of PROBE.  */
+    /* Return the number of arguments of PROBE.  This function can
+       throw an exception.  */
 
     unsigned (*get_probe_argument_count) (struct probe *probe,
                                          struct frame_info *frame);
@@ -81,7 +85,8 @@ struct probe_ops
     int (*can_evaluate_probe_arguments) (struct probe *probe);
 
     /* Evaluate the Nth argument from the PROBE, returning a value
-       corresponding to it.  The argument number is represented N.  */
+       corresponding to it.  The argument number is represented N.
+       This function can throw an exception.  */
 
     struct value *(*evaluate_probe_argument) (struct probe *probe,
                                              unsigned n,
@@ -95,21 +100,29 @@ struct probe_ops
 
     /* Set the semaphore associated with the PROBE.  This function only makes
        sense if the probe has a concept of semaphore associated to a
-       probe.  */
+       probe, otherwise it can be set to NULL.  */
 
-    void (*set_semaphore) (struct probe *probe, struct gdbarch *gdbarch);
+    void (*set_semaphore) (struct probe *probe, struct objfile *objfile,
+                          struct gdbarch *gdbarch);
 
     /* Clear the semaphore associated with the PROBE.  This function only
        makes sense if the probe has a concept of semaphore associated to
-       a probe.  */
+       a probe, otherwise it can be set to NULL.  */
 
-    void (*clear_semaphore) (struct probe *probe, struct gdbarch *gdbarch);
+    void (*clear_semaphore) (struct probe *probe, struct objfile *objfile,
+                            struct gdbarch *gdbarch);
 
     /* Function called to destroy PROBE's specific data.  This function
        shall not free PROBE itself.  */
 
     void (*destroy) (struct probe *probe);
 
+    /* Return a pointer to a name identifying the probe type.  This is
+       the string that will be displayed in the "Type" column of the
+       `info probes' command.  */
+
+    const char *(*type_name) (struct probe *probe);
+
     /* Function responsible for providing the extra fields that will be
        printed in the `info probes' command.  It should fill HEADS
        with whatever extra fields it needs.  If the backend doesn't need
@@ -129,6 +142,20 @@ struct probe_ops
 
     void (*gen_info_probes_table_values) (struct probe *probe,
                                          VEC (const_char_ptr) **values);
+
+    /* Enable a probe.  The semantics of "enabling" a probe depend on
+       the specific backend and the field can be NULL in case enabling
+       probes is not supported.  This function can throw an
+       exception.  */
+
+    void (*enable_probe) (struct probe *probe);
+
+    /* Disable a probe.  The semantics of "disabling" a probe depend
+       on the specific backend and the field can be NULL in case
+       disabling probes is not supported.  This function can throw an
+       exception.  */
+
+    void (*disable_probe) (struct probe *probe);
   };
 
 /* Definition of a vector of probe_ops.  */
@@ -166,10 +193,8 @@ struct probe
     /* The operations associated with this probe.  */
     const struct probe_ops *pops;
 
-    /* The objfile which contains this probe.  Even if the probe is also
-       present in a separate debug objfile, this variable always points to
-       the non-separate debug objfile.  */
-    struct objfile *objfile;
+    /* The probe's architecture.  */
+    struct gdbarch *arch;
 
     /* The name of the probe.  */
     const char *name;
@@ -178,14 +203,32 @@ struct probe
        the objfile which contains the probe.  */
     const char *provider;
 
-    /* The address where the probe is inserted.  */
+    /* The address where the probe is inserted, relative to
+       SECT_OFF_TEXT.  */
     CORE_ADDR address;
   };
 
+/* A bound probe holds a pointer to a probe and a pointer to the
+   probe's defining objfile.  This is needed because probes are
+   independent of the program space and thus require relocation at
+   their point of use.  */
+
+struct bound_probe
+  {
+    /* The probe.  */
+
+    struct probe *probe;
+
+    /* The objfile in which the probe originated.  */
+
+    struct objfile *objfile;
+  };
+
 /* A helper for linespec that decodes a probe specification.  It returns a
-   symtabs_and_lines object and updates *ARGPTR or throws an error.  */
+   symtabs_and_lines object and updates LOC or throws an error.  */
 
-extern struct symtabs_and_lines parse_probes (char **argptr,
+extern struct symtabs_and_lines parse_probes (const struct event_location *loc,
+                                             struct program_space *pspace,
                                              struct linespec_result *canon);
 
 /* Helper function to register the proper probe_ops to a newly created probe.
@@ -194,9 +237,10 @@ extern struct symtabs_and_lines parse_probes (char **argptr,
 extern void register_probe_ops (struct probe *probe);
 
 /* Given a PC, find an associated probe.  If a probe is found, return
-   it.  If no probe is found, return NULL.  */
+   it.  If no probe is found, return a bound probe whose fields are
+   both NULL.  */
 
-extern struct probe *find_probe_by_pc (CORE_ADDR pc);
+extern struct bound_probe find_probe_by_pc (CORE_ADDR pc);
 
 /* Search OBJFILE for a probe with the given PROVIDER, NAME.  Return a
    VEC of all probes that were found.  If no matching probe is found,
@@ -211,7 +255,7 @@ extern VEC (probe_p) *find_probes_in_objfile (struct objfile *objfile,
    function that can be used by the probe backends to print their
    `info probe TYPE'.  */
 
-extern void info_probes_for_ops (char *arg, int from_tty,
+extern void info_probes_for_ops (const char *arg, int from_tty,
                                 const struct probe_ops *pops);
 
 /* Return the `cmd_list_element' associated with the `info probes' command,
@@ -221,7 +265,15 @@ extern void info_probes_for_ops (char *arg, int from_tty,
 
 extern struct cmd_list_element **info_probes_cmdlist_get (void);
 
-/* Return the argument count of the specified probe.  */
+/* Compute the probe's relocated address.  OBJFILE is the objfile in
+   which the probe originated.  */
+
+extern CORE_ADDR get_probe_address (struct probe *probe,
+                                   struct objfile *objfile);
+
+/* Return the argument count of the specified probe.
+
+   This function can throw an exception.  */
 
 extern unsigned get_probe_argument_count (struct probe *probe,
                                          struct frame_info *frame);
@@ -233,7 +285,9 @@ extern unsigned get_probe_argument_count (struct probe *probe,
 extern int can_evaluate_probe_arguments (struct probe *probe);
 
 /* Evaluate argument N of the specified probe.  N must be between 0
-   inclusive and get_probe_argument_count exclusive.  */
+   inclusive and get_probe_argument_count exclusive.
+
+   This function can throw an exception.  */
 
 extern struct value *evaluate_probe_argument (struct probe *probe,
                                              unsigned n,
This page took 0.027089 seconds and 4 git commands to generate.