From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25375 invoked by alias); 13 Mar 2012 23:25:19 -0000 Received: (qmail 25365 invoked by uid 22791); 13 Mar 2012 23:25:18 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD 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; Tue, 13 Mar 2012 23:25:01 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2DNP0AR003193 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 13 Mar 2012 19:25:00 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q2DNOxSo021630; Tue, 13 Mar 2012 19:24:59 -0400 Message-ID: <4F5FD74B.1090500@redhat.com> Date: Tue, 13 Mar 2012 23:25:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 MIME-Version: 1.0 To: Kevin Buettner CC: gdb-patches@sourceware.org Subject: Re: [RFC] symtab.c: Change skip_prologue_sal comparison to match main() too References: <20120313155817.44b4f280@mesquite.lan> In-Reply-To: <20120313155817.44b4f280@mesquite.lan> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 2012-03/txt/msg00459.txt.bz2 On 03/13/2012 10:58 PM, Kevin Buettner wrote: > I'm seeing failures in gdb.cp/koenig.exp for targets which define a > ``skip_main_prologue'' gdbarch method. It turns out, however, that > most other C++ tests which run to main are not running to the correct > location either. (The test results don't show this though.) > > Here is the relevant part of the log file for gdb.cp/koenig.exp for > frv-elf showing this behavior: > > Breakpoint 1, main () at /ironwood1/sourceware-clean/frv-elf/../src/gdb/testsuite/gdb.cp/koenig.cc:246 > 246 { > (gdb) p first(c) > No symbol "c" in current context. > > Note that the breakpoint did not correctly end up at the first line of > the function body. > > When I look at the code in question with gdb, I see that a comparison > is being made between "main()" and "main" and is (obviously) failing. > I'm going to guess this is fallback from physname. The code looked like this when it was originally added: + /* On targets with executable formats that don't have a concept of + constructors (ELF with .init has, PE doesn't), gcc emits a call + to `__main' in `main' between the prologue and before user + code. */ + if (funfirstline + && gdbarch_skip_main_prologue_p (current_gdbarch) + && SYMBOL_LINKAGE_NAME (sym) + && strcmp (SYMBOL_LINKAGE_NAME (sym), "main") == 0) And SYMBOL_LINKAGE_NAME (sym) used to be "main" for C++ too. > Does the patch below look reasonable? Looks reasonable to me... -- Pedro Alves