From: Pedro Alves <palves@redhat.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>, gbenson@redhat.com
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 0/7] Refactor shared code in {i386,amd64}-linux-nat.c
Date: Fri, 27 Jun 2014 10:39:00 -0000 [thread overview]
Message-ID: <53AD49F1.70709@redhat.com> (raw)
In-Reply-To: <201406270928.s5R9SZPG020219@glazunov.sibelius.xs4all.nl>
On 06/27/2014 10:28 AM, Mark Kettenis wrote:
> Sorry, no. Perhaps more code can be shared between i386-linux-nat.c
> and amd64-linux-nat.c, but this goes too far and turns things into
> #ifdef spagetthi. It also breaks established naming conventions.
I think you may have stopped looking before patch #6. :-)
Please also keep in mind that gdbserver also has its own copy of
this code, and on the gdbserver side, we also started out with i386 and
amd64 split in different files, and then they got merged:
commit d0722149ad594a7d3892bb2fd53a72c6d4933793
Author: Doug Evans <dje@google.com>
Date: Tue May 12 22:25:00 2009 +0000
Biarch support for i386/amd64 gdbserver.
* Makefile.in (SFILES): Remove linux-i386-low.c, linux-x86-64-low.c.
Add linux-x86-low.c.
(linux-i386-low.o, linux-x86-64-low.o): Delete.
(linux-x86-low.o): Add.
...
Please look at the resulting x86-linux-nat.c, and gdbserver's
existing linux-x86-low.c, the interim steps.
(The latter we'll eventually want to merge gdb's code with.)
This whole series can be found in
git@github.com:gbenson/binutils-gdb.git gbenson/i386-dregs
for convenience.
I can't agree that this series went too far, on the contrary - gdbserver
has everything in the linux-x86-low.c file, while Gary only moved the truly
shared code. That's a fine incremental step IMNSHO.
The resulting #ifdefery quite reasonable, IMNSHO -- it'd be bad if there
were lots of different combinations of symbols we'd have to #ifdef on,
but there's really only a few #ifdef __x86_64__. So if it's
spaghetti, it's still dry, raw, straight and neatly lined up
in the package. :-)
As for naming, I suggested x86 myself. I think x86 for shared 32-bit/64-bit
code, is quite an established convention itself. It's what we already use
in gdbserver, and at least glibc and the Linux kernel use x86 for shared
code too. E.g.:
$ ls glibc/src/sysdeps/ | grep 86
i386
x86
x86_64
I'd _really_, _really_ love to see this go forward (really), and reduce
the amount of places one has to touch when hacking on watchpoint stuff.
and when adding new target descriptions, etc., from 3 places, to 2 places.
See https://sourceware.org/ml/gdb-patches/2014-06/msg00773.html for a patch
that just recently still had to touch 3 places with the same code.
And going forward, I'd like to reduce that to 1 place only, even.
Please take a look at the resulting code past patch #5, I believe you'll
be pleasantly surprised! :-)
--
Pedro Alves
next prev parent reply other threads:[~2014-06-27 10:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-27 9:10 Gary Benson
2014-06-27 9:10 ` [PATCH 4/7] Pull out common parts of _initialize_{i386,amd64}_linux_nat Gary Benson
2014-06-27 9:21 ` Mark Kettenis
2014-06-27 9:10 ` [PATCH 2/7] Merge {i386,amd64}_linux_read_description Gary Benson
2014-06-27 9:10 ` [PATCH 6/7] Move duplicated code into new files Gary Benson
2014-06-27 9:10 ` [PATCH 3/7] Merge ps_get_thread_area Gary Benson
2014-06-27 9:26 ` [PATCH 1/7] Rename identical functions Gary Benson
2014-06-27 9:26 ` [PATCH 5/7] Comment and whitespace changes Gary Benson
2014-06-27 9:28 ` [PATCH 0/7] Refactor shared code in {i386,amd64}-linux-nat.c Mark Kettenis
2014-06-27 10:39 ` Pedro Alves [this message]
2014-06-27 10:43 ` Pedro Alves
2014-06-27 10:54 ` Pedro Alves
2014-06-27 11:57 ` Gary Benson
2014-06-27 9:51 ` [PATCH 7/7] Tidy #include lists Gary Benson
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=53AD49F1.70709@redhat.com \
--to=palves@redhat.com \
--cc=gbenson@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
/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