From: Pedro Alves <palves@redhat.com>
To: Gary Benson <gbenson@redhat.com>,
Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org, Aleksandar Ristovski <ARistovski@qnx.com>
Subject: Re: [PATCH v10 04/10] Create empty common/linux-maps.[ch] and common/target-utils.[ch]
Date: Tue, 21 Jul 2015 10:28:00 -0000 [thread overview]
Message-ID: <55AE1EE2.4060508@redhat.com> (raw)
In-Reply-To: <20150716081412.GA4954@blade.nx>
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 <sys/ptrace.h>.
So seems to me this maps code should not be in nat/.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2015-07-21 10:28 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-07 20:04 [PATCH v6 00/10] Validate binary before use Jan Kratochvil
2015-06-07 20:04 ` [PATCH v6 02/10] Merge multiple hex conversions Jan Kratochvil
2015-06-07 20:04 ` [PATCH v6 03/10] Code cleanup: Rename enum -> enum filterflags Jan Kratochvil
2015-06-08 2:39 ` Sergio Durigan Junior
2015-06-07 20:04 ` [PATCH v6 01/10] Move utility functions to common/ Jan Kratochvil
2015-06-07 20:05 ` [PATCH v6 09/10] Validate symbol file using build-id Jan Kratochvil
2015-06-07 20:05 ` [PATCH v6 05/10] Move gdb_regex* to common/ Jan Kratochvil
2015-06-07 20:05 ` [PATCH v6 10/10] Tests for validate symbol file using build-id Jan Kratochvil
2015-06-07 20:05 ` [PATCH v6 07/10] Move linux_find_memory_regions_full & co Jan Kratochvil
2015-06-08 8:42 ` Gary Benson
2015-06-07 20:05 ` [PATCH v6 06/10] Prepare linux_find_memory_regions_full & co. for move Jan Kratochvil
2015-06-07 20:05 ` [PATCH v6 08/10] gdbserver build-id attribute generator Jan Kratochvil
2015-06-07 20:05 ` [PATCH v6 04/10] Create empty common/linux-maps.[ch] and common/target-utils.[ch] Jan Kratochvil
2015-06-08 8:37 ` Gary Benson
2015-06-11 18:48 ` Jan Kratochvil
2015-06-11 19:47 ` Aleksandar Ristovski
2015-06-12 11:26 ` Gary Benson
2015-06-14 19:28 ` Jan Kratochvil
2015-06-23 8:42 ` Gary Benson
2015-07-15 21:20 ` [PATCH v10 " Jan Kratochvil
2015-07-16 8:14 ` Gary Benson
2015-07-16 8:32 ` Jan Kratochvil
2015-07-21 10:28 ` Pedro Alves [this message]
2015-07-17 20:51 ` [PATCH v11 " Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55AE1EE2.4060508@redhat.com \
--to=palves@redhat.com \
--cc=ARistovski@qnx.com \
--cc=gbenson@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox