aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2008-02-16 10:51:38 +0000
committerNathan Sidwell <nathan@codesourcery.com>2008-02-16 10:51:38 +0000
commitd74e4b29eb05f085026bd9eb93f1aa6e70bc5b1b (patch)
tree38a4d4be8330524f95def4fb2fa435c49cdf39a5 /bfd
parent819da74e19e58ccb6cf378100a3023b9f2532c40 (diff)
downloadfsf-binutils-gdb-d74e4b29eb05f085026bd9eb93f1aa6e70bc5b1b.zip
fsf-binutils-gdb-d74e4b29eb05f085026bd9eb93f1aa6e70bc5b1b.tar.gz
fsf-binutils-gdb-d74e4b29eb05f085026bd9eb93f1aa6e70bc5b1b.tar.bz2
* dwarf2.c (find_line): Don't trust debug information after an
unparseable compilation unit.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/dwarf2.c69
2 files changed, 40 insertions, 34 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c502bba..bb2ace6 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2008-02-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ * dwarf2.c (find_line): Don't trust debug information after an
+ unparseable compilation unit.
+
2008-02-15 Alan Modra <amodra@bigpond.net.au>
PR 5765
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index ce45995..d0b50ff 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -3068,6 +3068,10 @@ find_line (bfd *abfd,
{
each = parse_comp_unit (stash, length, info_ptr_unit,
offset_size);
+ if (!each)
+ /* The dwarf information is damaged, don't trust it any
+ more. */
+ break;
stash->info_ptr += length;
if ((bfd_vma) (stash->info_ptr - stash->sec_info_ptr)
@@ -3077,40 +3081,37 @@ find_line (bfd *abfd,
stash->sec_info_ptr = stash->info_ptr;
}
- if (each)
- {
- if (stash->all_comp_units)
- stash->all_comp_units->prev_unit = each;
- else
- stash->last_comp_unit = each;
-
- each->next_unit = stash->all_comp_units;
- stash->all_comp_units = each;
-
- /* DW_AT_low_pc and DW_AT_high_pc are optional for
- compilation units. If we don't have them (i.e.,
- unit->high == 0), we need to consult the line info
- table to see if a compilation unit contains the given
- address. */
- if (do_line)
- found = (((symbol->flags & BSF_FUNCTION) == 0
- || each->arange.high == 0
- || comp_unit_contains_address (each, addr))
- && comp_unit_find_line (each, symbol, addr,
- filename_ptr,
- linenumber_ptr,
- stash));
- else
- found = ((each->arange.high == 0
- || comp_unit_contains_address (each, addr))
- && comp_unit_find_nearest_line (each, addr,
- filename_ptr,
- functionname_ptr,
- linenumber_ptr,
- stash));
- if (found)
- goto done;
- }
+ if (stash->all_comp_units)
+ stash->all_comp_units->prev_unit = each;
+ else
+ stash->last_comp_unit = each;
+
+ each->next_unit = stash->all_comp_units;
+ stash->all_comp_units = each;
+
+ /* DW_AT_low_pc and DW_AT_high_pc are optional for
+ compilation units. If we don't have them (i.e.,
+ unit->high == 0), we need to consult the line info table
+ to see if a compilation unit contains the given
+ address. */
+ if (do_line)
+ found = (((symbol->flags & BSF_FUNCTION) == 0
+ || each->arange.high == 0
+ || comp_unit_contains_address (each, addr))
+ && comp_unit_find_line (each, symbol, addr,
+ filename_ptr,
+ linenumber_ptr,
+ stash));
+ else
+ found = ((each->arange.high == 0
+ || comp_unit_contains_address (each, addr))
+ && comp_unit_find_nearest_line (each, addr,
+ filename_ptr,
+ functionname_ptr,
+ linenumber_ptr,
+ stash));
+ if (found)
+ goto done;
}
}