mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-23 18:14:13 +08:00
18d4886c00
The have_ptrace_getfpxregs global tracks whether GDB or gdbserver is running on a kernel that supports the GETFPXREGS ptrace request. Currently this global is declared twice (once in GDB and once in gdbserver), I think it makes sense to move this global into the nat/ directory, and have a single declaration and definition. While moving this variable I have converted it to a tribool, as that was what it really was, if even used the same numbering as the tribool enum (-1, 0, 1). Where have_ptrace_getfpxregs was used I have updated in the obvious way. However, while making this change I noticed what I think is a bug in x86_linux_nat_target::read_description and x86_linux_read_description, both of these functions can be called multiple times, but in both cases we only end up calling i386_linux_read_description the first time through in the event that PTRACE_GETFPXREGS is not supported. This is because initially have_ptrace_getfpxregs will be TRIBOOL_UNKNOWN, but after the ptrace call fails we set have_ptrace_getfpxregs to TRIBOOL_FALSE. The next time we attempt to read the target description we'll skip the ptrace call, and so skip the call to i386_linux_read_description. I've not tried to address this preexisting bug in this commit, this is purely a refactor, there should be no user visible changes after this commit. In later commits I'll merge the gdbserver and GDB code together into the nat/ directory, and after that I'll try to address this bug. Reviewed-By: Felix Willgerodt <felix.willgerodt@intel.com>
38 lines
1.5 KiB
C
38 lines
1.5 KiB
C
/* Native-dependent code for GNU/Linux i386.
|
|
|
|
Copyright (C) 2024 Free Software Foundation, Inc.
|
|
|
|
This file is part of GDB.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
#ifndef NAT_I386_LINUX_H
|
|
#define NAT_I386_LINUX_H
|
|
|
|
/* Does the current host support the GETFPXREGS request? The system header
|
|
file may or may not define it, but even if it is defined, the kernel
|
|
will return EIO if it's running on a pre-SSE processor.
|
|
|
|
Initially this will be TRIBOOL_UNKNOWN and should be changed to
|
|
TRIBOOL_FALSE if the ptrace call is attempted and fails or changed to
|
|
TRIBOOL_TRUE if the ptrace call is attempted and succeeds.
|
|
|
|
My instinct is to attach this to some architecture- or target-specific
|
|
data structure, but really, a particular GDB process can only run on top
|
|
of one kernel at a time. So it's okay - for this to be a global
|
|
variable. */
|
|
extern tribool have_ptrace_getfpxregs;
|
|
|
|
#endif /* NAT_I386_LINUX_H */
|