aboutsummaryrefslogtreecommitdiff
path: root/bfd/coffgen.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1993-02-23 06:50:49 +0000
committerPer Bothner <per@bothner.com>1993-02-23 06:50:49 +0000
commit85fe7cfff3a867f32fb6a178994e11637d1f77c6 (patch)
treef145c368fd0ba83b7221846aa45462c383a7dbee /bfd/coffgen.c
parentc2a0f1cb8ee2a29429b51b286afafdedbccdbbd3 (diff)
downloadgdb-85fe7cfff3a867f32fb6a178994e11637d1f77c6.zip
gdb-85fe7cfff3a867f32fb6a178994e11637d1f77c6.tar.gz
gdb-85fe7cfff3a867f32fb6a178994e11637d1f77c6.tar.bz2
* libcoff.h (obj_raw_syment_coun): New macro.
* coffgen.c (coff_get_normalized_symtab): Initialize raw_syment_count. * coffgen.c (coff_find_nearest_line): Numerous little fixes.
Diffstat (limited to 'bfd/coffgen.c')
-rw-r--r--bfd/coffgen.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 21f023e..5c4b9d4 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -1,5 +1,5 @@
/* Support for the generic parts of COFF, for BFD.
- Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -1125,7 +1125,7 @@ bfd *abfd)
internal_ptr->fix_tag = 0;
internal_ptr->fix_end = 0;
symbol_ptr = internal_ptr;
-
+
for (i = 0;
i < symbol_ptr->u.syment.n_numaux;
i++)
@@ -1223,6 +1223,7 @@ bfd *abfd)
}
obj_raw_syments(abfd) = internal;
+ obj_raw_syment_count(abfd) = internal_ptr - internal;
return (internal);
} /* coff_get_normalized_symtab() */
@@ -1403,14 +1404,14 @@ DEFUN(coff_find_nearest_line,(abfd,
static asection *cache_section;
static bfd_vma cache_offset;
static unsigned int cache_i;
- static alent *cache_l;
+ static CONST char *cache_function;
+ static unsigned int line_base = 0;
unsigned int i = 0;
coff_data_type *cof = coff_data(abfd);
/* Run through the raw syments if available */
combined_entry_type *p;
alent *l;
- unsigned int line_base = 0;
*filename_ptr = 0;
@@ -1444,17 +1445,19 @@ DEFUN(coff_find_nearest_line,(abfd,
section == cache_section &&
offset >= cache_offset) {
i = cache_i;
- l = cache_l;
+ *functionname_ptr = cache_function;
}
else {
i = 0;
- l = section->lineno;
}
+ l = &section->lineno[i];
for (; i < section->lineno_count; i++) {
if (l->line_number == 0) {
/* Get the symbol this line number points at */
coff_symbol_type *coff = (coff_symbol_type *) (l->u.sym);
+ if (coff->symbol.value > offset)
+ break;
*functionname_ptr = coff->symbol.name;
if (coff->native) {
combined_entry_type *s = coff->native;
@@ -1468,13 +1471,14 @@ DEFUN(coff_find_nearest_line,(abfd,
*/
union internal_auxent *a = &((s + 1)->u.auxent);
line_base = a->x_sym.x_misc.x_lnsz.x_lnno;
+ *line_ptr = line_base;
}
}
}
else {
if (l->u.offset > offset)
break;
- *line_ptr = l->line_number + line_base + 1;
+ *line_ptr = l->line_number + line_base - 1;
}
l++;
}
@@ -1483,7 +1487,7 @@ DEFUN(coff_find_nearest_line,(abfd,
cache_section = section;
cache_offset = offset;
cache_i = i;
- cache_l = l;
+ cache_function = *functionname_ptr;
return true;
}