Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Mark Kettenis <mark.kettenis@xs4all.nl>, gdb-patches@sourceware.org
Subject: Re: [try 2nd, patch] Move common macros to i386-dbg-reg.h
Date: Thu, 14 Apr 2011 08:05:00 -0000	[thread overview]
Message-ID: <4DA6AAC1.7000802@codesourcery.com> (raw)
In-Reply-To: <20110413170500.GA11452@adacore.com>

On 04/14/2011 01:05 AM, Joel Brobecker wrote:
>> "a fully featured native GDB replacement or a lightweight remote
>> protocol stub" is *not* related to this patch at all.  I am unable to do
>> such choice.  This patch (and other patches of mine in this area) is to
>> reduce source code duplication as much as possible.  No matter what
>> model we choose for gdbserver, this patch still makes sense, IMO.
> 
> It does, but before we do so, I think it's important to know how
> we are going to reduce this duplication. I haven't looked at the patch,

In general, the "how" is reading the source code, and identifying the
duplication between gdb and gdbserver.  Once duplication is found, try
to move them to common/ dir.  Removing duplication in *-nat.c and
*-low.c is a low-hang-fruit at that moment, and much duplications are
from this.

There are also some duplications in proc_service, and we can fix them
without much effort.

Of course, regcache and event-loop may have some duplications, but my
first impression is that it is not easy to reduce duplications there.
That is the same case to tracepoint.c as well.  I am not familiar with
them, so have no idea.

> so I can't comment on it, but I think we just need a plan of what and
> how we're going to avoid that.
> 

I guess your last "that" means "duplication".  I was keeping my eyes on
how to _reduce_ duplication, instead of how to avoid.  Think of it
shortly, something comes up in my mind,
1.  When adding a new port, common code, such as macros, register name,
and accessing method can be moved to common/, and gdb/gdbserver code use
it respectively.
2.  When adding a new functionality/feature, evaluate whether this new
feature can be done in both gdb and gdbserver.  If yes, move common part
to common/ dir, otherwise, implement this new feature in either gdb or
gdbserver.

These two rules apply to most of development works, and should be
helpful on avoiding duplications to some extent.

Finally, I don't think duplication can be avoided completely, so we need
change/refactor code periodically or continuously, even sometimes
changes are painful. :)

-- 
Yao (齐尧)


  parent reply	other threads:[~2011-04-14  8:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-13  9:58 [patch] Move common macros to i386-common.h Yao Qi
2011-02-13 13:40 ` Mark Kettenis
2011-02-17  6:36   ` Yao Qi
2011-02-17  6:41     ` Joel Brobecker
2011-02-17 18:15       ` Jan Kratochvil
2011-02-23  5:36   ` Yao Qi
2011-02-23 21:35     ` Mark Kettenis
2011-02-24  4:32       ` Yao Qi
2011-02-24  5:11       ` Joel Brobecker
2011-02-28 18:12       ` Tom Tromey
2011-03-11  6:39 ` [try 2nd, patch] Move common macros to i386-dbg-reg.h Yao Qi
2011-03-29  7:54   ` Yao Qi
2011-04-07 14:07     ` Yao Qi
2011-04-07 15:54       ` Mark Kettenis
2011-04-11  2:01         ` Yao Qi
2011-04-13 17:05           ` Joel Brobecker
2011-04-13 18:48             ` Jan Kratochvil
2011-04-14  8:05             ` Yao Qi [this message]
2011-04-25 11:03             ` Yao Qi

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=4DA6AAC1.7000802@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=brobecker@adacore.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