From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1997 invoked by alias); 28 Sep 2011 22:04:09 -0000 Received: (qmail 1977 invoked by uid 22791); 28 Sep 2011 22:04:07 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_BJ X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 28 Sep 2011 22:03:50 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8SM3mdN009954 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 28 Sep 2011 18:03:48 -0400 Received: from host1.jankratochvil.net (ovpn-116-16.ams2.redhat.com [10.36.116.16]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p8SM3kRZ003086 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 28 Sep 2011 18:03:47 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p8SM3jER032489 for ; Thu, 29 Sep 2011 00:03:45 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p8SM3iar032488 for gdb-patches@sourceware.org; Thu, 29 Sep 2011 00:03:44 +0200 Date: Wed, 28 Sep 2011 23:08:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] Fix initial language with -readnow, regressed by: RFC: add DWARF index support Message-ID: <20110928220344.GA17977@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-09/txt/msg00480.txt.bz2 Hi, if you use -readnow the common autodetection The current source language is "auto; currently c++". fails The current source language is "auto; currently c". causing various C++ handling problems. dw2_find_symbol_file: /* index_table is NULL if OBJF_READNOW. */ if (!dwarf2_per_objfile->index_table) return NULL; There are only 'skip'ped commits left to test. The first bad commit could be any of: 28cfc710ba3d9959cedd0f345bb212666cc6890f cf9fe5cf2be8b76820a05c966cdca6df5c2eee24 3363422556d95de01c4a262489fec8d6b5506d01 We cannot bisect more! bisect run cannot continue any more No regressions on {x86_64,x86_64-m32,i686}-fedora16pre-linux-gnu. I will check it in. Thanks, Jan gdb/ 2011-09-28 Jan Kratochvil Fix initial language detection with -readnow. * symtab.c (find_main_filename): New variables sym and readnow_seen. Use them for lookup_symbol. gdb/testsuite/ 2011-09-28 Jan Kratochvil Fix initial language detection with -readnow. * gdb.cp/readnow-language.cc: New file. * gdb.cp/readnow-language.exp: New file. --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1687,17 +1687,30 @@ find_main_filename (void) { struct objfile *objfile; char *name = main_name (); + struct symbol *sym; + int readnow_seen = 0; ALL_OBJFILES (objfile) { const char *result; + readnow_seen |= (objfile->flags & OBJF_READNOW) != 0; + if (!objfile->sf) continue; result = objfile->sf->qf->find_symbol_file (objfile, name); if (result) return result; } + + /* OBJF_READNOW does not provide any index to look up above. */ + if (readnow_seen) + { + sym = lookup_symbol (name, NULL, VAR_DOMAIN, NULL); + if (sym) + return sym->symtab->filename; + } + return (NULL); } --- /dev/null +++ b/gdb/testsuite/gdb.cp/readnow-language.cc @@ -0,0 +1,21 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2011 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +int +main () +{ +} --- /dev/null +++ b/gdb/testsuite/gdb.cp/readnow-language.exp @@ -0,0 +1,28 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set testfile readnow-language +set srcfile ${testfile}.cc +set executable ${testfile} +if {[build_executable ${testfile}.exp $executable ${testfile}.cc {c++ debug}] == -1} { + return -1 +} + +set old_gdbflags $GDBFLAGS +set GDBFLAGS "$GDBFLAGS -readnow" +clean_restart $executable +set GDBFLAGS $old_gdbflags + +gdb_test "show language" {The current source language is "auto; currently c\+\+"\.}