From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27727 invoked by alias); 4 Jun 2012 04:55:18 -0000 Received: (qmail 27717 invoked by uid 22791); 4 Jun 2012 04:55:16 -0000 X-SWARE-Spam-Status: No, hits=-5.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,TW_BJ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-vb0-f41.google.com (HELO mail-vb0-f41.google.com) (209.85.212.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 04 Jun 2012 04:55:03 +0000 Received: by vbbey12 with SMTP id ey12so2709322vbb.0 for ; Sun, 03 Jun 2012 21:55:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding:x-system-of-record :x-gm-message-state; bh=wraI7ph9513oebyx/yAp+xN5B+1FdSNvVqMkn/dq13g=; b=lznpk6TbZkDA3xhC3zJu2SAtcdXexFvbvzisHQoMZ9kn92yW2O+LNVOrdbRCN0IHkt XCl1wG8T6f6IOD9BCaS9p2xEBvm4yRGFZkFpGAE9TPPqurNjyCOhVwpcnxzs89qeJxdb 3TKmKvf3YRrHpGzSypyBWw4HZixvAan2qvTwpka6suoQo0g80eUEUCAXGIqAyJQ0ZXwH 4lP+NM1lG6sbA2eWseEn8hJzVhSGjtMiXiPGq0SKaEXIQDXUWYjEfFPVD0MZq09xdTaN GELoAI6y92mQcoCPMmL036PZRWeSXXnjoRwjaC3ztMDIQbfDXM7mP6uLjU2kiEo7qb0q EXtA== Received: by 10.220.214.8 with SMTP id gy8mr11054201vcb.45.1338785702966; Sun, 03 Jun 2012 21:55:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.214.8 with SMTP id gy8mr11054188vcb.45.1338785702788; Sun, 03 Jun 2012 21:55:02 -0700 (PDT) Received: by 10.52.161.199 with HTTP; Sun, 3 Jun 2012 21:55:02 -0700 (PDT) In-Reply-To: <1338496603-5423-4-git-send-email-brobecker@adacore.com> References: <1338496603-5423-1-git-send-email-brobecker@adacore.com> <1338496603-5423-4-git-send-email-brobecker@adacore.com> Date: Mon, 04 Jun 2012 04:55:00 -0000 Message-ID: Subject: Re: [RFA 3/3] Windows-specific iterate_over_objfiles_in_search_order From: Doug Evans To: Joel Brobecker Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-Gm-Message-State: ALoCoQlb7PuvfLqpp0etqqrZzieDXRfiZ12NFJosN1hg0NA0uhMj4XNvxEQ62PqjjGdI4LJ8yKjE+TkkCvRysJFJtEvqdttaEnfENUPg2/X3xatjxVMCpbygcHQXebEWFtY4FmIyl5NrbI732VaZAFoXqNmRvbfk1Q== 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: 2012-06/txt/msg00073.txt.bz2 On Thu, May 31, 2012 at 1:36 PM, Joel Brobecker wro= te: > This patch sets the windows target to use their own version of > the iterate_over_objfiles_in_search_order gdbarch method, in > order to make global symbol searches sensitive to the current > objfile. > > gdb/ChangeLog: > > =A0 =A0 =A0 =A0* windows-tdep.h (windows_iterate_over_objfiles_in_search_= order): > =A0 =A0 =A0 =A0Add declaration. > =A0 =A0 =A0 =A0* windows-tdep.c: #include "objfiles.h". > =A0 =A0 =A0 =A0(windows_iterate_over_objfiles_in_search_order): New funct= ion. > =A0 =A0 =A0 =A0* amd64-windows-tdep.c (amd64_windows_init_abi): Set > =A0 =A0 =A0 =A0iterate_over_objfiles_in_search_order gdbarch method to > =A0 =A0 =A0 =A0windows_iterate_over_objfiles_in_search_order. > =A0 =A0 =A0 =A0* i386-cygwin-tdep.c (i386_cygwin_init_abi): Likewise. >[...] >+/* Implement the "iterate_over_objfiles_in_search_order" gdbarch >+ method. It searches all objfiles, starting with CURRENT_OBJFILE >+ first (if not NULL). >+ >+ On Windows, the system behaves a little differently when two >+ objfiles each define a global symbol using the same name, compared >+ to other platforms such as GNU/Linux for instance. On GNU/Linux, >+ all instances of the symbol effectively get merged into a single >+ one, but on Windows, they remain distinct. >+ >+ As a result, it usually makes sense to start global symbol searches >+ with the current objfile before expanding it to all other objfiles. >+ This helps for instance when a user debugs some code in a DLL that >+ refers to a global variable defined inside that DLL. When trying >+ to print the value of that global variable, it would be unhelpful >+ to print the value of another global variable defined with the same >+ name, but in a different DLL. */ GDB's notion of a global symbol isn't a perfect match for ELF's notion. I'm wondering if there are examples where we'd want this for ELF too. [And are there examples where we don't want this for ELF?]