From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20389 invoked by alias); 9 May 2002 00:06:24 -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 20304 invoked from network); 9 May 2002 00:06:22 -0000 Received: from unknown (HELO cygnus.com) (205.180.83.203) by sources.redhat.com with SMTP; 9 May 2002 00:06:22 -0000 Received: from romulus.sfbay.redhat.com (romulus.sfbay.redhat.com [172.16.27.251]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id RAA11119 for ; Wed, 8 May 2002 17:06:20 -0700 (PDT) Received: (from kev@localhost) by romulus.sfbay.redhat.com (8.11.6/8.11.6) id g4906H110716 for gdb-patches@sources.redhat.com; Wed, 8 May 2002 17:06:17 -0700 Date: Wed, 08 May 2002 17:06:00 -0000 From: Kevin Buettner Message-Id: <1020509000616.ZM10715@localhost.localdomain> To: gdb-patches@sources.redhat.com Subject: [PATCH RFA] dbxread.c: Complain when local symbols are discarded MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-05/txt/msg00248.txt.bz2 I've found that some older versions of gcc incorrectly output N_LSYM entries after the corresponding (enclosing) N_LBRAC entry. The real fix for this problem is to patch gcc with the following patch from Richard Henderson: http://gcc.gnu.org/ml/gcc/2000-12/msg00870.html However, it seems to me that GDB should not be silently discarding local symbols, hence the reason for the new complaint. Okay to commit? * dbxread.c (discarding_local_symbols_complaint): New complaint. (process_one_symbol): Complain about discarding local symbols due to a misplaced N_LBRAC entry. Index: dbxread.c =================================================================== RCS file: /cvs/src/src/gdb/dbxread.c,v retrieving revision 1.32 diff -u -p -r1.32 dbxread.c --- dbxread.c 24 Apr 2002 08:00:54 -0000 1.32 +++ dbxread.c 8 May 2002 23:54:30 -0000 @@ -203,6 +203,9 @@ struct complaint repeated_header_complai struct complaint unclaimed_bincl_complaint = {"N_BINCL %s not in entries for any file, at symtab pos %d", 0, 0}; + +struct complaint discarding_local_symbols_complaint = +{"misplaced N_LBRAC entry; discarding local symbols which have no enclosing block", 0, 0}; /* find_text_range --- find start and end of loadable code sections @@ -2881,7 +2884,21 @@ process_one_symbol (int type, int desc, /* Can only use new->locals as local symbols here if we're in gcc or on a machine that puts them before the lbrack. */ if (!VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation)) - local_symbols = new->locals; + { + if (local_symbols != NULL) + { + /* GCC development snapshots from March to December of + 2000 would output N_LSYM entries after N_LBRAC + entries. As a consequence, these symbols are simply + discarded. Complain if this is the case. Note that + there are some compilers which legitimately put local + symbols within an LBRAC/RBRAC block; this complaint + might also help sort out problems in which + VARIABLES_INSIDE_BLOCK is incorrectly defined. */ + complain (&discarding_local_symbols_complaint); + } + local_symbols = new->locals; + } if (context_stack_depth > !VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation))