aboutsummaryrefslogtreecommitdiff
path: root/bfd/coffcode.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-11-12 14:51:38 +1030
committerAlan Modra <amodra@gmail.com>2014-11-12 15:15:03 +1030
commit6bb3e67958b0ee59f1b69619761e6d5ad1f7544b (patch)
tree05825e6ff2d336ad960869b838ba9fab3f56b57f /bfd/coffcode.h
parentabd58633c1985c879a84249650172da639773730 (diff)
downloadgdb-6bb3e67958b0ee59f1b69619761e6d5ad1f7544b.zip
gdb-6bb3e67958b0ee59f1b69619761e6d5ad1f7544b.tar.gz
gdb-6bb3e67958b0ee59f1b69619761e6d5ad1f7544b.tar.bz2
Throw away dodgy coff line number info earlier
PR 17521 * coffcode.h (coff_slurp_line_table): Drop line number info not preceded by a valid function entry. Revert last change.
Diffstat (limited to 'bfd/coffcode.h')
-rw-r--r--bfd/coffcode.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 4bc80bd..acc7360 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -4513,6 +4513,7 @@ coff_slurp_line_table (bfd *abfd, asection *asect)
int ordered = 1;
unsigned int nbr_func;
LINENO *src;
+ bfd_boolean have_func;
BFD_ASSERT (asect->lineno == NULL);
@@ -4535,6 +4536,7 @@ coff_slurp_line_table (bfd *abfd, asection *asect)
asect->lineno = lineno_cache;
src = native_lineno;
nbr_func = 0;
+ have_func = FALSE;
for (counter = 0; counter < asect->lineno_count; counter++, src++)
{
@@ -4552,6 +4554,7 @@ coff_slurp_line_table (bfd *abfd, asection *asect)
bfd_vma symndx;
coff_symbol_type *sym;
+ have_func = FALSE;
symndx = dst.l_addr.l_symndx;
if (symndx >= obj_raw_syment_count (abfd))
{
@@ -4577,6 +4580,7 @@ coff_slurp_line_table (bfd *abfd, asection *asect)
continue;
}
+ have_func = TRUE;
nbr_func++;
cache_ptr->u.sym = (asymbol *) sym;
if (sym->lineno != NULL)
@@ -4589,6 +4593,10 @@ coff_slurp_line_table (bfd *abfd, asection *asect)
ordered = 0;
prev_offset = sym->symbol.value;
}
+ else if (!have_func)
+ /* Drop line information that has no associated function.
+ PR 17521: file: 078-10659-0.004. */
+ continue;
else
cache_ptr->u.offset = (dst.l_addr.l_paddr
- bfd_section_vma (abfd, asect));
@@ -4642,15 +4650,7 @@ coff_slurp_line_table (bfd *abfd, asection *asect)
*n_cache_ptr++ = *old_ptr++;
while (old_ptr->line_number != 0);
}
- /* PR 17521: file: 078-10659-0.004. */
- if (n_cache_ptr < n_lineno_cache + asect->lineno_count)
- {
- amt = n_cache_ptr - n_lineno_cache;
- memcpy (lineno_cache, n_lineno_cache, amt * sizeof (alent));
- memset (lineno_cache + amt, 0, (asect->lineno_count - amt) * sizeof (alent));
- }
- else
- memcpy (lineno_cache, n_lineno_cache, amt);
+ memcpy (lineno_cache, n_lineno_cache, amt);
}
bfd_release (abfd, func_table);
}