From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9574 invoked by alias); 22 Feb 2013 15:10:34 -0000 Received: (qmail 9565 invoked by uid 22791); 22 Feb 2013 15:10:33 -0000 X-SWARE-Spam-Status: No, hits=-3.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-vc0-f174.google.com (HELO mail-vc0-f174.google.com) (209.85.220.174) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 22 Feb 2013 15:10:20 +0000 Received: by mail-vc0-f174.google.com with SMTP id n11so458891vch.5 for ; Fri, 22 Feb 2013 07:10:19 -0800 (PST) X-Received: by 10.52.99.42 with SMTP id en10mr2634999vdb.37.1361545810437; Fri, 22 Feb 2013 07:10:10 -0800 (PST) MIME-Version: 1.0 Received: by 10.58.154.134 with HTTP; Fri, 22 Feb 2013 07:09:50 -0800 (PST) From: Alfonso Acosta Date: Fri, 22 Feb 2013 15:10:00 -0000 Message-ID: Subject: Visibility of ELF symbols not taken into account by certain GDB commands? To: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes 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-02/txt/msg00089.txt.bz2 Hi, I have observed that certain commands, ("print" and "info symbol" at least) pick only one symbol in case of multible definitions (e.g. malloc is defined in ls.so and libc.so, but only one of them is picked). During that selection, visibility is not taken into account (e.g. the ld.so malloc symbol is used although the globally visible one, from the dynamic loaders point of view, is the one in libc.so) Should this be considered a bug? At the very least, it seems very counterintuitive to me. I would had expected either using all occurrences of the symbol or picking the visible one. This issue is well covered by I question I made in Stackoverflow [1]. Here is an example of what I mean: (gdb) info symbol malloc malloc in section .text of /lib64/ld-linux-x86-64.so.2 (gdb) p malloc $1 = {void *(size_t)} 0x7ffff7df0930 (gdb) info symbol 0x7ffff7df0930 malloc in section .text of /lib64/ld-linux-x86-64.so.2 (gdb) b malloc Breakpoint 2 at 0x7ffff7df0930: malloc. (2 locations) (gdb) info breakpoints Num Type Disp Enb Address What 2 breakpoint keep y 2.1 y 0x00007ffff7df0930 in malloc at dl-minimal.c:95 2.2 y 0x00007ffff7a9f9d0 in __GI___libc_malloc at malloc.c:2910 (gdb) Thanks, Alfonso Acosta PS: I am running "GNU gdb (Ubuntu/Linaro 7.4-2012.02-0ubuntu2) 7.4-2012.02". [1] http://stackoverflow.com/questions/14867024/duplicated-memory-management-symbols-in-libc-so-and-ld-linux-so/15008471#15008471