summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2007-01-05 05:49:56 +0000
committerJoel Brobecker <brobecker@gnat.com>2007-01-05 05:49:56 +0000
commit3878530995e4049f2b30cc35190c9d016d245759 (patch)
tree2015036ef9e9e5fec3c3b87b8731ade9a26ff37d /gdb
parent2d4764e9cf2be891708d091c89124c33836584ae (diff)
downloadgdb-3878530995e4049f2b30cc35190c9d016d245759.tar.gz
* dwarf2read.c (partial_die_info): Add field has_byte_size.
(add_partial_symbol): Correct identification of external references. (process_structure_scope): Likewise. (read_partial_die): Handle DW_AT_byte_size attribute.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/dwarf2read.c26
2 files changed, 28 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fcbfabc2b53..2470adbc402 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,11 @@
-2007-01-04 Daniel Jacobowitz <dan@codesourcery.com>
+2006-02-05 Joel Brobecker <brobecker@adacore.com>
+
+ * dwarf2read.c (partial_die_info): Add field has_byte_size.
+ (add_partial_symbol): Correct identification of external references.
+ (process_structure_scope): Likewise.
+ (read_partial_die): Handle DW_AT_byte_size attribute.
+
+2007-01-05 Daniel Jacobowitz <dan@codesourcery.com>
* xml-support.c (gdb_xml_end_element): Remove wrong backslashes.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 9059189ba62..d917e295eb7 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1,7 +1,7 @@
/* DWARF 2 debugging format support for GDB.
Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006
+ 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
@@ -467,6 +467,9 @@ struct partial_die_info
computed. */
unsigned int scope_set : 1;
+ /* Flag set if the DIE has a byte_size attribute. */
+ unsigned int has_byte_size : 1;
+
/* The name of this DIE. Normally the value of DW_AT_name, but
sometimes DW_TAG_MIPS_linkage_name or a string computed in some
other fashion. */
@@ -1979,12 +1982,16 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
case DW_TAG_structure_type:
case DW_TAG_union_type:
case DW_TAG_enumeration_type:
- /* Skip aggregate types without children, these are external
- references. */
+ /* Skip external references. The DWARF standard says in the section
+ about "Structure, Union, and Class Type Entries": "An incomplete
+ structure, union or class type is represented by a structure,
+ union or class entry that does not have a byte size attribute
+ and that has a DW_AT_declaration attribute." */
+ if (!pdi->has_byte_size && pdi->is_declaration)
+ return;
+
/* NOTE: carlton/2003-10-07: See comment in new_symbol about
static vs. global. */
- if (pdi->has_children == 0)
- return;
add_psymbol_to_list (actual_name, strlen (actual_name),
STRUCT_DOMAIN, LOC_TYPEDEF,
(cu->language == language_cplus
@@ -4010,7 +4017,11 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
child_die = sibling_die (child_die);
}
- if (die->child != NULL && ! die_is_declaration (die, cu))
+ /* Do not consider external references. According to the DWARF standard,
+ these DIEs are identified by the fact that they have no byte_size
+ attribute, and a declaration attribute. */
+ if (dwarf2_attr (die, DW_AT_byte_size, cu) != NULL
+ || !die_is_declaration (die, cu))
new_symbol (die, die->type, cu);
processing_current_prefix = previous_prefix;
@@ -5575,6 +5586,9 @@ read_partial_die (struct partial_die_info *part_die,
part_die->has_stmt_list = 1;
part_die->line_offset = DW_UNSND (&attr);
break;
+ case DW_AT_byte_size:
+ part_die->has_byte_size = 1;
+ break;
default:
break;
}