aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2025-01-21 10:49:07 -0700
committerTom Tromey <tromey@adacore.com>2025-01-22 08:08:25 -0700
commitfbfadf96594a120f820457f03d7cf20b5e8ad597 (patch)
tree71a599c44e0ca88cb196bf82a4ec07a02a58baee /gdb/ada-lang.c
parent63efd116baafd6210a65b29973766c3fa264098f (diff)
downloadbinutils-fbfadf96594a120f820457f03d7cf20b5e8ad597.zip
binutils-fbfadf96594a120f820457f03d7cf20b5e8ad597.tar.gz
binutils-fbfadf96594a120f820457f03d7cf20b5e8ad597.tar.bz2
Avoid crash with 'length
While testing gnat-llvm, I found a gdb crash when applying 'length to a non-array type. This patch fixes the crash.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index fdb89cb..1cfd843 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -1819,7 +1819,8 @@ desc_bounds_type (struct type *type)
}
/* If ARR is an array descriptor (fat or thin pointer), or pointer to
- one, a pointer to its bounds data. Otherwise NULL. */
+ one, a pointer to its bounds data. Otherwise, throw an
+ exception. */
static struct value *
desc_bounds (struct value *arr)
@@ -1870,7 +1871,7 @@ desc_bounds (struct value *arr)
return p_bounds;
}
else
- return NULL;
+ error (_("Not an array"));
}
/* If TYPE is the type of an array-descriptor (fat pointer), the bit