Home | History | Annotate | Line # | Download | only in nat
      1      1.1  christos /* Low-level siginfo manipulation for amd64.
      2      1.1  christos 
      3  1.1.1.6  christos    Copyright (C) 2016-2024 Free Software Foundation, Inc.
      4      1.1  christos 
      5      1.1  christos    This file is part of GDB.
      6      1.1  christos 
      7      1.1  christos    This program is free software; you can redistribute it and/or modify
      8      1.1  christos    it under the terms of the GNU General Public License as published by
      9      1.1  christos    the Free Software Foundation; either version 3 of the License, or
     10      1.1  christos    (at your option) any later version.
     11      1.1  christos 
     12      1.1  christos    This program is distributed in the hope that it will be useful,
     13      1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     14      1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15      1.1  christos    GNU General Public License for more details.
     16      1.1  christos 
     17      1.1  christos    You should have received a copy of the GNU General Public License
     18      1.1  christos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
     19      1.1  christos 
     20  1.1.1.3  christos #ifndef NAT_AMD64_LINUX_SIGINFO_H
     21  1.1.1.3  christos #define NAT_AMD64_LINUX_SIGINFO_H
     22      1.1  christos 
     23  1.1.1.6  christos #include <signal.h>
     24  1.1.1.2  christos 
     25      1.1  christos /* When GDB is built as a 64-bit application on Linux, the
     26      1.1  christos    PTRACE_GETSIGINFO data is always presented in 64-bit layout.  Since
     27      1.1  christos    debugging a 32-bit inferior with a 64-bit GDB should look the same
     28      1.1  christos    as debugging it with a 32-bit GDB, we do the 32-bit <-> 64-bit
     29      1.1  christos    conversion in-place ourselves.
     30      1.1  christos    In other to make this conversion independent of the system where gdb
     31      1.1  christos    is compiled the most complete version of the siginfo, named as native
     32      1.1  christos    siginfo, is used internally as an intermediate step.
     33      1.1  christos 
     34      1.1  christos    Conversion using nat_siginfo is exemplified below:
     35      1.1  christos    compat_siginfo_from_siginfo or compat_x32_siginfo_from_siginfo
     36      1.1  christos 
     37      1.1  christos       buffer (from the kernel) -> nat_siginfo -> 32 / X32 siginfo
     38      1.1  christos 
     39      1.1  christos    siginfo_from_compat_x32_siginfo or siginfo_from_compat_siginfo
     40      1.1  christos 
     41      1.1  christos      32 / X32 siginfo -> nat_siginfo -> buffer (to the kernel)  */
     42      1.1  christos 
     43      1.1  christos 
     44      1.1  christos /* Kind of siginfo fixup to be performed.  */
     45      1.1  christos 
     46      1.1  christos enum amd64_siginfo_fixup_mode
     47      1.1  christos {
     48      1.1  christos   FIXUP_32 = 1,   /* Fixup for 32bit.  */
     49      1.1  christos   FIXUP_X32 = 2   /* Fixup for x32.  */
     50      1.1  christos };
     51      1.1  christos 
     52      1.1  christos /* Common code for performing the fixup of the siginfo.  */
     53      1.1  christos 
     54      1.1  christos int amd64_linux_siginfo_fixup_common (siginfo_t *native, gdb_byte *inf,
     55      1.1  christos 				      int direction,
     56      1.1  christos 				      enum amd64_siginfo_fixup_mode mode);
     57      1.1  christos 
     58  1.1.1.3  christos #endif /* NAT_AMD64_LINUX_SIGINFO_H */
     59