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:
Tom Tromey
2009-06-23 16:26:05 +00:00
parent 3188b0706d
commit 85e306ed0e
6 changed files with 68 additions and 12 deletions

View File

@@ -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;