aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2013-10-11 13:48:19 +0000
committerJoel Brobecker <brobecker@gnat.com>2013-10-11 13:48:19 +0000
commit349774efe258cff6b365b72df07f6ce2eb76cbd6 (patch)
treebf35bfb985653376ef70588140ebb7e97ea5bd45 /gdb/ada-lang.c
parent761269c8497f8f5e1cee4a4695ba48fb74fa86a3 (diff)
downloadgdb-349774efe258cff6b365b72df07f6ce2eb76cbd6.zip
gdb-349774efe258cff6b365b72df07f6ce2eb76cbd6.tar.gz
gdb-349774efe258cff6b365b72df07f6ce2eb76cbd6.tar.bz2
New GDB/MI commands to catch Ada exceptions
This patch introduces two new GDB/MI commands implementing the equivalent of the "catch exception" and "catch assert" GDB/CLI commands. gdb/ChangeLog: * breakpoint.h (init_ada_exception_breakpoint): Add parameter "enabled". * breakpoint.c (init_ada_exception_breakpoint): Add parameter "enabled". Set B->ENABLE_STATE accordingly. * ada-lang.h (ada_exception_catchpoint_kind): Move here from ada-lang.c. (create_ada_exception_catchpoint): Add declaration. * ada-lang.c (ada_exception_catchpoint_kind): Move to ada-lang.h. (create_ada_exception_catchpoint): Make non-static. Add new parameter "disabled". Use it in call to init_ada_exception_breakpoint. (catch_ada_exception_command): Add parameter "enabled" in call to create_ada_exception_catchpoint. (catch_assert_command): Likewise. * mi/mi-cmds.h (mi_cmd_catch_assert, mi_cmd_catch_exception): Add declarations. * mi/mi-cmds.c (mi_cmds): Add the "catch-assert" and "catch-exception" commands. * mi/mi-cmd-catch.c: Add #include "ada-lang.h". (mi_cmd_catch_assert, mi_cmd_catch_exception): New functions.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 3c7e4cf..9ff3ab9 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -10981,16 +10981,6 @@ ada_modulus (struct type *type)
variants of the runtime, we use a sniffer that will determine
the runtime variant used by the program being debugged. */
-/* The different types of catchpoints that we introduced for catching
- Ada exceptions. */
-
-enum ada_exception_catchpoint_kind
-{
- ada_catch_exception,
- ada_catch_exception_unhandled,
- ada_catch_assert
-};
-
/* Ada's standard exceptions. */
static char *standard_exc[] = {
@@ -12190,12 +12180,13 @@ ada_exception_sal (enum ada_exception_catchpoint_kind ex, char *excep_string,
FROM_TTY is the usual argument passed to all commands implementations. */
-static void
+void
create_ada_exception_catchpoint (struct gdbarch *gdbarch,
enum ada_exception_catchpoint_kind ex_kind,
char *excep_string,
char *cond_string,
int tempflag,
+ int disabled,
int from_tty)
{
struct ada_catchpoint *c;
@@ -12206,7 +12197,7 @@ create_ada_exception_catchpoint (struct gdbarch *gdbarch,
c = XNEW (struct ada_catchpoint);
init_ada_exception_breakpoint (&c->base, gdbarch, sal, addr_string,
- ops, tempflag, from_tty);
+ ops, tempflag, disabled, from_tty);
c->excep_string = excep_string;
create_excep_cond_exprs (c);
if (cond_string != NULL)
@@ -12234,7 +12225,8 @@ catch_ada_exception_command (char *arg, int from_tty,
&cond_string);
create_ada_exception_catchpoint (gdbarch, ex_kind,
excep_string, cond_string,
- tempflag, from_tty);
+ tempflag, 1 /* enabled */,
+ from_tty);
}
/* Split the arguments specified in a "catch assert" command.
@@ -12284,7 +12276,8 @@ catch_assert_command (char *arg, int from_tty,
catch_ada_assert_command_split (arg, &cond_string);
create_ada_exception_catchpoint (gdbarch, ada_catch_assert,
NULL, cond_string,
- tempflag, from_tty);
+ tempflag, 1 /* enabled */,
+ from_tty);
}
/* Operators */
/* Information about operators given special treatment in functions