From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24125 invoked by alias); 13 Aug 2002 21:54:50 -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 24118 invoked from network); 13 Aug 2002 21:54:49 -0000 Received: from unknown (HELO jackfruit.Stanford.EDU) (171.64.38.136) by sources.redhat.com with SMTP; 13 Aug 2002 21:54:49 -0000 Received: (from carlton@localhost) by jackfruit.Stanford.EDU (8.11.6/8.11.6) id g7DLslY13379; Tue, 13 Aug 2002 14:54:47 -0700 X-Authentication-Warning: jackfruit.Stanford.EDU: carlton set sender to carlton@math.stanford.edu using -f To: Jim Blandy Cc: gdb-patches@sources.redhat.com Subject: Re: dwarf2_build_psymtabs should check that .debug_line exists References: <15697.45810.578860.108712@jackfruit.Stanford.EDU> Cc: carlton@math.stanford.edu Content-Type: text/plain; charset=US-ASCII From: David Carlton Date: Tue, 13 Aug 2002 14:54:00 -0000 In-Reply-To: Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp) MIME-Version: 1.0 X-SW-Source: 2002-08/txt/msg00323.txt.bz2 In article , Jim Blandy writes: > It looks to me like read_file_scope shouldn't call dwarf_decode_macros > either when line_header is zero. Could you add that to your patch, > and re-post it? Oh, right, good call. Here it is; no new regressions. David Carlton carlton@math.stanford.edu 2002-08-13 David Carlton * dwarf2read.c (dwarf2_build_psymtabs): Check that dwarf_line_offset is nonzero before creating dwarf_line_buffer. (read_file_scope): Check that line_header is nonzero before decoding macro information. Index: dwarf2read.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2read.c,v retrieving revision 1.64 diff -u -p -r1.64 dwarf2read.c --- dwarf2read.c 31 Jul 2002 22:35:30 -0000 1.64 +++ dwarf2read.c 13 Aug 2002 21:30:02 -0000 @@ -1009,9 +1009,13 @@ dwarf2_build_psymtabs (struct objfile *o dwarf_abbrev_buffer = dwarf2_read_section (objfile, dwarf_abbrev_offset, dwarf_abbrev_size); - dwarf_line_buffer = dwarf2_read_section (objfile, - dwarf_line_offset, - dwarf_line_size); + + if (dwarf_line_offset) + dwarf_line_buffer = dwarf2_read_section (objfile, + dwarf_line_offset, + dwarf_line_size); + else + dwarf_line_buffer = NULL; if (dwarf_str_offset) dwarf_str_buffer = dwarf2_read_section (objfile, @@ -1808,7 +1812,7 @@ read_file_scope (struct die_info *die, s header, so we can only read it if we've read the header successfully. */ attr = dwarf_attr (die, DW_AT_macro_info); - if (attr) + if (attr && line_header) { unsigned int macro_offset = DW_UNSND (attr); dwarf_decode_macros (line_header, macro_offset,