summaryrefslogtreecommitdiff
path: root/gdb/break-catch-throw.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-04-15 18:06:42 +0000
committerTom Tromey <tromey@redhat.com>2013-04-15 18:06:42 +0000
commit57e585c7379ae9b187ff75dca72e4bc4448cbac3 (patch)
tree277a81160407cc9d35d3ec1d5dd38c9dcd41de90 /gdb/break-catch-throw.c
parent2d99d7b9cf07a4c6fd70f04e63f159e64abace77 (diff)
downloadgdb-57e585c7379ae9b187ff75dca72e4bc4448cbac3.tar.gz
* break-catch-throw.c (struct exception_names): New.
(exception_functions): Change type. (re_set_exception_catchpoint): Look for SDT probes.
Diffstat (limited to 'gdb/break-catch-throw.c')
-rw-r--r--gdb/break-catch-throw.c58
1 files changed, 44 insertions, 14 deletions
diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c
index dd05078e2cb..8b9b837f9fd 100644
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -31,6 +31,7 @@
#include "mi/mi-common.h"
#include "exceptions.h"
#include "linespec.h"
+#include "probe.h"
/* Enums for exception-handling support. */
enum exception_event_kind
@@ -40,13 +41,29 @@ enum exception_event_kind
EX_EVENT_CATCH
};
-/* Names of the ordinary functions on which to break. This is indexed
- by exception_event_kind. */
-static const char * const exception_functions[] =
+/* Each spot where we may place an exception-related catchpoint has
+ two names: the SDT probe point and the function name. This
+ structure holds both. */
+
+struct exception_names
+{
+ /* The name of the probe point to try, in the form accepted by
+ 'parse_probes'. */
+
+ const char *probe;
+
+ /* The name of the corresponding function. */
+
+ const char *function;
+};
+
+/* Names of the probe points and functions on which to break. This is
+ indexed by exception_event_kind. */
+static const struct exception_names exception_functions[] =
{
- "__cxa_throw",
- "__cxa_rethrow",
- "__cxa_begin_catch"
+ { "-probe-stap libstdcxx:throw", "__cxa_throw" },
+ { "-probe-stap libstdcxx:rethrow", "__cxa_rethrow" },
+ { "-probe-stap libstdcxx:catch", "__cxa_begin_catch" }
};
static struct breakpoint_ops gnu_v3_exception_catchpoint_ops;
@@ -85,17 +102,30 @@ re_set_exception_catchpoint (struct breakpoint *self)
volatile struct gdb_exception e;
struct cleanup *cleanup;
enum exception_event_kind kind = classify_exception_breakpoint (self);
+ int pass;
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ for (pass = 0; sals.sals == NULL && pass < 2; ++pass)
{
- char *spec = ASTRDUP (exception_functions[kind]);
-
- self->ops->decode_linespec (self, &spec, &sals);
+ TRY_CATCH (e, RETURN_MASK_ERROR)
+ {
+ char *spec;
+
+ if (pass == 0)
+ {
+ spec = ASTRDUP (exception_functions[kind].probe);
+ sals = parse_probes (&spec, NULL);
+ }
+ else
+ {
+ spec = ASTRDUP (exception_functions[kind].function);
+ self->ops->decode_linespec (self, &spec, &sals);
+ }
+ }
+ /* NOT_FOUND_ERROR just means the breakpoint will be pending, so
+ let it through. */
+ if (e.reason < 0 && e.error != NOT_FOUND_ERROR)
+ throw_exception (e);
}
- /* NOT_FOUND_ERROR just means the breakpoint will be pending, so let
- it through. */
- if (e.reason < 0 && e.error != NOT_FOUND_ERROR)
- throw_exception (e);
cleanup = make_cleanup (xfree, sals.sals);
update_breakpoint_locations (self, sals, sals_end);