diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-09-30 00:01:59 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-09-30 00:01:59 +0000 |
commit | 723b724b171ec32ce7005c43fc7da4f5206f7190 (patch) | |
tree | 04eaa67e175e0c9f5e4792ee1a42f25adccd571f /gdb | |
parent | 1f7c9b6179dac4d645d16a6f9f76a02008ab4ad9 (diff) | |
download | gdb-723b724b171ec32ce7005c43fc7da4f5206f7190.zip gdb-723b724b171ec32ce7005c43fc7da4f5206f7190.tar.gz gdb-723b724b171ec32ce7005c43fc7da4f5206f7190.tar.bz2 |
gdbserver: add support for FDPIC loadmaps
The DSBT support is very close to the FDPIC code, so extend the existing
loadmap support to work with FDPIC loadmaps too.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/common/linux-ptrace.h | 7 | ||||
-rw-r--r-- | gdb/gdbserver/ChangeLog | 13 | ||||
-rw-r--r-- | gdb/gdbserver/linux-low.c | 36 |
4 files changed, 50 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index afaaba1..49a6de1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2011-09-29 Mike Frysinger <vapier@gentoo.org> + + * common/linux-ptrace.h (PTRACE_GETFDPIC, PTRACE_GETFDPIC_EXEC, + PTRACE_GETFDPIC_INTERP): Define. + 2011-09-28 Yao Qi <yao@codesourcery.com> * symfile.c (add_symbol_file_command): Update message on usage. diff --git a/gdb/common/linux-ptrace.h b/gdb/common/linux-ptrace.h index ea4ee0d..841775e 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 + /* 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/ChangeLog b/gdb/gdbserver/ChangeLog index be5e5dd..abd8fbe 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,16 @@ +2011-09-29 Mike Frysinger <vapier@gentoo.org> + + * linux-low.c (target_loadseg): Add defined PTRACE_GETFDPIC to the + ifdef check. + [PT_GETDSBT] (target_loadmap): Wrap in a defined PT_GETDSBT check. + [!PT_GETDSBT] (target_loadmap): New definition. + (LINUX_LOADMAP, LINUX_LOADMAP_EXEC, LINUX_LOADMAP_INTERP): Define. + (linux_read_loadmap): Change PTRACE_GETDSBT_EXEC to + LINUX_LOADMAP_EXEC, PTRACE_GETDSBT_INTERP to LINUX_LOADMAP_INTERP, + and PT_GETDSBT to LINUX_LOADMAP. + [!PT_GETDSBT] (linux_read_loadmap): Define to NULL. + (linux_target_ops): Delete unnecessary ifdef PT_GETDSBT check. + 2011-09-21 Ulrich Weigand <ulrich.weigand@linaro.org> * linux-arm-low.c (struct arm_linux_hwbp_cap): Remove. 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 +struct target_loadmap +{ + /* Protocol version number, must be zero. */ + Elf32_Half version; + /* Number of segments in this map. */ + Elf32_Half nsegs; + /* The actual memory map. */ + struct target_loadseg segs[/*nsegs*/]; +}; +# define LINUX_LOADMAP PTRACE_GETFDPIC +# define LINUX_LOADMAP_EXEC PTRACE_GETFDPIC_EXEC +# define LINUX_LOADMAP_INTERP PTRACE_GETFDPIC_INTERP +# endif -#if defined PT_GETDSBT static int linux_read_loadmap (const char *annex, CORE_ADDR offset, unsigned char *myaddr, unsigned int len) @@ -4763,13 +4779,13 @@ linux_read_loadmap (const char *annex, CORE_ADDR offset, unsigned int actual_length, copy_length; if (strcmp (annex, "exec") == 0) - addr= (int) PTRACE_GETDSBT_EXEC; + addr = (int) LINUX_LOADMAP_EXEC; else if (strcmp (annex, "interp") == 0) - addr = (int) PTRACE_GETDSBT_INTERP; + addr = (int) LINUX_LOADMAP_INTERP; else return -1; - if (ptrace (PT_GETDSBT, pid, addr, &data) != 0) + if (ptrace (LINUX_LOADMAP, pid, addr, &data) != 0) return -1; if (data == NULL) @@ -4785,7 +4801,9 @@ linux_read_loadmap (const char *annex, CORE_ADDR offset, memcpy (myaddr, (char *) data + offset, copy_length); return copy_length; } -#endif /* defined PT_GETDSBT */ +#else +# define linux_read_loadmap NULL +#endif /* defined PT_GETDSBT || defined PTRACE_GETFDPIC */ static void linux_process_qsupported (const char *query) @@ -4935,11 +4953,7 @@ static struct target_ops linux_target_ops = { NULL, #endif linux_common_core_of_thread, -#if defined PT_GETDSBT linux_read_loadmap, -#else - NULL, -#endif linux_process_qsupported, linux_supports_tracepoints, linux_read_pc, |