This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [common] Merge duplicated macros in linux-nat.c and linux-low.c
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 18 Feb 2011 09:24:20 +0100
- Subject: Re: [common] Merge duplicated macros in linux-nat.c and linux-low.c
- References: <4D5E2021.2070107@codesourcery.com>
Hi Yao,
On Fri, 18 Feb 2011 08:30:41 +0100, Yao Qi wrote:
> diff --git a/gdb/common/linux-common.h b/gdb/common/linux-common.h
> new file mode 100644
> index 0000000..8d54d51
> --- /dev/null
> +++ b/gdb/common/linux-common.h
> @@ -0,0 +1,60 @@
> +/* Copyright (C) 2011 Free Software Foundation, Inc.
> +
> + This file is part of GDB.
> +
> + This program is free software; you can redistribute it and/or modify
> + it under the terms of the GNU General Public License as published by
> + the Free Software Foundation; either version 3 of the License, or
> + (at your option) any later version.
> +
> + This program is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + GNU General Public License for more details.
> +
> + You should have received a copy of the GNU General Public License
> + along with this program. If not, see <http://www.gnu.org/licenses/>. */
> +
> +#include <sys/ptrace.h>
> +
> +#ifndef PTRACE_GETSIGINFO
> +# define PTRACE_GETSIGINFO 0x4202
> +# define PTRACE_SETSIGINFO 0x4203
> +#endif
There should be a wrapper:
#ifndef COMMON_LINUX_COMMON_H
#define COMMON_LINUX_COMMON_H
#endif /* COMMON_LINUX_COMMON_H */
> +/* options set using PTRACE_SETOPTIONS */
[nitpick] This comment formatting was better in linux-nat.c
> diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
> index 6635bc6..0891e06 100644
> --- a/gdb/gdbserver/linux-low.h
> +++ b/gdb/gdbserver/linux-low.h
> @@ -22,6 +22,7 @@
> #endif
>
> #include "gdb_proc_service.h"
> +#include "linux-common.h"
If you moved the definitions out of linux-low.c it is enough
to #include "linux-common.h" also just in linux-low.c.
> --- a/gdb/linux-nat.h
> +++ b/gdb/linux-nat.h
> @@ -19,7 +19,7 @@
> along with this program. If not, see <http://www.gnu.org/licenses/>. */
>
> #include "target.h"
> -
> +#include "linux-common.h"
> #include <signal.h>
>
> /* Structure describing an LWP. This is public only for the purposes
If you moved the definitions out of linux-nat.c it is enough
to #include "linux-common.h" also just in linux-nat.c.
It is fine with me with these changes although Pedro may want to approve the
gdbserver/ part.
Thanks,
Jan