aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2-frame.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2010-03-10 18:37:24 +0000
committerTom Tromey <tromey@redhat.com>2010-03-10 18:37:24 +0000
commitbe391dcafc991c4761cb8447f629263decfd55b4 (patch)
tree5ac541a19f7e6972848357035a4840651d6155ce /gdb/dwarf2-frame.c
parente38df1d074456c912b31d672bde73afcea5b5c92 (diff)
downloadbinutils-be391dcafc991c4761cb8447f629263decfd55b4.zip
binutils-be391dcafc991c4761cb8447f629263decfd55b4.tar.gz
binutils-be391dcafc991c4761cb8447f629263decfd55b4.tar.bz2
* elfread.c (elf_symfile_read): Don't call
dwarf2_build_frame_info. * dwarf2read.c (struct dwarf2_section_info) <readin>: New field. (struct dwarf2_per_objfile) <objfile>: New field. (dwarf2_has_info): Now idempotent. Set objfile field. (dwarf2_read_section): Check and set readin field. Call posix_madvise. (dwarf2_build_psymtabs): Don't read all sections. (read_type_comp_unit_head): Read types section. (create_debug_types_hash_table): Likewise. (init_cu_die_reader): Add asserts. (process_type_comp_unit): Add assert. (dwarf2_build_psymtabs_hard): Read info section. (load_partial_comp_unit): Add assert. (create_all_comp_units): Read info section. (load_full_comp_unit): Likewise. (dwarf2_ranges_read): Read ranges section. (dwarf2_record_block_ranges): Add assert. (dwarf2_read_abbrevs): Read abbrev section. (read_indirect_string): Read str section. (dwarf_decode_line_header): Read line section. (read_signatured_type_at_offset): Read types section. (dwarf_decode_macros): Read macinfo section. (dwarf2_symbol_mark_computed): Read loc section. * dwarf2-frame.c (dwarf2_frame_find_fde): Call dwarf2_build_frame_info. (dwarf2_build_frame_info): Unconditionally set dwarf2_frame_objfile_data on the objfile. * configure.ac: Check for posix_madvise. * config.in, configure: Rebuild.
Diffstat (limited to 'gdb/dwarf2-frame.c')
-rw-r--r--gdb/dwarf2-frame.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 99100d7..7323ca4 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -1584,6 +1584,13 @@ dwarf2_frame_find_fde (CORE_ADDR *pc)
fde_table = objfile_data (objfile, dwarf2_frame_objfile_data);
if (fde_table == NULL)
+ {
+ dwarf2_build_frame_info (objfile);
+ fde_table = objfile_data (objfile, dwarf2_frame_objfile_data);
+ }
+ gdb_assert (fde_table != NULL);
+
+ if (fde_table->num_entries == 0)
continue;
gdb_assert (objfile->section_offsets);
@@ -2027,6 +2034,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
gdb_byte *frame_ptr;
struct dwarf2_cie_table cie_table;
struct dwarf2_fde_table fde_table;
+ struct dwarf2_fde_table *fde_table2;
cie_table.num_entries = 0;
cie_table.entries = NULL;
@@ -2098,9 +2106,17 @@ dwarf2_build_frame_info (struct objfile *objfile)
cie_table.num_entries = 0; /* Paranoia. */
}
- if (fde_table.num_entries != 0)
+ /* Copy fde_table to obstack: it is needed at runtime. */
+ fde_table2 = (struct dwarf2_fde_table *)
+ obstack_alloc (&objfile->objfile_obstack, sizeof (*fde_table2));
+
+ if (fde_table.num_entries == 0)
+ {
+ fde_table2->entries = NULL;
+ fde_table2->num_entries = 0;
+ }
+ else
{
- struct dwarf2_fde_table *fde_table2;
struct dwarf2_fde *fde_prev = NULL;
struct dwarf2_fde *first_non_zero_fde = NULL;
int i;
@@ -2109,11 +2125,6 @@ dwarf2_build_frame_info (struct objfile *objfile)
qsort (fde_table.entries, fde_table.num_entries,
sizeof (fde_table.entries[0]), qsort_fde_cmp);
- /* Copy fde_table to obstack: it is needed at runtime. */
- fde_table2 = (struct dwarf2_fde_table *)
- obstack_alloc (&objfile->objfile_obstack, sizeof (*fde_table2));
- fde_table2->num_entries = 0;
-
/* Check for leftovers from --gc-sections. The GNU linker sets
the relevant symbols to zero, but doesn't zero the FDE *end*
ranges because there's no relocation there. It's (offset,
@@ -2140,6 +2151,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
/* Since we'll be doing bsearch, squeeze out identical (except
for eh_frame_p) fde entries so bsearch result is predictable.
Also discard leftovers from --gc-sections. */
+ fde_table2->num_entries = 0;
for (i = 0; i < fde_table.num_entries; i++)
{
struct dwarf2_fde *fde = fde_table.entries[i];
@@ -2160,11 +2172,12 @@ dwarf2_build_frame_info (struct objfile *objfile)
fde_prev = fde;
}
fde_table2->entries = obstack_finish (&objfile->objfile_obstack);
- set_objfile_data (objfile, dwarf2_frame_objfile_data, fde_table2);
/* Discard the original fde_table. */
xfree (fde_table.entries);
}
+
+ set_objfile_data (objfile, dwarf2_frame_objfile_data, fde_table2);
}
/* Provide a prototype to silence -Wmissing-prototypes. */