aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@adacore.com>2018-09-08 16:46:08 -0500
committerJoel Brobecker <brobecker@adacore.com>2018-09-08 17:46:08 -0400
commit57aff202b4b17a05d73e71680a26fe12a817f110 (patch)
tree691078346a18b6372dfc4cda0387ca0f3cf16554 /gdb
parentfb44b1a737ee7d53d5d88c4f2a3d449e8084d6c2 (diff)
downloadbinutils-57aff202b4b17a05d73e71680a26fe12a817f110.zip
binutils-57aff202b4b17a05d73e71680a26fe12a817f110.tar.gz
binutils-57aff202b4b17a05d73e71680a26fe12a817f110.tar.bz2
(Ada) "catch assert" spurious internal error
We noticed while debugging a program compiled without assertions enabled and using an older compiler that inserting a catchpoint on failed assertions would cause an internal error: (gdb) catch assert ../../src/gdb/ada-lang.c:13321: internal-error: ada_exception_sal: Assertion`sym != NULL' failed. A problem internal to GDB has been detected, This is due to a combination of factors: 1. With older versions of the compiler, the function used as a hook was provided by a unit that's different from the unit which provides the hooks for the other exception catchpoints. 2. The program either does not use any assertion, or is compiled without the assertions enabled. With newer versions of the compiler, all such functions are provided by the same unit, so should normally always be available. However, there can still be reasons why this is not the case. Consider, for instance, the case of a runtime compiled with -ffunction-sections, in which case the hook might be eliminated unless assertions are used and enabled. So this patch transforms the internal error into a simple error. gdb/ChangeLog: * ada-lang.c (ada_exception_sal): Replace gdb_assert calls by calls to error. No testcase added, as the existing testcase gdb.ada/catch_ex.exp should trigger it when using an older version of GNAT as the Ada compiler.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/ada-lang.c13
2 files changed, 10 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 41dee6e..4aeb0ba 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2018-09-08 Joel Brobecker <brobecker@adacore.com>
+ * ada-lang.c (ada_exception_sal): Replace gdb_assert calls
+ by calls to error.
+
+2018-09-08 Joel Brobecker <brobecker@adacore.com>
+
* ada-lang.c (ada_unhandled_exception_name_addr_from_raise):
Move update of loop variable "fi".
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 87ae275..c5cddd0 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13215,14 +13215,11 @@ ada_exception_sal (enum ada_exception_catchpoint_kind ex,
sym_name = ada_exception_sym_name (ex);
sym = standard_lookup (sym_name, NULL, VAR_DOMAIN);
- /* We can assume that SYM is not NULL at this stage. If the symbol
- did not exist, ada_exception_support_info_sniffer would have
- raised an exception.
-
- Also, ada_exception_support_info_sniffer should have already
- verified that SYM is a function symbol. */
- gdb_assert (sym != NULL);
- gdb_assert (SYMBOL_CLASS (sym) == LOC_BLOCK);
+ if (sym == NULL)
+ error (_("Catchpoint symbol not found: %s"), sym_name);
+
+ if (SYMBOL_CLASS (sym) != LOC_BLOCK)
+ error (_("Unable to insert catchpoint. %s is not a function."), sym_name);
/* Set ADDR_STRING. */
*addr_string = xstrdup (sym_name);