From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20997 invoked by alias); 15 Mar 2013 15:32:00 -0000 Received: (qmail 20988 invoked by uid 22791); 15 Mar 2013 15:31:58 -0000 X-SWARE-Spam-Status: No, hits=-7.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_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; Fri, 15 Mar 2013 15:31:49 +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 r2FFVlwj018772 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 15 Mar 2013 11:31:47 -0400 Received: from barimba (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 r2FFVjee013646 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 15 Mar 2013 11:31:46 -0400 From: Tom Tromey To: Doug Evans Cc: Alfonso Acosta , gdb Subject: Re: Visibility of ELF symbols not taken into account by certain GDB commands? References: Date: Fri, 15 Mar 2013 15:32:00 -0000 In-Reply-To: (Doug Evans's message of "Mon, 25 Feb 2013 10:09:14 -0800") Message-ID: <87wqt81xy6.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2013-03/txt/msg00022.txt.bz2 Alfonso> During that selection, visibility is not taken into account (e.g. the Alfonso> ld.so malloc symbol is used although the globally visible one, from Alfonso> the dynamic loaders point of view, is the one in libc.so) Alfonso> Should this be considered a bug? Doug> 1) ELF symbol visibility doesn't really enter the picture. Doug> Sometimes you don't want it to. Though I can see a usefulness in Doug> having knobs to control this, I'm not aware of any (could just be my Doug> bad memory :-)) or any plans to add them. Yeah, I don't know about plans to deal with visibility, but there are some open bugs about how gdb doesn't respect ELF semantics, and so you can sometimes write expressions that don't give the same result as the same expression in the source. E.g., there's a couple of bugs related to copy relocations. Doug> What happens, in a nutshell, is gdb looks up the symbol in the current Doug> context (whatever that is), and then does a search over all contexts. Doug> This involves doing a linear search over the binary and all shared Doug> libraries and using the first one found. In this case it's the one in Doug> ld.so. ... there's also a tweak here to try to reproduce ELF semantics. I found elf_lookup_lib_symbol and the corresponding target_so_ops method, but I thought there was some other hook too... can't find it right now. Tom