This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Interpret DW_TAG_unspecified_type as void
- From: Julian Brown <julian at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Daniel Jacobowitz <dan at codesourcery dot com>, Julian Brown <julian at codesourcery dot com>
- Date: Fri, 09 Jun 2006 13:29:38 +0100
- Subject: [PATCH] Interpret DW_TAG_unspecified_type as void
Hi,
This is part of a series of patches from a CodeSourcery branch which
enable the output of ARM's RVCT 2.2 compiler to be debugged with gdb.
This patch handles the C/C++ interpretation of the DWARF 3 construct
DW_TAG_unspecified_type as void. This is used in representing e.g.
pointer-to-void types. Other languages will currently be handled in
exactly the same way; though I'm not entirely sure if that's a sensible
default, I don't know what would be better. (Re: section 5.2 of the
DWARF 3 doc.)
Tested natively on x86_64-unknown-linux-gnu and cross to arm-none-eabi
with no change in results. Tests against the ARM compiler are improved
somewhat.
OK to apply?
Cheers,
Julian
ChangeLog (Daniel Jacobowitz):
* dwarf2read.c (read_unspecified_type): New function.
(read_type_die): Handle DW_TAG_unspecified_type.
Index: src/gdb/dwarf2read.c
===================================================================
--- src.orig/gdb/dwarf2read.c 2005-03-07 06:00:16.000000000 -0800
+++ src/gdb/dwarf2read.c 2005-03-07 07:27:38.000000000 -0800
@@ -4992,6 +4992,23 @@ read_subrange_type (struct die_info *die
set_die_type (die, range_type, cu);
}
+static void
+read_unspecified_type (struct die_info *die, struct dwarf2_cu *cu)
+{
+ struct type *type;
+ struct attribute *attr;
+
+ if (die->type)
+ return;
+
+ /* For now, we only support the C meaning of an unspecified type: void. */
+
+ attr = dwarf2_attr (die, DW_AT_name, cu);
+ type = init_type (TYPE_CODE_VOID, 0, 0, attr ? DW_STRING (attr) : "",
+ cu->objfile);
+
+ set_die_type (die, type, cu);
+}
/* Read a whole compilation unit into a linked list of dies. */
@@ -7526,6 +7543,9 @@ read_type_die (struct die_info *die, str
case DW_TAG_base_type:
read_base_type (die, cu);
break;
+ case DW_TAG_unspecified_type:
+ read_unspecified_type (die, cu);
+ break;
default:
complaint (&symfile_complaints, _("unexepected tag in read_type_die: '%s'"),
dwarf_tag_name (die->tag));