summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2008-09-30 20:42:21 +0000
committerJoel Brobecker <brobecker@gnat.com>2008-09-30 20:42:21 +0000
commit3d0b0fa396d73f8c06709d0c2001366d9d8d5239 (patch)
treea53fd6db11f8426163f4acedcbd3bc82a9ef3f9e
parentcdc7bb92c7632624063844c7bcaa4aca90e2a622 (diff)
downloadbinutils-gdb-3d0b0fa396d73f8c06709d0c2001366d9d8d5239.tar.gz
* ada-lang.c (standard_exc): New static constant.
(ada_exception_catchpoint_cond_string): Add special handling for the predefined exceptions.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/ada-lang.c38
2 files changed, 44 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9b8d0f488b8..4a02fb7c5d7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2008-09-30 Joel Brobecker <brobecker@adacore.com>
+ * ada-lang.c (standard_exc): New static constant.
+ (ada_exception_catchpoint_cond_string): Add special handling
+ for the predefined exceptions.
+
+2008-09-30 Joel Brobecker <brobecker@adacore.com>
+
* ada-lang.c (ADA_RETAIN_DOTS): Delete this dead macro. Update
the code accordingly.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 2b73bdbdab9..45a59f2c57c 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -9650,6 +9650,15 @@ enum exception_catchpoint_kind
ex_catch_assert
};
+/* Ada's standard exceptions. */
+
+static char *standard_exc[] = {
+ "constraint_error",
+ "program_error",
+ "storage_error",
+ "tasking_error"
+};
+
typedef CORE_ADDR (ada_unhandled_exception_name_addr_ftype) (void);
/* A structure that describes how to support exception catchpoints
@@ -10334,6 +10343,35 @@ ada_exception_breakpoint_ops (enum exception_catchpoint_kind ex)
static char *
ada_exception_catchpoint_cond_string (const char *exp_string)
{
+ int i;
+
+ /* The standard exceptions are a special case. They are defined in
+ runtime units that have been compiled without debugging info; if
+ EXP_STRING is the not-fully-qualified name of a standard
+ exception (e.g. "constraint_error") then, during the evaluation
+ of the condition expression, the symbol lookup on this name would
+ *not* return this standard exception. The catchpoint condition
+ may then be set only on user-defined exceptions which have the
+ same not-fully-qualified name (e.g. my_package.constraint_error).
+
+ To avoid this unexcepted behavior, these standard exceptions are
+ systematically prefixed by "standard". This means that "catch
+ exception constraint_error" is rewritten into "catch exception
+ standard.constraint_error".
+
+ If an exception named contraint_error is defined in another package of
+ the inferior program, then the only way to specify this exception as a
+ breakpoint condition is to use its fully-qualified named:
+ e.g. my_package.constraint_error. */
+
+ for (i = 0; i < sizeof (standard_exc) / sizeof (char *); i++)
+ {
+ if (strcmp (standard_exc [i], exp_string) == 0)
+ {
+ return xstrprintf ("long_integer (e) = long_integer (&standard.%s)",
+ exp_string);
+ }
+ }
return xstrprintf ("long_integer (e) = long_integer (&%s)", exp_string);
}