From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 326 invoked by alias); 17 Feb 2010 17:45:15 -0000 Received: (qmail 316 invoked by uid 22791); 17 Feb 2010 17:45:15 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS 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, 17 Feb 2010 17:45:04 +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.13.8/8.13.8) with ESMTP id o1HHisEU021941 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 17 Feb 2010 12:44:54 -0500 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1HHio72010829 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 17 Feb 2010 12:44:52 -0500 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id o1HHioiv007688; Wed, 17 Feb 2010 18:44:50 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id o1HHio94007687; Wed, 17 Feb 2010 18:44:50 +0100 Date: Wed, 17 Feb 2010 17:45:00 -0000 From: Jan Kratochvil To: Daniel Jacobowitz Cc: Pedro Alves , gdb-patches@sourceware.org Subject: Re: [patch] STT_GNU_IFUNC support Message-ID: <20100217174450.GB32328@host0.dyn.jankratochvil.net> References: <20100214203512.GA838@host0.dyn.jankratochvil.net> <20100215184048.GA16276@caradoc.them.org> <201002171234.15169.pedro@codesourcery.com> <20100217141912.GA28715@host0.dyn.jankratochvil.net> <20100217144614.GI9493@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100217144614.GI9493@caradoc.them.org> User-Agent: Mutt/1.5.20 (2009-08-17) 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: 2010-02/txt/msg00429.txt.bz2 On Wed, 17 Feb 2010 15:46:15 +0100, Daniel Jacobowitz wrote: > On Wed, Feb 17, 2010 at 03:19:12PM +0100, Jan Kratochvil wrote: > > (C) Print just the bare ifunc-resolver address for "p strcmp". > > > > +(CACHE) = + possibility: Cache the pointer in GDB. > > > > "Regular users" just print "strcmp (...)" and do not print "strcmp" which > > possibly makes (C) a viable option. > > I don't know. What about "disassemble strcmp" - I think it should > disassemble the same thing that will show up in the assembly as "call > 0x$hex ". But maybe automatically disassembling strcmp_sse is > more useful. According to the reply to Pedro Alves http://sourceware.org/ml/gdb-patches/2010-02/msg00428.html I will follow now that "strcmp" means the unresolved gnu-ifunc resolver. (and "disassemble strcmp" disassembles just the gnu-ifunc resolver) > Hmm. I guess that leaves "break strcmp" in a weird place since strcmp > will only be called once. Maybe a breakpoint on an indirect function > should also set a breakpoint on the target of the indirect function? > This is slightly awkward to implement because there's no debug hook > after the indirect function returns; we'd have to do that > automatically to set the second breakpoint, or risk missing calls. OK, nice catch. GDB automatically calls "strcmp" from glibc (which is the resolver), not the 'glibc@plt' (which acts as a regular function hiding gnu-ifunc at all).. Probably to break at the "strcmp" resolver and when it is hit the first time then GDB can easily move the breakpoint to the resolved "strcmp_sse" function by internally executing GDB "finish" call and using the returned address. It would contradict that GDB should deal only with the gnu-ifunc resolver for "strcmp", though. > Inferior calls are hundreds of times slower than symbol lookups. GDB > can do a lot of symbol lookups behind the scenes, for instance "info > func" will do a lookup_symbol for every function. Since native x86_64 > Linux inferior calls are only hundreds of times slower, you may not > notice this as much. On a slower target, or a remote target, it may > be thousands of times slower. What if GDB prefers to use "strcmp@plt" instead of "strcmp" when GDB finds "strcmp" is a gnu-ifunc symbol. It will save the new GDB framework to deal with the .got.plt addresses. Thanks, Jan