forked from Imagelibrary/binutils-gdb
gdb
PR gdb/10309: * c-lang.c (classify_type): Iterate over typedefs. * c-valprint.c (textual_element_type): Iterate over typedefs. gdb/testsuite * gdb.base/charset.exp (test_combination): Regression test. * gdb.base/charset.c (my_wchar_t): New typedef. (myvar): New global. (main): Set myvar.
This commit is contained in:
27
gdb/c-lang.c
27
gdb/c-lang.c
@@ -77,9 +77,12 @@ classify_type (struct type *elttype, const char **encoding)
|
||||
struct type *saved_type;
|
||||
enum c_string_type result;
|
||||
|
||||
/* We do one or two passes -- one on ELTTYPE, and then maybe a
|
||||
second one on a typedef target. */
|
||||
do
|
||||
/* We loop because ELTTYPE may be a typedef, and we want to
|
||||
successively peel each typedef until we reach a type we
|
||||
understand. We don't use CHECK_TYPEDEF because that will strip
|
||||
all typedefs at once -- but in C, wchar_t is itself a typedef, so
|
||||
that would do the wrong thing. */
|
||||
while (elttype)
|
||||
{
|
||||
char *name = TYPE_NAME (elttype);
|
||||
|
||||
@@ -107,10 +110,22 @@ classify_type (struct type *elttype, const char **encoding)
|
||||
goto done;
|
||||
}
|
||||
|
||||
saved_type = elttype;
|
||||
CHECK_TYPEDEF (elttype);
|
||||
if (TYPE_CODE (elttype) != TYPE_CODE_TYPEDEF)
|
||||
break;
|
||||
|
||||
/* Call for side effects. */
|
||||
check_typedef (elttype);
|
||||
|
||||
if (TYPE_TARGET_TYPE (elttype))
|
||||
elttype = TYPE_TARGET_TYPE (elttype);
|
||||
else
|
||||
{
|
||||
/* Perhaps check_typedef did not update the target type. In
|
||||
this case, force the lookup again and hope it works out.
|
||||
It never will for C, but it might for C++. */
|
||||
CHECK_TYPEDEF (elttype);
|
||||
}
|
||||
}
|
||||
while (elttype != saved_type);
|
||||
|
||||
/* Punt. */
|
||||
result = C_CHAR;
|
||||
|
||||
Reference in New Issue
Block a user