aboutsummaryrefslogtreecommitdiff
path: root/gdb/probe.h
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-12-02 13:58:59 -0700
committerTom Tromey <tromey@redhat.com>2014-03-03 12:47:20 -0700
commit729662a5221eaee2b3cd71d79afb3f612c4df904 (patch)
tree929c58f2c94334b9a645ba7cf167b54b6a9349be /gdb/probe.h
parentff8879201af6e734741c2be0c26b71b1745667ad (diff)
downloadgdb-729662a5221eaee2b3cd71d79afb3f612c4df904.zip
gdb-729662a5221eaee2b3cd71d79afb3f612c4df904.tar.gz
gdb-729662a5221eaee2b3cd71d79afb3f612c4df904.tar.bz2
change probes to be program-space-independent
This changes the probes to be independent of the program space. After this, when a probe's address is needed, it is determined by applying offsets at the point of use. This introduces a bound_probe object, similar to bound minimal symbols. Objects of this type are used when it's necessary to pass a probe and its corresponding objfile. This removes the backlink from probe to objfile, which was primarily used to fetch the architecture to use. This adds a get_probe_address function which calls a probe method to compute the probe's relocated address. Similarly, it adds an objfile parameter to the semaphore methods so they can do the relocation properly as well. 2014-03-03 Tom Tromey <tromey@redhat.com> * break-catch-throw.c (fetch_probe_arguments): Use bound probes. * breakpoint.c (create_longjmp_master_breakpoint): Use get_probe_address. (add_location_to_breakpoint, bkpt_probe_insert_location) (bkpt_probe_remove_location): Update. * breakpoint.h (struct bp_location) <probe>: Now a bound_probe. * elfread.c (elf_symfile_relocate_probe): Remove. (elf_probe_fns): Update. (insert_exception_resume_breakpoint): Change type of "probe" parameter to bound_probe. (check_exception_resume): Update. * objfiles.c (objfile_relocate1): Don't relocate probes. * probe.c (bound_probe_s): New typedef. (parse_probes): Use get_probe_address. Set sal's objfile. (find_probe_by_pc): Return a bound_probe. (collect_probes): Return a VEC(bound_probe_s). (compare_probes): Update. (gen_ui_out_table_header_info): Change type of "probes" parameter. Update. (info_probes_for_ops): Update. (get_probe_address): New function. (probe_safe_evaluate_at_pc): Update. * probe.h (struct probe_ops) <get_probe_address>: New field. <set_semaphore, clear_semaphore>: Add objfile parameter. (struct probe) <objfile>: Remove field. <arch>: New field. <address>: Update comment. (struct bound_probe): New. (find_probe_by_pc): Return a bound_probe. (get_probe_address): Declare. * solib-svr4.c (struct probe_and_action) <address>: New field. (hash_probe_and_action, equal_probe_and_action): Update. (register_solib_event_probe): Add address parameter. (solib_event_probe_at): Update. (svr4_create_probe_breakpoints): Add objfile parameter. Use get_probe_address. * stap-probe.c (struct stap_probe) <sem_addr>: Update comment. (stap_get_probe_address): New function. (stap_can_evaluate_probe_arguments, compute_probe_arg) (compile_probe_arg): Update. (stap_set_semaphore, stap_clear_semaphore): Compute semaphore's address. (handle_stap_probe): Don't relocate the probe. (stap_relocate): Remove. (stap_gen_info_probes_table_values): Update. (stap_probe_ops): Remove stap_relocate. * symfile-debug.c (debug_sym_relocate_probe): Remove. (debug_sym_probe_fns): Update. * symfile.h (struct sym_probe_fns) <sym_relocate_probe>: Remove. * symtab.c (init_sal): Use memset. * symtab.h (struct symtab_and_line) <objfile>: New field. * tracepoint.c (start_tracing, stop_tracing): Update.
Diffstat (limited to 'gdb/probe.h')
-rw-r--r--gdb/probe.h49
1 files changed, 37 insertions, 12 deletions
diff --git a/gdb/probe.h b/gdb/probe.h
index 38cc950..aa8aba8 100644
--- a/gdb/probe.h
+++ b/gdb/probe.h
@@ -64,10 +64,11 @@ 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. */
@@ -97,13 +98,15 @@ struct probe_ops
sense if the probe has a concept of semaphore associated to a
probe. */
- 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. */
- 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. */
@@ -166,10 +169,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,10 +179,27 @@ 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. */
@@ -194,9 +212,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,
@@ -221,6 +240,12 @@ extern void info_probes_for_ops (char *arg, int from_tty,
extern struct cmd_list_element **info_probes_cmdlist_get (void);
+/* 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. */
extern unsigned get_probe_argument_count (struct probe *probe,