Change Ada catchpoints to be bp_catchpoint
authorTom Tromey <tromey@adacore.com>
Wed, 10 Jul 2019 17:05:20 +0000 (11:05 -0600)
committerTom Tromey <tromey@adacore.com>
Wed, 10 Jul 2019 20:48:53 +0000 (14:48 -0600)
Like Pedro's earlier patches to change catchpoint to be of type
bp_catchpoint, this changes the Ada catchpoints to follow.

Tested on x86-64 Fedora 29.

gdb/ChangeLog
2019-07-10  Tom Tromey  <tromey@adacore.com>

* ada-lang.h (is_ada_exception_catchpoint): Declare.
* breakpoint.c (init_ada_exception_breakpoint): Register as
bp_catchpoint.
(print_one_breakpoint_location, print_one_breakpoint): Use
is_ada_exception_catchpoint.
* ada-lang.c (class ada_catchpoint_location): Pass
bp_loc_software_breakpoint to bp_location constructor.
(is_ada_exception_catchpoint): New function.

gdb/testsuite/ChangeLog
2019-07-10  Tom Tromey  <tromey@adacore.com>

* gdb.ada/mi_ex_cond.exp: Update expected results.
* gdb.ada/mi_catch_ex_hand.exp: Update expected results.
* gdb.ada/mi_catch_ex.exp: Update expected results.
* gdb.ada/mi_catch_assert.exp: Update expected results.
* gdb.ada/catch_ex.exp (catch_exception_info)
(catch_exception_entry, catch_assert_entry)
(catch_unhandled_entry): Update.
* gdb.ada/catch_assert_if.exp: Update expected results.

gdb/ChangeLog
gdb/ada-lang.c
gdb/ada-lang.h
gdb/breakpoint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/catch_assert_if.exp
gdb/testsuite/gdb.ada/catch_ex.exp
gdb/testsuite/gdb.ada/mi_catch_assert.exp
gdb/testsuite/gdb.ada/mi_catch_ex.exp
gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp
gdb/testsuite/gdb.ada/mi_ex_cond.exp

index 90242001df860219f90519f7f0f277998c889ece..aa8b53a121492e00548e48c7b9eb0eb25468ac19 100644 (file)
@@ -1,3 +1,14 @@
+2019-07-10  Tom Tromey  <tromey@adacore.com>
+
+       * ada-lang.h (is_ada_exception_catchpoint): Declare.
+       * breakpoint.c (init_ada_exception_breakpoint): Register as
+       bp_catchpoint.
+       (print_one_breakpoint_location, print_one_breakpoint): Use
+       is_ada_exception_catchpoint.
+       * ada-lang.c (class ada_catchpoint_location): Pass
+       bp_loc_software_breakpoint to bp_location constructor.
+       (is_ada_exception_catchpoint): New function.
+
 2019-07-10  Tom Tromey  <tromey@adacore.com>
 
        * arm-tdep.c (arm_exidx_entry_s): Remove typedef.  Don't define
