From 239b6d10954b18ce089e9c3a667e7f2df3655476 Mon Sep 17 00:00:00 2001 From: Walfred Tedeschi Date: Fri, 27 Jan 2017 15:19:12 +0100 Subject: gdbserver-amd64: add HAVE_STRUCT_USER_REGS_STRUCT_(GS|FS)_BASE for gdbserver. The macros mentioned in the title were set only for GDB. In gdbserver they were not set until now. To align the code in GDB and gdbserver these macros are also added into gdbserver, enabling read and write of gs_base and fs_base registers from the system in new and old kernels. 2017-01-27 Walfred Tedeschi gdb/gdbserver/ChangeLog: * configure.ac: Check if the fs_base and gs_base members of `struct user_regs_struct' exist. * config.in: Regenerated. * configure: Likewise. --- gdb/gdbserver/ChangeLog | 7 +++++++ gdb/gdbserver/config.in | 6 ++++++ gdb/gdbserver/configure | 26 ++++++++++++++++++++++++++ gdb/gdbserver/configure.ac | 7 +++++++ 4 files changed, 46 insertions(+) (limited to 'gdb/gdbserver') diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index d3fba9b..79fe2f9 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,10 @@ +2017-01-27 Walfred Tedeschi + + * configure.ac: Check if the fs_base and gs_base members of + `struct user_regs_struct' exist. + * config.in: Regenerated. + * configure: Likewise. + 2017-01-09 Antoine Tremblay * linux-aarch32-low.c (arm_breakpoint_kind_from_pc): Use diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in index b721ea8..34a7443 100644 --- a/gdb/gdbserver/config.in +++ b/gdb/gdbserver/config.in @@ -238,6 +238,12 @@ /* Define to 1 if `struct stat' is a member of `st_blocks'. */ #undef HAVE_STRUCT_STAT_ST_BLOCKS +/* Define to 1 if `struct user_regs_struct' is a member of `fs_base'. */ +#undef HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE + +/* Define to 1 if `struct user_regs_struct' is a member of `gs_base'. */ +#undef HAVE_STRUCT_USER_REGS_STRUCT_GS_BASE + /* Define to 1 if the target supports __sync_*_compare_and_swap */ #undef HAVE_SYNC_BUILTINS diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure index 53c26f3..6ae4865 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -7498,6 +7498,32 @@ _ACEOF fi +# See if supports the %fs_base and %gs_base amd64 segment +# registers. Older amd64 Linux's don't have the fs_base and gs_base +# members of `struct user_regs_struct'. +ac_fn_c_check_member "$LINENO" "struct user_regs_struct" "fs_base" "ac_cv_member_struct_user_regs_struct_fs_base" "#include +" +if test "x$ac_cv_member_struct_user_regs_struct_fs_base" = x""yes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE 1 +_ACEOF + + +fi +ac_fn_c_check_member "$LINENO" "struct user_regs_struct" "gs_base" "ac_cv_member_struct_user_regs_struct_gs_base" "#include +" +if test "x$ac_cv_member_struct_user_regs_struct_gs_base" = x""yes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_USER_REGS_STRUCT_GS_BASE 1 +_ACEOF + + +fi + + + ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "#include #include diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac index d013c21..4ea7913 100644 --- a/gdb/gdbserver/configure.ac +++ b/gdb/gdbserver/configure.ac @@ -163,6 +163,13 @@ AC_CHECK_DECLS([strerror, perror, vasprintf, vsnprintf]) AC_CHECK_MEMBERS([struct stat.st_blocks, struct stat.st_blksize]) +# See if supports the %fs_base and %gs_bas amd64 segment registers. +# Older amd64 Linux's don't have the fs_base and gs_base members of +# `struct user_regs_struct'. +AC_CHECK_MEMBERS([struct user_regs_struct.fs_base, struct user_regs_struct.gs_base], + [], [], [#include ]) + + AC_CHECK_TYPES(socklen_t, [], [], [#include #include -- cgit v1.1