This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdbserver: add support for FDPIC loadmaps
- From: Yao Qi <yao at codesourcery dot com>
- To: Mike Frysinger <vapier at gentoo dot org>
- Cc: gdb-patches at sourceware dot org, toolchain-devel at blackfin dot uclinux dot org
- Date: Thu, 29 Sep 2011 16:53:39 +0800
- Subject: Re: [PATCH] gdbserver: add support for FDPIC loadmaps
- References: <1317268705-29948-1-git-send-email-vapier@gentoo.org>
On 09/29/2011 11:58 AM, Mike Frysinger wrote:
> The DSBT support is very close to the FDPIC code, so extend the existing
> loadmap support to work with FDPIC loadmaps too.
>
Mike, patch looks quite good.
> ---
> gdb/common/linux-ptrace.h | 7 +++++++
> gdb/gdbserver/linux-low.c | 36 +++++++++++++++++++++++++-----------
> 2 files changed, 32 insertions(+), 11 deletions(-)
>
> diff --git a/gdb/common/linux-ptrace.h b/gdb/common/linux-ptrace.h
> index ea4ee0d..0f30430 100644
> --- a/gdb/common/linux-ptrace.h
> +++ b/gdb/common/linux-ptrace.h
> @@ -51,6 +51,13 @@
>
> #endif /* PTRACE_EVENT_FORK */
>
> +#if (defined __bfin__ || defined __frv__ || defined __sh__) && \
> + !defined PTRACE_GETFDPIC
> +#define PTRACE_GETFDPIC 31
> +#define PTRACE_GETFDPIC_EXEC 0
> +#define PTRACE_GETFDPIC_INTERP 1
> +#endif
> +
Do you have some reasons to define these macros in common/? I don't see
these macros are/will be used in GDB, so maybe, we can move them in
gdbserver. Files in common/ are to have contents shared between gdb and
gdbserver.
> /* We can't always assume that this flag is available, but all systems
> with the ptrace event handlers also have __WALL, so it's safe to use
> in some contexts. */
> diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
> index 94f785c..5dfa59a 100644
> --- a/gdb/gdbserver/linux-low.c
> +++ b/gdb/gdbserver/linux-low.c
> @@ -4727,7 +4727,7 @@ linux_qxfer_spu (const char *annex, unsigned char *readbuf,
> return ret;
> }
>
> -#if defined PT_GETDSBT
> +#if defined PT_GETDSBT || defined PTRACE_GETFDPIC
> struct target_loadseg
> {
> /* Core address to which the segment is mapped. */
> @@ -4738,6 +4738,7 @@ struct target_loadseg
> Elf32_Word p_memsz;
> };
>
> +# if defined PT_GETDSBT
> struct target_loadmap
> {
> /* Protocol version number, must be zero. */
> @@ -4750,9 +4751,24 @@ struct target_loadmap
> /* The actual memory map. */
> struct target_loadseg segs[/*nsegs*/];
> };
> -#endif
> +# define LINUX_LOADMAP PT_GETDSBT
> +# define LINUX_LOADMAP_EXEC PTRACE_GETDSBT_EXEC
> +# define LINUX_LOADMAP_INTERP PTRACE_GETDSBT_INTERP
> +# else
The spaces between '#' and 'define' are not needed.
The changes related to dsbt look correct to me. I applied this patch to
trunk, and build c6x-uclinux gdb and gdbserver. I didn't run test
because the board is in use.
--
Yao (éå)