From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 322 invoked by alias); 2 Apr 2008 20:02:48 -0000 Received: (qmail 32393 invoked by uid 22791); 2 Apr 2008 20:02:31 -0000 X-Spam-Check-By: sourceware.org Received: from bluesmobile.specifix.com (HELO bluesmobile.specifix.com) (216.129.118.140) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 02 Apr 2008 20:02:12 +0000 Received: from [127.0.0.1] (bluesmobile.specifix.com [216.129.118.140]) by bluesmobile.specifix.com (Postfix) with ESMTP id CC2953BE8B; Wed, 2 Apr 2008 13:02:10 -0700 (PDT) Subject: Re: info addr foo [where foo is a static global in multiple files] From: Michael Snyder To: Doug Evans Cc: gdb In-Reply-To: References: Content-Type: text/plain Date: Wed, 02 Apr 2008 20:02:00 -0000 Message-Id: <1207166530.31772.135.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.10.3 (2.10.3-7.fc7) Content-Transfer-Encoding: 7bit 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: 2008-04/txt/msg00014.txt.bz2 On Wed, 2008-04-02 at 12:52 -0700, Doug Evans wrote: > If I want to find the addresses of all variables named foo, it seems > like there should be an easy way to do this. "info addr foo" will > only print one. There's also the issue that if I only want one it may > not print the one I want. Should it print all of them? > > The user could study the output of "info var foo" and do things like > "p/x &'file.c'::foo" for each variable, but that seems a bit clumsy > (and doesn't work if the files all happen to have the same name). > > [As a workaround, the user could do "maint print symbols", but I > wonder if "info addr" should change.] Hmmm... good question. By the same token, the mirror image of "info addr" is "info symbol". It takes an address, and finds a symbol that matches. In some corner cases, there might be more than one symbol at the same address, but I assume info symbol will only show the first one found. Maybe that should be addressed too (no pun intended).