From 8a4ca176c977982bf74c885ec927ed3d6c677bde Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 20 Mar 2009 22:00:05 +0000 Subject: [PATCH] 2009-03-20 Tom Tromey Jan Kratochvil * dwarf2read.c (process_die): Handle DW_TAG_typedef. * eval.c (evaluate_subexp_standard) : Strip a single typedef. * ada-lang.c (decode_packed_array_type): Call CHECK_TYPEDEF on the SYMBOL_TYPE result. * ada-typeprint.c (print_array_type): Do the NULL check unconditionally. --- gdb/ChangeLog | 11 +++++++++++ gdb/ada-lang.c | 1 + gdb/ada-typeprint.c | 11 ++++++----- gdb/dwarf2read.c | 1 + gdb/eval.c | 12 +++++++++++- 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 107396ea20..9d5e5f4085 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2009-03-20 Tom Tromey + Jan Kratochvil + + * dwarf2read.c (process_die): Handle DW_TAG_typedef. + * eval.c (evaluate_subexp_standard) : Strip a single + typedef. + * ada-lang.c (decode_packed_array_type): Call CHECK_TYPEDEF on the + SYMBOL_TYPE result. + * ada-typeprint.c (print_array_type): Do the NULL check + unconditionally. + 2009-03-19 Tom Tromey * utils.c (do_obstack_free): New function. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index b95a3031e1..e4fdd24b10 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -1783,6 +1783,7 @@ decode_packed_array_type (struct type *type) return NULL; } shadow_type = SYMBOL_TYPE (sym); + CHECK_TYPEDEF (shadow_type); if (TYPE_CODE (shadow_type) != TYPE_CODE_ARRAY) { diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c index f00824ab9a..ef665c4a0c 100644 --- a/gdb/ada-typeprint.c +++ b/gdb/ada-typeprint.c @@ -357,16 +357,17 @@ print_array_type (struct type *type, struct ui_file *stream, int show, bitsize = 0; fprintf_filtered (stream, "array ("); + if (type == NULL) + { + fprintf_filtered (stream, _("")); + return; + } + n_indices = -1; if (show < 0) fprintf_filtered (stream, "..."); else { - if (type == NULL) - { - fprintf_filtered (stream, _("")); - return; - } if (ada_is_simple_array_type (type)) { struct type *range_desc_type = diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index feb57b0b94..cf8f45827b 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -2849,6 +2849,7 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) case DW_TAG_base_type: case DW_TAG_subrange_type: + case DW_TAG_typedef: /* Add a typedef symbol for the type definition, if it has a DW_AT_name. */ new_symbol (die, read_type_die (die, cu), cu); diff --git a/gdb/eval.c b/gdb/eval.c index 1d3557135c..cc92ebef3c 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -2475,7 +2475,17 @@ evaluate_subexp_standard (struct type *expect_type, if (noside == EVAL_SKIP) goto nosideret; else if (noside == EVAL_AVOID_SIDE_EFFECTS) - return allocate_value (exp->elts[pc + 1].type); + { + struct type *type = exp->elts[pc + 1].type; + /* If this is a typedef, then find its immediate target. We + use check_typedef to resolve stubs, but we ignore its + result because we do not want to dig past all + typedefs. */ + check_typedef (type); + if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) + type = TYPE_TARGET_TYPE (type); + return allocate_value (type); + } else error (_("Attempt to use a type name as an expression")); -- 2.11.0