From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26912 invoked by alias); 18 May 2012 13:33:36 -0000 Received: (qmail 26899 invoked by uid 22791); 18 May 2012 13:33:35 -0000 X-SWARE-Spam-Status: No, hits=-7.4 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 18 May 2012 13:33:19 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4IDX3CU014857 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 18 May 2012 09:33:03 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q4IDX0mg006490; Fri, 18 May 2012 09:33:01 -0400 Message-ID: <4FB64F8C.60901@redhat.com> Date: Fri, 18 May 2012 13:33:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: Joel Brobecker CC: "Maciej W. Rozycki" , Tom Tromey , Mark Kettenis , thomas@codesourcery.com, gdb-patches@sourceware.org, kevinb@redhat.com Subject: Re: [SH] regs command References: <201205171109.q4HB9Ljc005742@glazunov.sibelius.xs4all.nl> <20120517123827.GB10253@adacore.com> <201205171522.q4HFMWGM026439@glazunov.sibelius.xs4all.nl> <20120517154502.GE10253@adacore.com> <87zk96k2my.fsf@fleche.redhat.com> <20120517203757.GG10253@adacore.com> <4FB642E4.6050106@redhat.com> <20120518124843.GK10253@adacore.com> In-Reply-To: <20120518124843.GK10253@adacore.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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/msg00683.txt.bz2 On 05/18/2012 01:48 PM, Joel Brobecker wrote: >>> /* Initialize this lazily, to avoid an initialization order >>> > > dependency on solib-svr4.c's _initialize routine. */ >>> > > if (mips_svr4_so_ops.in_dynsym_resolve_code == NULL) >>> > > { >>> > > mips_svr4_so_ops = svr4_so_ops; >>> > > mips_svr4_so_ops.in_dynsym_resolve_code >>> > > = mips_linux_in_dynsym_resolve_code; >>> > > } >>> > > set_solib_ops (gdbarch, &mips_svr4_so_ops); >> > solib-svr4.c is as much target dependent as mips-linux-tdep.c though. >> > The split on file name is a bit arbitrary. It'd make a bit more sense >> > to split around something like COMMON_OBS and TARGET_OBJS, but you'd >> > still bump into such issues. A "don't depend on order" rule appears >> > simpler to understand and maintain than having to worry about >> > hierarchies. > And I *think* we solved that problem elsewhere, right? Basically, > we call functions to get the ops vector. That way, no matter the > init order, we always access initialized data... See the inf-* > files IIRC. Yeah, I think you're talking about inf_ptrace_target, etc. In those cases, the target_ops vector is heap allocated. For statically allocated cases, we have, e.g., ada-lang.c: static void initialize_ada_catchpoint_ops (void) { struct breakpoint_ops *ops; initialize_breakpoint_ops (); ... With initialize_breakpoint_ops itself bothering with init order (by being idempotent). Some core things that are dependent on initialization order are handled by "initialize_foo" (no _ prefix) calls crafted in a specific order in gdb_init. -- Pedro Alves