public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM] archer-sergiodj-stap: allow multiple probes to match when creating internal breakpoints this fixes longjmp.exp
@ 2011-06-03 19:21 tromey
0 siblings, 0 replies; only message in thread
From: tromey @ 2011-06-03 19:21 UTC (permalink / raw)
To: archer-commits
The branch, archer-sergiodj-stap has been updated
via 433108a197ec97c60aba6f6db28009956224a387 (commit)
from 2e9812415849a1216e5b42f189ace5946b2c5bcb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit 433108a197ec97c60aba6f6db28009956224a387
Author: Tom Tromey <tromey@redhat.com>
Date: Fri Jun 3 13:20:01 2011 -0600
allow multiple probes to match when creating internal breakpoints
this fixes longjmp.exp
-----------------------------------------------------------------------
Summary of changes:
gdb/breakpoint.c | 92 +++++++++++++++++++++++++++++++++++-------------------
gdb/stap-probe.c | 13 ++++---
gdb/stap-probe.h | 15 ++++++---
3 files changed, 77 insertions(+), 43 deletions(-)
First 500 lines of diff:
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 583c870..1deaac2 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -2144,8 +2144,11 @@ struct breakpoint_objfile_data
/* Minimal symbol(s) for "longjmp", "siglongjmp", etc. (if any). */
struct minimal_symbol *longjmp_msym[NUM_LONGJMP_NAMES];
- /* SystemTap probe point for longjmp (if any). */
- const struct stap_probe *longjmp_probe;
+ /* True if we have looked for longjmp probes. */
+ int longjmp_searched;
+
+ /* SystemTap probe points for longjmp (if any). */
+ VEC (stap_probe_p) *longjmp_probes;
/* Minimal symbol for "std::terminate()" (if any). */
struct minimal_symbol *terminate_msym;
@@ -2153,15 +2156,15 @@ struct breakpoint_objfile_data
/* Minimal symbol for "_Unwind_DebugHook" (if any). */
struct minimal_symbol *exception_msym;
- /* SystemTap probe point for unwinding (if any). */
- const struct stap_probe *exception_probe;
+ /* True if we have looked for exception probes. */
+ int exception_searched;
+
+ /* SystemTap probe points for unwinding (if any). */
+ VEC (stap_probe_p) *exception_probes;
};
static const struct objfile_data *breakpoint_objfile_key;
-/* SystemTap probe not found sentinel. */
-static const struct stap_probe probe_not_found;
-
/* Minimal symbol not found sentinel. */
static struct minimal_symbol msym_not_found;
@@ -2194,6 +2197,15 @@ get_breakpoint_objfile_data (struct objfile *objfile)
}
static void
+free_breakpoint_probes (struct objfile *obj, void *data)
+{
+ struct breakpoint_objfile_data *bp_objfile_data = data;
+
+ VEC_free (stap_probe_p, bp_objfile_data->longjmp_probes);
+ VEC_free (stap_probe_p, bp_objfile_data->exception_probes);
+}
+
+static void
create_overlay_event_breakpoint (void)
{
struct objfile *objfile;
@@ -2269,27 +2281,34 @@ create_longjmp_master_breakpoint (void)
bp_objfile_data = get_breakpoint_objfile_data (objfile);
- if (bp_objfile_data->longjmp_probe != &probe_not_found)
+ if (!bp_objfile_data->longjmp_searched)
{
- if (bp_objfile_data->longjmp_probe == NULL)
- bp_objfile_data->longjmp_probe
- = find_probe_in_objfile (objfile, "libc", "longjmp");
+ bp_objfile_data->longjmp_probes
+ = find_probes_in_objfile (objfile, "libc", "longjmp");
+ bp_objfile_data->longjmp_searched = 1;
+ }
- if (bp_objfile_data->longjmp_probe)
+ if (bp_objfile_data->longjmp_probes != NULL)
+ {
+ int i;
+ const struct stap_probe *probe;
+ struct gdbarch *gdbarch = get_objfile_arch (objfile);
+
+ for (i = 0;
+ VEC_iterate (stap_probe_p,
+ bp_objfile_data->longjmp_probes,
+ i, probe);
+ ++i)
{
struct breakpoint *b;
- struct gdbarch *gdbarch = get_objfile_arch (objfile);
-
- b = create_internal_breakpoint (gdbarch,
- bp_objfile_data->longjmp_probe->address,
+
+ b = create_internal_breakpoint (gdbarch, probe->address,
bp_longjmp_master);
b->addr_string = xstrdup ("probe:libc:longjmp");
b->enable_state = bp_disabled;
-
- continue;
}
- else
- bp_objfile_data->longjmp_probe = &probe_not_found;
+
+ continue;
}
for (i = 0; i < NUM_LONGJMP_NAMES; i++)
@@ -2401,26 +2420,34 @@ create_exception_master_breakpoint (void)
bp_objfile_data = get_breakpoint_objfile_data (objfile);
/* We prefer the SystemTap probe point if it exists. */
- if (bp_objfile_data->exception_probe != &probe_not_found)
+ if (!bp_objfile_data->exception_searched)
+ {
+ bp_objfile_data->exception_probes
+ = find_probes_in_objfile (objfile, "libgcc", "unwind");
+ bp_objfile_data->exception_searched = 1;
+ }
+
+ if (bp_objfile_data->exception_probes != NULL)
{
- if (bp_objfile_data->exception_probe == NULL)
- bp_objfile_data->exception_probe
- = find_probe_in_objfile (objfile, "libgcc", "unwind");
+ struct gdbarch *gdbarch = get_objfile_arch (objfile);
+ int i;
+ const struct stap_probe *probe;
- if (bp_objfile_data->exception_probe)
+ for (i = 0;
+ VEC_iterate (stap_probe_p,
+ bp_objfile_data->exception_probes,
+ i, probe);
+ ++i)
{
struct breakpoint *b;
- struct gdbarch *gdbarch = get_objfile_arch (objfile);
- b = create_internal_breakpoint (gdbarch,
- bp_objfile_data->exception_probe->address,
+ b = create_internal_breakpoint (gdbarch, probe->address,
bp_exception_master);
b->addr_string = xstrdup ("probe:libgcc:unwind");
b->enable_state = bp_disabled;
- continue;
}
- else
- bp_objfile_data->exception_probe = &probe_not_found;
+
+ continue;
}
/* Otherwise, try the hook function. */
@@ -12317,7 +12344,8 @@ _initialize_breakpoint (void)
observer_attach_inferior_exit (clear_syscall_counts);
observer_attach_memory_changed (invalidate_bp_value_on_memory_change);
- breakpoint_objfile_key = register_objfile_data ();
+ breakpoint_objfile_key
+ = register_objfile_data_with_cleanup (NULL, free_breakpoint_probes);
breakpoint_chain = 0;
/* Don't bother to call set_breakpoint_count. $bpnum isn't useful
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index e251bd3..53babbb 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -1725,13 +1725,14 @@ info_probes_command (char *arg, int from_tty)
\f
-const struct stap_probe *
-find_probe_in_objfile (struct objfile *objfile,
- const char *provider,
- const char *name)
+VEC (stap_probe_p) *
+find_probes_in_objfile (struct objfile *objfile,
+ const char *provider,
+ const char *name)
{
const struct stap_probe *probes;
int i, num_probes;
+ VEC (stap_probe_p) *result = NULL;
if (! objfile->sf || ! objfile->sf->sym_probe_fns)
return NULL;
@@ -1745,10 +1746,10 @@ find_probe_in_objfile (struct objfile *objfile,
if (strcmp (probes[i].name, name) != 0)
continue;
- return &probes[i];
+ VEC_safe_push (stap_probe_p, result, &probes[i]);
}
- return NULL;
+ return result;
}
struct symtabs_and_lines
diff --git a/gdb/stap-probe.h b/gdb/stap-probe.h
index d700b19..9dc509a 100644
--- a/gdb/stap-probe.h
+++ b/gdb/stap-probe.h
@@ -20,6 +20,8 @@
#if !defined (STAP_PROBE_H)
#define STAP_PROBE_H 1
+#include "vec.h"
+
struct stap_args_info;
struct axs_value;
struct linespec_result;
@@ -49,6 +51,8 @@ struct stap_probe
struct stap_args_info *parsed_args;
};
+typedef const struct stap_probe *stap_probe_p;
+DEF_VEC_P (stap_probe_p);
/* A helper for linespec that decodes a stap probe specification. It
returns a symtabs_and_lines object and updates *ARGPTR or throws an
@@ -58,12 +62,13 @@ extern struct symtabs_and_lines parse_stap_probe (char **argptr,
struct linespec_result *canon,
int *not_found_ptr);
-/* Search OBJFILE for a probe with the given PROVIDER and NAME. If a
- probe is found, return it. If no probe is found, return NULL. */
+/* Search OBJFILE for a probe with the given PROVIDER and NAME.
+ Return a VEC of all probes that were found. If no matching probe
+ is found, return NULL. The caller must free the VEC. */
-extern const struct stap_probe *find_probe_in_objfile (struct objfile *objfile,
- const char *provider,
- const char *name);
+extern VEC (stap_probe_p) *find_probes_in_objfile (struct objfile *objfile,
+ const char *provider,
+ const char *name);
/* Given a PC, find an associated SystemTap probe. If a probe is
found, set *OBJFILE_OUT to the probe's objfile, and return the
hooks/post-receive
--
Repository for Project Archer.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-06-03 19:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-03 19:21 [SCM] archer-sergiodj-stap: allow multiple probes to match when creating internal breakpoints this fixes longjmp.exp 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).