From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7715 invoked by alias); 22 Aug 2002 05:52:47 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 7706 invoked from network); 22 Aug 2002 05:52:45 -0000 Received: from unknown (HELO zenia.red-bean.com) (66.244.67.22) by sources.redhat.com with SMTP; 22 Aug 2002 05:52:45 -0000 Received: (from jimb@localhost) by zenia.red-bean.com (8.11.6/8.11.6) id g7M5g2t20902; Thu, 22 Aug 2002 00:42:02 -0500 To: gdb-patches@sources.redhat.com Subject: Re: RFA: don't read coff line number unless we have symbols too References: <200206260803.g5Q83f028100@mail.macqel.be> From: Jim Blandy Date: Wed, 21 Aug 2002 22:52:00 -0000 In-Reply-To: Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.90 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-08/txt/msg00682.txt.bz2 Joel Brobecker has said in private E-mail that his earlier concerns have been addressed, so I've committed this change. Jim Blandy writes: > "Philippe De Muyter" writes: > > Should the following lines not be kept outside of the conditional block ? > > > > info->min_lineno_offset = 0; > > info->max_lineno_offset = 0; > > Sure, those can be moved outside. > > I was just thinking of those as just establishing the pre-condition > for the loop that bfd_map_over_sections does. Those fields are never > used outside the "read the line number table" block, and the worker > function for bfd_map_over_sections --- effectively, the loop body. In > that light, it makes more sense to keep them right next to the call, > as they are in the original code. > > Here's a revised patch, if you prefer the initializations outside. > > 2002-03-06 Jim Blandy > > * 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. > > Index: gdb/coffread.c > =================================================================== > RCS file: /cvs/src/src/gdb/coffread.c,v > retrieving revision 1.26 > diff -c -r1.26 coffread.c > *** gdb/coffread.c 19 Mar 2002 19:00:03 -0000 1.26 > --- gdb/coffread.c 26 Jun 2002 18:19:07 -0000 > *************** > *** 593,608 **** > > /* 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); > > /* Now read the string table, all at once. */ > > --- 593,626 ---- > > /* End of warning */ > > info->min_lineno_offset = 0; > info->max_lineno_offset = 0; > > ! /* 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. */ >