aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2008-08-20 19:39:11 +0000
committerDaniel Jacobowitz <drow@false.org>2008-08-20 19:39:11 +0000
commit7475d072247b7e9f66a7d60a032bf5b648d22e51 (patch)
tree9f9b3afde0ba643c0771aa0937d5ee97db0f01e3
parent1d325ec1dc714a85e00d249f2e3ddc1bcd4456bf (diff)
downloadgdb-7475d072247b7e9f66a7d60a032bf5b648d22e51.zip
gdb-7475d072247b7e9f66a7d60a032bf5b648d22e51.tar.gz
gdb-7475d072247b7e9f66a7d60a032bf5b648d22e51.tar.bz2
* dwarf2read.c (free_die_list, copy_die): Delete.
(dwarf_alloc_die): Take a CU argument. Allocate the new DIE on the obstack. (read_full_die): Update call to dwarf_alloc_die. Allocate attributes on the CU obstack. (free_one_comp_unit): Do not call free_die_list.
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/dwarf2read.c69
2 files changed, 16 insertions, 62 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 064e4c2..412d84a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
2008-08-20 Daniel Jacobowitz <dan@codesourcery.com>
+ * dwarf2read.c (free_die_list, copy_die): Delete.
+ (dwarf_alloc_die): Take a CU argument. Allocate the new DIE
+ on the obstack.
+ (read_full_die): Update call to dwarf_alloc_die. Allocate
+ attributes on the CU obstack.
+ (free_one_comp_unit): Do not call free_die_list.
+
+2008-08-20 Daniel Jacobowitz <dan@codesourcery.com>
+
* dwarf2read.c (read_die_and_children): Ignore NULL DIEs.
(read_die_and_siblings): Likewise. Do not add padding DIEs to the
sibling list.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index eea357a..111b948 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -954,8 +954,6 @@ static struct die_info *read_die_and_siblings (gdb_byte *info_ptr, bfd *abfd,
gdb_byte **new_info_ptr,
struct die_info *parent);
-static void free_die_list (struct die_info *);
-
static void process_die (struct die_info *, struct dwarf2_cu *);
static char *dwarf2_linkage_name (struct die_info *, struct dwarf2_cu *);
@@ -979,8 +977,6 @@ static char *dwarf_type_encoding_name (unsigned int);
#if 0
static char *dwarf_cfi_name (unsigned int);
-
-struct die_info *copy_die (struct die_info *);
#endif
static struct die_info *sibling_die (struct die_info *);
@@ -1007,7 +1003,7 @@ static struct dwarf_block *dwarf_alloc_block (struct dwarf2_cu *);
static struct abbrev_info *dwarf_alloc_abbrev (struct dwarf2_cu *);
-static struct die_info *dwarf_alloc_die (void);
+static struct die_info *dwarf_alloc_die (struct dwarf2_cu *);
static void initialize_cu_func_list (struct dwarf2_cu *);
@@ -5200,25 +5196,6 @@ read_die_and_siblings (gdb_byte *info_ptr, bfd *abfd,
}
}
-/* Free a linked list of dies. */
-
-static void
-free_die_list (struct die_info *dies)
-{
- struct die_info *die, *next;
-
- die = dies;
- while (die)
- {
- if (die->child != NULL)
- free_die_list (die->child);
- next = die->sibling;
- xfree (die->attrs);
- xfree (die);
- die = next;
- }
-}
-
/* Decompress a section that was compressed using zlib. Store the
decompressed buffer, and its size, in OUTBUF and OUTSIZE. */
@@ -6059,14 +6036,15 @@ read_full_die (struct die_info **diep, bfd *abfd, gdb_byte *info_ptr,
abbrev_number,
bfd_get_filename (abfd));
}
- die = dwarf_alloc_die ();
+ die = dwarf_alloc_die (cu);
die->offset = offset;
die->tag = abbrev->tag;
die->abbrev = abbrev_number;
die->num_attrs = abbrev->num_attrs;
die->attrs = (struct attribute *)
- xmalloc (die->num_attrs * sizeof (struct attribute));
+ obstack_alloc (&cu->comp_unit_obstack,
+ die->num_attrs * sizeof (struct attribute));
for (i = 0; i < abbrev->num_attrs; ++i)
{
@@ -8019,38 +7997,6 @@ typename_concat (struct obstack *obs, const char *prefix, const char *suffix,
}
}
-#if 0
-struct die_info *
-copy_die (struct die_info *old_die)
-{
- struct die_info *new_die;
- int i, num_attrs;
-
- new_die = (struct die_info *) xmalloc (sizeof (struct die_info));
- memset (new_die, 0, sizeof (struct die_info));
-
- new_die->tag = old_die->tag;
- new_die->has_children = old_die->has_children;
- new_die->abbrev = old_die->abbrev;
- new_die->offset = old_die->offset;
-
- num_attrs = old_die->num_attrs;
- new_die->num_attrs = num_attrs;
- new_die->attrs = (struct attribute *)
- xmalloc (num_attrs * sizeof (struct attribute));
-
- for (i = 0; i < old_die->num_attrs; ++i)
- {
- new_die->attrs[i].name = old_die->attrs[i].name;
- new_die->attrs[i].form = old_die->attrs[i].form;
- new_die->attrs[i].u.addr = old_die->attrs[i].u.addr;
- }
-
- new_die->next = NULL;
- return new_die;
-}
-#endif
-
/* Return sibling of die, NULL if no sibling. */
static struct die_info *
@@ -9488,11 +9434,12 @@ dwarf_alloc_abbrev (struct dwarf2_cu *cu)
}
static struct die_info *
-dwarf_alloc_die (void)
+dwarf_alloc_die (struct dwarf2_cu *cu)
{
struct die_info *die;
- die = (struct die_info *) xmalloc (sizeof (struct die_info));
+ die = (struct die_info *)
+ obstack_alloc (&cu->comp_unit_obstack, sizeof (struct die_info));
memset (die, 0, sizeof (struct die_info));
return (die);
}
@@ -10117,8 +10064,6 @@ free_one_comp_unit (void *data)
cu->per_cu = NULL;
obstack_free (&cu->comp_unit_obstack, NULL);
- if (cu->dies)
- free_die_list (cu->dies);
xfree (cu);
}