From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26035 invoked by alias); 29 May 2012 15:44:58 -0000 Received: (qmail 26013 invoked by uid 22791); 29 May 2012 15:44:56 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO,TW_BJ X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 29 May 2012 15:44:44 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 968D21C6F79; Tue, 29 May 2012 11:44:43 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 9J4U1Vf0BO+g; Tue, 29 May 2012 11:44:43 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 40E161C6DBD; Tue, 29 May 2012 11:44:43 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id D203E145616; Tue, 29 May 2012 08:44:36 -0700 (PDT) Date: Tue, 29 May 2012 15:44:00 -0000 From: Joel Brobecker To: Jan Kratochvil Cc: Pedro Alves , Tom Tromey , gdb-patches@sourceware.org Subject: Re: RFC for: "Re: Regression for gdb.fortran/library-module.exp [Re: [RFA] choose symbol from given block's objfile first.]" Message-ID: <20120529154436.GO5492@adacore.com> References: <20120514143927.GB10253@adacore.com> <20120514145151.GA30451@host2.jankratochvil.net> <4FB1459E.60208@redhat.com> <20120514175913.GM10253@adacore.com> <20120514180624.GA16368@host2.jankratochvil.net> <20120515130851.GP10253@adacore.com> <20120516195718.GA10253@adacore.com> <20120518164815.GA11883@host2.jankratochvil.net> <20120528142727.GH5492@adacore.com> <20120528161200.GA19230@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120528161200.GA19230@host2.jankratochvil.net> User-Agent: Mutt/1.5.20 (2009-06-14) 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-05/txt/msg01021.txt.bz2 > Just the MAINLINE exception is not enough, it still regresses GDB: OK, I see what you mean, now. > before your patches (and therefore matching GDB the inferior behavior): > 11 > $1 = 1 > $2 = 1 > 22 > $1 = 2 > $2 = 2 On x86-windows, the two programs alway return the same value: 12, which means that the global variables remain distinct, and localized to each DLL. It's not a surprise, it's the same test I've made before. Just to be thorough, I defined a third instance of global variable v, this time in 50.c (the main body), and change the return value to also add the value of this global: $ cat 50.c int v = 100; extern int f (void); extern int g (void); int main (void) { return 10 * f () + g () + v; } This time, the return value is always 112. Again, no surprise. > But '"context" objfile first' is incompatible with SVR4. The behavior > apparently has to be target specific. OK, I think we should be able to modify my patch to add a new gdbarch attribute, unset by default, which we will set on all Windows arches. Then, the iterator can query that gdbarch attribute to decide whether to ignore the "context" objfile or not. The following implementation for iterate_over_objfiles_in_search_order should work; WDYT? void iterate_over_objfiles_in_search_order (iterate_over_objfiles_in_search_order_cb cb, void *cb_data, struct objfile *context_objfile) { int stop = 0; struct objfile *objfile; if (context_objfile && gdbarch_dso_global_vars_distinct_p (get_objfile_arch (context_objfile))) { /* Global variables defined with the same name in multiple object files get merged into one single entity. Favouring the context objfile in this case would be wrong, as we might end up picking the wrong location. */ context_objfile = NULL; } if (context_objfile) { stop = cb (context_objfile, cb_data); if (stop) return; } ALL_OBJFILES (objfile) { if (objfile != context_objfile) { stop = cb (objfile, cb_data); if (stop) return; } } } (untested) The thing I am worried about is the design of the gdbarch part, because I don't think I master all the elements across platforms. But I suppose that this is only of relative importance, as we can refine it as we go. Thanks, -- Joel