index ae28265d496603ee0925eaa2fea99e7cbea1b4c6..deb5099024edf551a21df9399205b189c022460b 100644 (file)
@@ -12283,7 +12283,7 @@ class ada_catchpoint_location : public bp_location
 {
 public:
   ada_catchpoint_location (breakpoint *owner)
-    : bp_location (owner)
+    : bp_location (owner, bp_loc_software_breakpoint)
   {}
 
   /* The condition that checks whether the exception that was raised
@@ -12546,14 +12546,11 @@ print_one_exception (enum ada_exception_catchpoint_kind ex,
   struct value_print_options opts;
 
   get_user_print_options (&opts);
+
   if (opts.addressprint)
-    {
-      annotate_field (4);
-      uiout->field_core_addr ("addr", b->loc->gdbarch, b->loc->address);
-    }
+    uiout->field_skip ("addr");
 
   annotate_field (5);
-  *last_loc = b->loc;
   switch (ex)
     {
       case ada_catch_exception:
@@ -12871,6 +12868,17 @@ print_recreate_catch_handlers (struct breakpoint *b,
 
 static struct breakpoint_ops catch_handlers_breakpoint_ops;
 
+/* See ada-lang.h.  */
+
+bool
+is_ada_exception_catchpoint (breakpoint *bp)
+{
+  return (bp->ops == &catch_exception_breakpoint_ops
+         || bp->ops == &catch_exception_unhandled_breakpoint_ops
+         || bp->ops == &catch_assert_breakpoint_ops
+         || bp->ops == &catch_handlers_breakpoint_ops);
+}
+
 /* Split the arguments specified in a "catch exception" command.  
    Set EX to the appropriate catchpoint type.
    Set EXCEP_STRING to the name of the specific exception if
index 788f7a6d3a33b57d0db9690f021faf4c6995b95f..2fc3f523ca7df00a2dd66f1277181f1840ee1ec5 100644 (file)
@@ -378,6 +378,10 @@ extern void create_ada_exception_catchpoint
    const std::string &excep_string, const std::string &cond_string, int tempflag,
    int disabled, int from_tty);
 
+/* Return true if BP is an Ada catchpoint.  */
+
+extern bool is_ada_exception_catchpoint (breakpoint *bp);
+
 /* Some information about a given Ada exception.  */
 
 struct ada_exc_info
index 8ae7cd6e7ef0679929f2414611b8090b4d0c9c11..09c2a27a38b0f704730891c65db87e68b8ea6273 100644 (file)
@@ -6054,7 +6054,8 @@ print_one_breakpoint_location (struct breakpoint *b,
          annotate_field (5);
          uiout->field_string ("what", w->exp_string);
        }
-      else if (!is_catchpoint (b) || is_exception_catchpoint (b))
+      else if (!is_catchpoint (b) || is_exception_catchpoint (b)
+              || is_ada_exception_catchpoint (b))
        {
          if (opts.addressprint)
            {
@@ -6329,7 +6330,8 @@ print_one_breakpoint (struct breakpoint *b,
         exposed to users.  We do however display the internal
         breakpoint locations with "maint info breakpoints".  */
       if (!is_hardware_watchpoint (b)
-         && (!is_catchpoint (b) || is_exception_catchpoint (b))
+         && (!is_catchpoint (b) || is_exception_catchpoint (b)
+             || is_ada_exception_catchpoint (b))
          && (allflag
              || (b->loc && (b->loc->next || !b->loc->enabled))))
        {
@@ -11212,7 +11214,7 @@ init_ada_exception_breakpoint (struct breakpoint *b,
          enough for now, though.  */
     }
 
-  init_raw_breakpoint (b, gdbarch, sal, bp_breakpoint, ops);
+  init_raw_breakpoint (b, gdbarch, sal, bp_catchpoint, ops);
 
   b->enable_state = enabled ? bp_enabled : bp_disabled;
   b->disposition = tempflag ? disp_del : disp_donttouch;
index 0118420abc31628a6f29cca45d721a44658539ca..247171abaee7466869f682e9c0368ca44571f89f 100644 (file)
@@ -1,3 +1,14 @@
+2019-07-10  Tom Tromey  <tromey@adacore.com>
+
+       * gdb.ada/mi_ex_cond.exp: Update expected results.
+       * gdb.ada/mi_catch_ex_hand.exp: Update expected results.
+       * gdb.ada/mi_catch_ex.exp: Update expected results.
+       * gdb.ada/mi_catch_assert.exp: Update expected results.
+       * gdb.ada/catch_ex.exp (catch_exception_info)
+       (catch_exception_entry, catch_assert_entry)
+       (catch_unhandled_entry): Update.
+       * gdb.ada/catch_assert_if.exp: Update expected results.
+
 2019-07-10  Richard Bunt  <richard.bunt@arm.com>
        Stephen Roberts  <stephen.roberts@arm.com>
 
index 0bf2dd6a66b4686be22b19058b1566e8a25ee146..61a12a7d73826e16165f9fbbd151f10035c78aea 100644 (file)
@@ -70,7 +70,7 @@ gdb_test "catch assert if Global_Var = 2" \
 
 # Check that condition is stored and properly displayed.
 
-set exp_bp ".*$decimal${sp}breakpoint${sp}keep${sp}y${sp}$hex failed Ada assertions$eol${sp}stop only if Global_Var = 2.*"
+set exp_bp ".*$decimal${sp}catchpoint${sp}keep${sp}y${sp}failed Ada assertions$eol${sp}stop only if Global_Var = 2.*"
 gdb_test "info breakpoint" $exp_bp "Check catch assertions with condition"
 
 set bp_location [gdb_get_line_number "STOP" ${testdir}/bla.adb]
index 772100ac127e857312802223e0d1324e4b8daeda..5a560c1217d3480717a94c0bc300fa69410cd6da 100644 (file)
@@ -32,7 +32,7 @@ set sp "\[ \t\]*"
 
 set info_break_header "Num${sp}Type${sp}Disp${sp}Enb${sp}Address${sp}What"
 set catch_exception_info \
-  "$any_nb${sp}breakpoint${sp}keep${sp}y${sp}$any_addr${sp}all Ada exceptions"
+  "$any_nb${sp}catchpoint${sp}keep${sp}y${sp}all Ada exceptions"
 
 ####################################
 # 1. Try catching all exceptions.  #
@@ -105,11 +105,11 @@ gdb_test "catch exception unhandled" \
          "insert catchpoint on unhandled exceptions"
 
 set catch_exception_entry \
-  "$any_nb${sp}breakpoint${sp}keep${sp}y${sp}$any_addr${sp}\`Program_Error' Ada exception"
+  "$any_nb${sp}catchpoint${sp}keep${sp}y${sp}\`Program_Error' Ada exception"
 set catch_assert_entry \
-  "$any_nb${sp}breakpoint${sp}keep${sp}y${sp}$any_addr${sp}failed Ada assertions"
+  "$any_nb${sp}catchpoint${sp}keep${sp}y${sp}failed Ada assertions"
 set catch_unhandled_entry \
-  "$any_nb${sp}breakpoint${sp}keep${sp}y${sp}$any_addr${sp}unhandled Ada exceptions"
+  "$any_nb${sp}catchpoint${sp}keep${sp}y${sp}unhandled Ada exceptions"
 
 gdb_test "info break" \
          "$info_break_header$eol.*$catch_exception_entry$eol$catch_assert_entry$eol$catch_unhandled_entry" \
index ebecf03bd5b6f6e8f59c4d7c8900d629ed161de1..6e6093ed5215ac4b33dd3902c2d4b8935fccc7e0 100644 (file)
@@ -81,7 +81,7 @@ if ![mi_run_to_main] then {
 }
 
 mi_gdb_test "-catch-assert -c \"Global_Var = 2\"" \
-            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",addr=\"$hex\",what=\"failed Ada assertions\",.*,cond=\"Global_Var = 2\",.*}" \
+            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",what=\"failed Ada assertions\",.*,cond=\"Global_Var = 2\",.*}" \
             "catch assert failures with condition"
 
 set bp_location [gdb_get_line_number "STOP" ${testdir}/bla.adb]
index 772a0506a291f814865d1e98e58d82cc17362a34..93585989b8ea90d98af4a6fcebbe9cbe3bf30f71 100644 (file)
@@ -75,7 +75,7 @@ if ![mi_run_to_main] then {
 }
 
 mi_gdb_test "-catch-exception" \
-            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",addr=\"$hex\",what=\"all Ada exceptions\",.*}" \
+            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",what=\"all Ada exceptions\",.*}" \
             "catch all exceptions"
 
 # Continue to caught exception.
@@ -131,15 +131,15 @@ if ![mi_run_to_main] then {
 }
 
 mi_gdb_test "-catch-exception -e Program_Error" \
-            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",addr=\"$hex\",what=\"`Program_Error' Ada exception\",.*}" \
+            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",what=\"`Program_Error' Ada exception\",.*}" \
             "catch Program_Error"
 
 mi_gdb_test "-catch-assert" \
-            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",addr=\"$hex\",what=\"failed Ada assertions\",.*}" \
+            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",what=\"failed Ada assertions\",.*}" \
             "catch assert failures"
 
 mi_gdb_test "-catch-exception -u" \
-            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",addr=\"$hex\",what=\"unhandled Ada exceptions\",.*}" \
+            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",what=\"unhandled Ada exceptions\",.*}" \
             "catch unhandled exceptions"
 
 mi_execute_to "exec-continue" \
index 11a9d1dc66771812390c12b7c5b69d6a76796d3e..a4734b99094a93fa095ad6ebef2b9b1eb9413b7c 100644 (file)
@@ -70,7 +70,7 @@ if ![mi_run_to_main] then {
 }
 
 mi_gdb_test "-catch-handlers" \
-            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",addr=\"$hex\",what=\"all Ada exceptions handlers\",.*}" \
+            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",what=\"all Ada exceptions handlers\",.*}" \
             "catch all exceptions handlers"
 
 # Continue to exception handler.
@@ -120,7 +120,7 @@ if ![mi_run_to_main] then {
 }
 
 mi_gdb_test "-catch-handlers -e Constraint_Error" \
-            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",addr=\"$hex\",what=\"`Constraint_Error' Ada exception handlers\",.*}" \
+            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",what=\"`Constraint_Error' Ada exception handlers\",.*}" \
             "catch Constraint_Error"
 
 mi_execute_to "exec-continue" \
index ccbbe1f5d8ce055f3d0b924e27064482fadf1c68..16aa198e5e0d840548d16fe88d29714508106802 100644 (file)
@@ -69,7 +69,7 @@ mi_gdb_load ${binfile}
 # catchpoint that uses both conditions and exception name.
 
 mi_gdb_test "-catch-exception -c \"i = 2\" -e constraint_error" \
-            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",addr=\"$hex\",what=\"`constraint_error' Ada exception\",.*,cond=\"i = 2\",.*}" \
+            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",what=\"`constraint_error' Ada exception\",.*,cond=\"i = 2\",.*}" \
             "catch C_E if i = 2"
 
 # It is important that we start the program's execution after having