From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62915 invoked by alias); 6 Jul 2018 12:00:25 -0000 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 Received: (qmail 62571 invoked by uid 89); 6 Jul 2018 12:00:05 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=yours X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Jul 2018 12:00:03 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 46573407540A; Fri, 6 Jul 2018 12:00:02 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id C121D111DCF3; Fri, 6 Jul 2018 12:00:01 +0000 (UTC) Subject: Re: Viewing the address of an array in gdb To: Mahmood Naderan , "gdb@sourceware.org" References: <1377359320.54438.1530847991768.ref@mail.yahoo.com> <1377359320.54438.1530847991768@mail.yahoo.com> From: Pedro Alves Message-ID: Date: Fri, 06 Jul 2018 12:00:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-07/txt/msg00019.txt.bz2 On 07/06/2018 12:51 PM, Pedro Alves wrote: > On 07/06/2018 04:33 AM, Mahmood Naderan via gdb wrote: >> Hi, >> I have define "char buffer[100]" in a C code. Trying to view the location of buffer in GDB, I see this Ah, I missed the "you have defined a buffer yourself" part. So what seems to be happening is that there's another symbol also called "buffer" in glibc: (gdb) info symbol buffer buffer in section .bss of /lib64/libc.so.6 and gdb is picking that symbol instead of yours. I can reproduce this if I compile a small program without debug info, but with debug info (-g), it works as you'd expect. I don't think we have syntax to disambiguate this, like 'libc.so.6'::buffer' vs 'program'::buffer, or program#buffer some such, unfortunately. Thanks, Pedro Alves