diff options
author | Tom Tromey <tromey@adacore.com> | 2020-05-05 06:57:04 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-05-20 07:20:05 -0600 |
commit | 250106a76acffac0067c6618dd784f2260b56ade (patch) | |
tree | f2330572c40a74d0e46f712a17e31daf431c7b0f | |
parent | 11c0dd51e8675c923fe40f2d1ad09269bfe9978a (diff) | |
download | gdb-250106a76acffac0067c6618dd784f2260b56ade.zip gdb-250106a76acffac0067c6618dd784f2260b56ade.tar.gz gdb-250106a76acffac0067c6618dd784f2260b56ade.tar.bz2 |
Remove bound_name static from ada-lang.c
ada-lang.c has a "bound_name" static that is used when finding fields
in a structure in some cases. This patch removes it in favor of
computing the desired field name at runtime; this avoids an artificial
limit.
I'm checking this in. Tested on x86-64 Fedora 30, and also on the
internal AdaCore test suite.
gdb/ChangeLog
2020-05-20 Tom Tromey <tromey@adacore.com>
* ada-lang.c (bound_name, MAX_ADA_DIMENS): Remove.
(desc_one_bound, desc_index_type): Compute field name.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/ada-lang.c | 23 |
2 files changed, 14 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6a7cbf3..bef88d0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-05-20 Tom Tromey <tromey@adacore.com> + + * ada-lang.c (bound_name, MAX_ADA_DIMENS): Remove. + (desc_one_bound, desc_index_type): Compute field name. + 2020-05-20 Tom de Vries <tdevries@suse.de> PR symtab/25833 diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 825549d..9f6485e 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -1486,18 +1486,6 @@ ada_fixup_array_indexes_type (struct type *index_desc_type) } } -/* Names of MAX_ADA_DIMENS bounds in P_BOUNDS fields of array descriptors. */ - -static const char *bound_name[] = { - "LB0", "UB0", "LB1", "UB1", "LB2", "UB2", "LB3", "UB3", - "LB4", "UB4", "LB5", "UB5", "LB6", "UB6", "LB7", "UB7" -}; - -/* Maximum number of array dimensions we are prepared to handle. */ - -#define MAX_ADA_DIMENS (sizeof(bound_name) / (2*sizeof(char *))) - - /* The desc_* routines return primitive portions of array descriptors (fat pointers). */ @@ -1760,7 +1748,10 @@ fat_pntr_data_bitsize (struct type *type) static struct value * desc_one_bound (struct value *bounds, int i, int which) { - return value_struct_elt (&bounds, NULL, bound_name[2 * i + which - 2], NULL, + char bound_name[20]; + xsnprintf (bound_name, sizeof (bound_name), "%cB%d", + which ? 'U' : 'L', i - 1); + return value_struct_elt (&bounds, NULL, bound_name, NULL, _("Bad GNAT array descriptor bounds")); } @@ -1798,7 +1789,11 @@ desc_index_type (struct type *type, int i) type = desc_base_type (type); if (type->code () == TYPE_CODE_STRUCT) - return lookup_struct_elt_type (type, bound_name[2 * i - 2], 1); + { + char bound_name[20]; + xsnprintf (bound_name, sizeof (bound_name), "LB%d", i - 1); + return lookup_struct_elt_type (type, bound_name, 1); + } else return NULL; } |