aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2002-08-22 05:50:11 +0000
committerJim Blandy <jimb@codesourcery.com>2002-08-22 05:50:11 +0000
commitebeb39fe31c44ff9f7d09d50b4327bb9f5119b36 (patch)
tree2d6458e63a5995cfd10cc62a77de3df557bffc7d
parent56780f18c55aca9a12766df181b4c060d8079d4e (diff)
downloadgdb-ebeb39fe31c44ff9f7d09d50b4327bb9f5119b36.zip
gdb-ebeb39fe31c44ff9f7d09d50b4327bb9f5119b36.tar.gz
gdb-ebeb39fe31c44ff9f7d09d50b4327bb9f5119b36.tar.bz2
* coffread.c (coff_symfile_read): Don't try to read the line
number table from disk if the image file doesn't have a symbol table; we'll never actually look at the info anyway, and Windows ships DLL's with bogus file offsets for the line number data.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/coffread.c32
2 files changed, 32 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c010aeb..4a7c0fe 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2002-08-22 Jim Blandy <jimb@redhat.com>
+
+ * coffread.c (coff_symfile_read): Don't try to read the line
+ number table from disk if the image file doesn't have a symbol
+ table; we'll never actually look at the info anyway, and Windows
+ ships DLL's with bogus file offsets for the line number data.
+
2002-08-21 Elena Zannoni <ezannoni@redhat.com>
* rs6000-tdep.c (rs6000_gdbarch_init): Figure out whether we have
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 52b36c8..d794a7d 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -593,16 +593,34 @@ coff_symfile_read (struct objfile *objfile, int mainline)
/* End of warning */
- /* Read the line number table, all at once. */
info->min_lineno_offset = 0;
info->max_lineno_offset = 0;
- bfd_map_over_sections (abfd, find_linenos, (void *) info);
- make_cleanup (free_linetab_cleanup, 0 /*ignore*/);
- val = init_lineno (abfd, info->min_lineno_offset,
- info->max_lineno_offset - info->min_lineno_offset);
- if (val < 0)
- error ("\"%s\": error reading line numbers\n", name);
+ /* Only read line number information if we have symbols.
+
+ On Windows NT, some of the system's DLL's have sections with
+ PointerToLinenumbers fields that are non-zero, but point at
+ random places within the image file. (In the case I found,
+ KERNEL32.DLL's .text section has a line number info pointer that
+ points into the middle of the string `lib\\i386\kernel32.dll'.)
+
+ However, these DLL's also have no symbols. The line number
+ tables are meaningless without symbols. And in fact, GDB never
+ uses the line number information unless there are symbols. So we
+ can avoid spurious error messages (and maybe run a little
+ faster!) by not even reading the line number table unless we have
+ symbols. */
+ if (num_symbols > 0)
+ {
+ /* Read the line number table, all at once. */
+ bfd_map_over_sections (abfd, find_linenos, (void *) info);
+
+ make_cleanup (free_linetab_cleanup, 0 /*ignore*/);
+ val = init_lineno (abfd, info->min_lineno_offset,
+ info->max_lineno_offset - info->min_lineno_offset);
+ if (val < 0)
+ error ("\"%s\": error reading line numbers\n", name);
+ }
/* Now read the string table, all at once. */