This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH v2 08/13] btrace: move and rename btrace-common
- From: Pedro Alves <palves at redhat dot com>
- To: Markus Metzger <markus dot t dot metzger at intel dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 27 Jan 2015 11:16:44 +0000
- Subject: Re: [PATCH v2 08/13] btrace: move and rename btrace-common
- Authentication-results: sourceware.org; auth=none
- References: <1416480444-9943-1-git-send-email-markus dot t dot metzger at intel dot com> <1416480444-9943-9-git-send-email-markus dot t dot metzger at intel dot com>
On 11/20/2014 10:47 AM, Markus Metzger wrote:
> diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
> index ebacd96..4ed9837 100644
> --- a/gdb/gdbserver/server.c
> +++ b/gdb/gdbserver/server.c
> @@ -30,7 +30,7 @@
> #include "gdb_vecs.h"
> #include "gdb_wait.h"
> -#include "btrace-common.h"
> +#include "nat/x86-btrace.h"
> #include "filestuff.h"
> #include "tracepoint.h"
> #include "dll.h"
This still looks like layering violation this way.
server.c should not really have x86 specific bits either.
My original comment on v1 was:
>> diff --git a/gdb/common/btrace-common.c b/gdb/common/btrace-common.c
>> > index 90774a2..178ad35 100644
>> > --- a/gdb/common/btrace-common.c
>> > +++ b/gdb/common/btrace-common.c
>> > @@ -18,10 +18,47 @@
>> > along with this program. If not, see <http://www.gnu.org/licenses/>. */
>> > #include "btrace-common.h"
>> > +#include "nat/i386-cpuid.h"
> Hm, this is a layering violation.
> common/ files must not include nat/ files.
> If btrace-common.c is only used by native code, then it should
> itself be in nat/ too.
So, what does btrace-common.h actually contain that server.c needs?
"common" as a moniker doesn't really help much, as it doesn't
really indicate what the code is about. Is it just common
definitions that target-independent parts of gdb and/or gdbserver
use? How about something like leaving those parts in common/ (bonus
points of naming the file something more indicative or what is
contains), and then the native bits, like the x86 probing would
be put under nat/x86-btrace.h|c.