aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat/x86-linux.h
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2024-01-27 09:15:35 +0000
committerAndrew Burgess <aburgess@redhat.com>2024-03-25 17:14:18 +0000
commit01ed1674d4435aa4e194fd9373b7705e425ef354 (patch)
treebd2a84dd52f2e229f0438eae62a815fe0ab7114d /gdb/nat/x86-linux.h
parent5920765d7513aaae9241a1850d62d73e0477f81c (diff)
downloadgdb-01ed1674d4435aa4e194fd9373b7705e425ef354.zip
gdb-01ed1674d4435aa4e194fd9373b7705e425ef354.tar.gz
gdb-01ed1674d4435aa4e194fd9373b7705e425ef354.tar.bz2
gdb/x86: move reading of cs and ds state into gdb/nat directory
This patch is part of a series that has the aim of making the code that, for x86, reads the target description for a native process shared between GDB and gdbserver. Within GDB part of this process involves reading the cs and ds state from the 'struct user_regs_struct' using a ptrace call. This isn't done by gdbserver, which is part of the motivation for this whole series; the approach gdbserver takes is inferior to the approach GDB takes. This commit moves the reading of cs and ds, which is used to figure out if a thread is 32-bit or 64-bit (or in x32 mode), into the gdb/nat directory so that the code could be shared with gdbserver, but at this point I'm not actually using the code in gdbserver, that will come later. As such there should be no user visible changes after this commit, GDB continues to do things as it did before (reading cs/ds), while gdbserver continues to use its own approach (which doesn't require reading cs/ds). Approved-By: John Baldwin <jhb@FreeBSD.org>
Diffstat (limited to 'gdb/nat/x86-linux.h')
-rw-r--r--gdb/nat/x86-linux.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/gdb/nat/x86-linux.h b/gdb/nat/x86-linux.h
index 8228821..15153ea 100644
--- a/gdb/nat/x86-linux.h
+++ b/gdb/nat/x86-linux.h
@@ -47,4 +47,32 @@ extern void x86_linux_delete_thread (struct arch_lwp_info *arch_lwp);
extern void x86_linux_prepare_to_resume (struct lwp_info *lwp);
+/* Return value from x86_linux_ptrace_get_arch_size function. Indicates if
+ a thread is 32-bit, 64-bit, or x32. */
+
+struct x86_linux_arch_size
+{
+ explicit x86_linux_arch_size (bool is_64bit, bool is_x32)
+ : m_is_64bit (is_64bit),
+ m_is_x32 (is_x32)
+ {
+ /* Nothing. */
+ }
+
+ bool is_64bit () const
+ { return m_is_64bit; }
+
+ bool is_x32 () const
+ { return m_is_x32; }
+
+private:
+ bool m_is_64bit = false;
+ bool m_is_x32 = false;
+};
+
+/* Use ptrace calls to figure out if thread TID is 32-bit, 64-bit, or
+ 64-bit running in x32 mode. */
+
+extern x86_linux_arch_size x86_linux_ptrace_get_arch_size (int tid);
+
#endif /* NAT_X86_LINUX_H */