* value.c (coerce_array): Use check_typedef.
gdb/testsuite
* gdb.base/pointers.exp: Add test.
* gdb.base/pointers.c (k, S): New typedefs.
(instance): New global.
+2008-10-02 Tom Tromey <tromey@redhat.com>
+
+ * value.c (coerce_array): Use check_typedef.
+
2008-10-28 Tom Tromey <tromey@redhat.com>
* cli/cli-logging.c (handle_redirections): Make a cleanup.
+2008-10-30 Tom Tromey <tromey@redhat.com>
+
+ * gdb.base/pointers.exp: Add test.
+ * gdb.base/pointers.c (k, S): New typedefs.
+ (instance): New global.
+
2008-10-30 Andreas Schwab <schwab@suse.de>
* gdb.base/args.exp: Add tests for newlines.
int y;
+
+typedef long k[5];
+
+typedef struct {
+ k array_variable;
+} S;
+
+S instance;
+
/* Do nothing function used for forcing some of the above variables to
be referenced by the program source. If the variables are not
referenced, some linkers will remove the symbol from the symbol
timeout { fail "(timeout) ptype ppppppC" }
}
+# Regression test for a crash.
+
+gdb_test "p instance.array_variable + 0" \
+ " = \\(long int \\*\\) 0x\[0-9a-f\]*"
struct value *
coerce_array (struct value *arg)
{
+ struct type *type;
+
arg = coerce_ref (arg);
- if (current_language->c_style_arrays
- && TYPE_CODE (value_type (arg)) == TYPE_CODE_ARRAY)
- arg = value_coerce_array (arg);
- if (TYPE_CODE (value_type (arg)) == TYPE_CODE_FUNC)
- arg = value_coerce_function (arg);
+ type = check_typedef (value_type (arg));
+
+ switch (TYPE_CODE (type))
+ {
+ case TYPE_CODE_ARRAY:
+ if (current_language->c_style_arrays)
+ arg = value_coerce_array (arg);
+ break;
+ case TYPE_CODE_FUNC:
+ arg = value_coerce_function (arg);
+ break;
+ }
return arg;
}
\f