diff options
author | Tom Tromey <tromey@adacore.com> | 2025-01-21 10:49:07 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2025-01-22 08:08:25 -0700 |
commit | fbfadf96594a120f820457f03d7cf20b5e8ad597 (patch) | |
tree | 71a599c44e0ca88cb196bf82a4ec07a02a58baee /gdb/ada-lang.c | |
parent | 63efd116baafd6210a65b29973766c3fa264098f (diff) | |
download | binutils-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.c | 5 |
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 |