aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2019-11-26 12:02:30 +0100
committerMarkus Metzger <markus.t.metzger@intel.com>2019-12-17 16:04:40 +0100
commitd26f3c10410841680a430fdac98a1ed8ddbf0315 (patch)
tree8b077678dcf18dc9bbf8089ef84930bd183b06fb
parentdb18e24c4999bb6e07d510011c5d37225de96f0b (diff)
downloadgdb-users/mmetzger/fsgs.zip
gdb-users/mmetzger/fsgs.tar.gz
gdb-users/mmetzger/fsgs.tar.bz2
[wip] gdbserver, x86: support fs_base and gs_baseusers/mmetzger/fsgs
When debugging over gdbserver fs/gs_base is not updated when changing the corresponding selector. For 32-bit inferiors, fs/gs_base are now defined but not fetched. Change-Id: I5a4d8637324ee5f0c303fdcc5eeb8ca50b96c577 Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
-rw-r--r--gdb/gdbserver/linux-x86-low.c2
-rw-r--r--gdb/gdbserver/linux-x86-tdesc.c16
2 files changed, 15 insertions, 3 deletions
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 54bd2a2..479cec0 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -133,7 +133,7 @@ static const int x86_64_regmap[] =
-1, -1, -1, -1, -1, -1, -1, -1,
ORIG_RAX * 8,
#ifdef HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE
- 21 * 8, 22 * 8,
+ FS_BASE * 8, GS_BASE * 8,
#else
-1, -1,
#endif
diff --git a/gdb/gdbserver/linux-x86-tdesc.c b/gdb/gdbserver/linux-x86-tdesc.c
index b39ed53..ab43ae5 100644
--- a/gdb/gdbserver/linux-x86-tdesc.c
+++ b/gdb/gdbserver/linux-x86-tdesc.c
@@ -87,7 +87,13 @@ i386_linux_read_description (uint64_t xcr0)
if (*tdesc == NULL)
{
- *tdesc = i386_create_target_description (xcr0, true, false);
+#ifdef HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE
+ const bool segment = true;
+#else
+ const bool segment = false;
+#endif
+
+ *tdesc = i386_create_target_description (xcr0, true, segment);
init_target_desc (*tdesc, i386_expedite_regs);
}
@@ -118,7 +124,13 @@ amd64_linux_read_description (uint64_t xcr0, bool is_x32)
if (*tdesc == NULL)
{
- *tdesc = amd64_create_target_description (xcr0, is_x32, true, true);
+#ifdef HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE
+ const bool segment = true;
+#else
+ const bool segment = false;
+#endif
+
+ *tdesc = amd64_create_target_description (xcr0, is_x32, true, segment);
init_target_desc (*tdesc, amd64_expedite_regs);
}