This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 08/13] btrace: move and rename btrace-common


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 @@
>  #endif
>  #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.

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]