diff options
author | Tom de Vries <tdevries@suse.de> | 2023-09-07 21:53:17 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2023-09-07 21:53:17 +0200 |
commit | 74c36641b0e997ce81294e5bd4fe2d2ce017ea57 (patch) | |
tree | d1067de3d3702ead48a3b9d430a597c01967e8e0 /gdb/testsuite/gdb.python/py-objfile-script-gdb.py | |
parent | ef136c7fa165cf3ee75c37d41561be8a7bdc89bd (diff) | |
download | binutils-74c36641b0e997ce81294e5bd4fe2d2ce017ea57.zip binutils-74c36641b0e997ce81294e5bd4fe2d2ce017ea57.tar.gz binutils-74c36641b0e997ce81294e5bd4fe2d2ce017ea57.tar.bz2 |
[gdb/ada] Extend type equivalence test in ada_resolve_enum
When running test-case gdb.ada/local-enum.exp with target board debug-types, I
run into:
...
(gdb) print v1(three)^M
No name 'three' in enumeration type 'local__e1'^M
(gdb) FAIL: gdb.ada/local-enum.exp: print v1 element
...
The array V1 is of type A1 which is an array with index type E1, containing
"three" as enumerator:
...
type E1 is (one, two, three);
type A1 is array (E1) of Integer;
V1 : A1 := (0, 1, 2);
...
There's also a type E2 that contains three as enumerator:
...
type E2 is (three, four, five);
...
When doing "print v1(three)", it's the job of ada_resolve_enum to resolve
"three" to type E1 rather than type E2.
When using target board debug-types, the enums E1 and E2 are replicated in the
.debug_types section, and consequently in ada_resolve_enum the type
equivalence check using a pointer comparison fails:
...
for (int i = 0; i < syms.size (); ++i)
{
/* We already know the name matches, so we're just looking for
an element of the correct enum type. */
if (ada_check_typedef (syms[i].symbol->type ()) == context_type)
return i;
}
...
Fix this by also trying a structural comparison using
ada_identical_enum_types_p.
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
PR ada/29335
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29335
Diffstat (limited to 'gdb/testsuite/gdb.python/py-objfile-script-gdb.py')
0 files changed, 0 insertions, 0 deletions