From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 101217 invoked by alias); 21 Jul 2015 10:28:56 -0000 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 Received: (qmail 101204 invoked by uid 89); 21 Jul 2015 10:28:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 21 Jul 2015 10:28:54 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 30A85A12C8; Tue, 21 Jul 2015 10:28:53 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6LASpCE028780; Tue, 21 Jul 2015 06:28:51 -0400 Message-ID: <55AE1EE2.4060508@redhat.com> Date: Tue, 21 Jul 2015 10:28:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Gary Benson , Jan Kratochvil CC: gdb-patches@sourceware.org, Aleksandar Ristovski Subject: Re: [PATCH v10 04/10] Create empty common/linux-maps.[ch] and common/target-utils.[ch] References: <20150607200422.8918.48900.stgit@host1.jankratochvil.net> <20150607200454.8918.52868.stgit@host1.jankratochvil.net> <20150608083733.GA5405@blade.nx> <20150715212028.GA22133@host1.jankratochvil.net> <20150716081412.GA4954@blade.nx> In-Reply-To: <20150716081412.GA4954@blade.nx> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-07/txt/msg00585.txt.bz2 On 07/16/2015 09:14 AM, Gary Benson wrote: > Jan Kratochvil wrote: >> On Mon, 08 Jun 2015 10:37:33 +0200, Gary Benson wrote: >>> A bunch of stuff has changed in the way common code is laid out >>> since May 2014, so while Tom approved this back then, it's not >>> suitable any more. Please update the series as follows: >>> >>>> * common/linux-maps.c: New file. >>>> * common/linux-maps.h: New file. >>> >>> Nothing os-specific should be in common. These files should be >>> nat/linux-maps.[ch]. >> >> While I have done so I do not share this opinion. linux-maps.[ch] >> is used from linux-tdep.c and not from linux-nat.c. linux-tdep.c is >> using common/* files a lot but it uses no function from nat/*: >> >> $ for i in $(for i in common/*.c;do nm `basename $i .c`.o;done|sed -n 's/^.* T //p');do grep -q "\<$i (" linux-tdep.c && echo $i;done|wc -l >> 17 >> $ for i in $(for i in nat/*.c;do nm `basename $i .c`.o;done|sed -n 's/^.* T //p');do grep -q "\<$i (" linux-tdep.c && echo $i;done|wc -l >> 0 >> (commands above assume in-src-tree build) >> >> Additionally linux-maps.o should not be in config/**.mh::NATDEPFILES >> (like linux-namespaces.o from nat/ ) but it needs to be in >> configure.tgt instead. >> >> Should be linux-maps.[ch] therefore in nat/ or in common/ ? >> If it matters, though. > > I don't fully understand the tdep/non-tdep split very well. > Pedro, could you comment? TL;DR: roughly, nat/ holds native target_ops code, while tdep files hold gdbarch code. The idea of nat/ is to hold host-dependent code that implements the native target (target_ops) backends. Code in that directory makes use of native system debug APIs, constants, etc.. Such code cannot be used on a cross debugger that targets the OS the code is for, because it e.g., relies on headers that will only exist on that target OS. nat/ code is used by either gdb's native target_ops target, or, gdbserver's. E.g., a --host=mingw32 --target=x86_64-linux gdb can't build the native Linux code in nat/. In contrast, the tdep files files contain code that _must_ be host-independent. The same --host=mingw32 --target=x86_64-linux gdb build includes the linux-specific -tdep files. A -tdep.c file including a "nat/foo.h" header thus raises the abstraction-violation alarm bell. It's at the same level of a -tdep.c file including . So seems to me this maps code should not be in nat/. Thanks, Pedro Alves