GDB (xrefs)

Macros | Functions | Variables
/tmp/gdb-8.1/gdb/i386-linux-nat.c File Reference
`#include "defs.h"`
`#include "inferior.h"`
`#include "gdbcore.h"`
`#include "regcache.h"`
`#include "elf/common.h"`
`#include "nat/gdb_ptrace.h"`
`#include <sys/uio.h>`
`#include "gregset.h"`
`#include "gdb_proc_service.h"`
`#include "i386-linux-nat.h"`
`#include "i387-tdep.h"`
`#include "i386-tdep.h"`
`#include "i386-linux-tdep.h"`
`#include "x86-xstate.h"`
`#include "linux-nat.h"`
`#include "x86-linux-nat.h"`
`#include "nat/linux-ptrace.h"`
`#include "inf-ptrace.h"`

Go to the source code of this file.

## Macros
#define | GETREGS_SUPPLIES(regno) ((0 <= (regno) && (regno) <= 15) || (regno) == I386_LINUX_ORIG_EAX_REGNUM)
#define | GETFPXREGS_SUPPLIES(regno) (I386_ST0_REGNUM <= (regno) && (regno) < I386_SSE_NUM_REGS)
#define | GETXSTATEREGS_SUPPLIES(regno) (I386_ST0_REGNUM <= (regno) && (regno) < I386_PKEYS_NUM_REGS)
#define | LINUX_SYSCALL_LEN (sizeof linux_syscall)
#define | LINUX_SYSCALL_REGNUM I386_EAX_REGNUM
#define | SYS_sigreturn 0x77
#define | SYS_rt_sigreturn 0xad
#define | LINUX_SIGCONTEXT_EFLAGS_OFFSET (64)

## Functions
static void | fetch_register (struct regcache *regcache, int regno)
static void | store_register (const struct regcache *regcache, int regno)
void | supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
void | fill_gregset (const struct regcache *regcache, elf_gregset_t *gregsetp, int regno)
static void | fetch_regs (struct regcache *regcache, int tid)
static void | store_regs (const struct regcache *regcache, int tid, int regno)
void | supply_fpregset (struct regcache *regcache, const elf_fpregset_t *fpregsetp)
void | fill_fpregset (const struct regcache *regcache, elf_fpregset_t *fpregsetp, int regno)
static void | fetch_fpregs (struct regcache *regcache, int tid)
static void | store_fpregs (const struct regcache *regcache, int tid, int regno)
static int | fetch_xstateregs (struct regcache *regcache, int tid)
static int | store_xstateregs (const struct regcache *regcache, int tid, int regno)
static int | fetch_fpxregs (struct regcache *regcache, int tid)
static int | store_fpxregs (const struct regcache *regcache, int tid, int regno)
static void | i386_linux_fetch_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regno)
static void | i386_linux_store_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regno)
ps_err_e | ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base)
static void | i386_linux_resume (struct target_ops *ops, ptid_t ptid, int step, enum gdb_signal signal)
void | _initialize_i386_linux_nat (void)

## Variables
int | have_ptrace_getregs
int | have_ptrace_getfpxregs
static const unsigned char | linux_syscall [] = { 0xcd, 0x80 }

## Macro Definition Documentation

## ◆ GETFPXREGS_SUPPLIES

#define GETFPXREGS_SUPPLIES | ( |  | regno | ) | (I386_ST0_REGNUM <= (regno) && (regno) < I386_SSE_NUM_REGS)

Definition at line 59 of file i386-linux-nat.c.

Referenced by i386_linux_fetch_inferior_registers(), and i386_linux_store_inferior_registers().

## ◆ GETREGS_SUPPLIES

#define GETREGS_SUPPLIES | ( |  | regno | ) | ((0 <= (regno) && (regno) <= 15) || (regno) == I386_LINUX_ORIG_EAX_REGNUM)

Definition at line 56 of file i386-linux-nat.c.

Referenced by i386_linux_fetch_inferior_registers(), and i386_linux_store_inferior_registers().

## ◆ GETXSTATEREGS_SUPPLIES

#define GETXSTATEREGS_SUPPLIES | ( |  | regno | ) | (I386_ST0_REGNUM <= (regno) && (regno) < I386_PKEYS_NUM_REGS)

Definition at line 62 of file i386-linux-nat.c.

Referenced by i386_linux_fetch_inferior_registers(), and i386_linux_store_inferior_registers().

## ◆ LINUX_SIGCONTEXT_EFLAGS_OFFSET

#define LINUX_SIGCONTEXT_EFLAGS_OFFSET (64)

Definition at line 632 of file i386-linux-nat.c.

Referenced by i386_linux_resume().

## ◆ LINUX_SYSCALL_LEN

#define LINUX_SYSCALL_LEN (sizeof linux_syscall)

Definition at line 616 of file i386-linux-nat.c.

Referenced by i386_linux_resume().

## ◆ LINUX_SYSCALL_REGNUM

#define LINUX_SYSCALL_REGNUM I386_EAX_REGNUM

Definition at line 619 of file i386-linux-nat.c.

Referenced by i386_linux_resume().

## ◆ SYS_rt_sigreturn

#define SYS_rt_sigreturn 0xad

Definition at line 628 of file i386-linux-nat.c.

Referenced by i386_linux_resume().

## ◆ SYS_sigreturn

#define SYS_sigreturn 0x77

Definition at line 625 of file i386-linux-nat.c.

Referenced by i386_linux_resume().

## Function Documentation

## ◆ _initialize_i386_linux_nat()

void _initialize_i386_linux_nat | ( | void |  | ) |

Definition at line 707 of file i386-linux-nat.c.

References i386_linux_fetch_inferior_registers(), i386_linux_resume(), i386_linux_store_inferior_registers(), target_ops::to_fetch_registers, target_ops::to_resume, target_ops::to_store_registers, x86_linux_add_target(), and x86_linux_create_target().

## ◆ fetch_fpregs()

static void fetch_fpregs | ( | struct regcache * | regcache,
|  | int | tid
| ) |  |
| static

Definition at line 271 of file i386-linux-nat.c.

References _, perror_with_name(), ptrace(), PTRACE_GETFPREGS, supply_fpregset(), and selftests::ptid::tid.

Referenced by i386_linux_fetch_inferior_registers().

## ◆ fetch_fpxregs()

static int fetch_fpxregs | ( | struct regcache * | regcache,
|  | int | tid
| ) |  |
| static

Definition at line 373 of file i386-linux-nat.c.

References _, have_ptrace_getfpxregs, i387_supply_fxsave(), perror_with_name(), ptrace(), and selftests::ptid::tid.

Referenced by i386_linux_fetch_inferior_registers().

## ◆ fetch_register()

static void fetch_register | ( | struct regcache * | regcache,
|  | int | regno
| ) |  |
| static

Definition at line 96 of file i386-linux-nat.c.

References _, regcache::arch(), error(), gdb_assert, gdbarch_register_name(), get_ptrace_pid(), have_ptrace_getregs, i386_linux_gregset_reg_offset, ptrace(), regcache_get_ptid(), regcache_raw_supply(), safe_strerror(), and selftests::ptid::tid.

Referenced by i386_linux_fetch_inferior_registers().

## ◆ fetch_regs()

static void fetch_regs | ( | struct regcache * | regcache,
|  | int | tid
| ) |  |
| static

Definition at line 197 of file i386-linux-nat.c.

References _, have_ptrace_getregs, perror_with_name(), ptrace(), PTRACE_GETREGS, gdbarch_tdep::regs, supply_gregset(), and selftests::ptid::tid.

Referenced by i386_linux_fetch_inferior_registers().

## ◆ fetch_xstateregs()

static int fetch_xstateregs | ( | struct regcache * | regcache,
|  | int | tid
| ) |  |
| static

Definition at line 320 of file i386-linux-nat.c.

References _, have_ptrace_getregset, i387_supply_xsave(), perror_with_name(), ptrace(), PTRACE_GETREGSET, selftests::ptid::tid, TRIBOOL_TRUE, and X86_XSTATE_MAX_SIZE.

Referenced by i386_linux_fetch_inferior_registers().

## ◆ fill_fpregset()

void fill_fpregset | ( | const struct regcache * | regcache,
|  | elf_fpregset_t * | fpregsetp,
|  | int | regno
| ) |  |

Definition at line 259 of file i386-linux-nat.c.

References i387_collect_fsave().

Referenced by store_fpregs().

## ◆ fill_gregset()

void fill_gregset | ( | const struct regcache * | regcache,
|  | elf_gregset_t * | gregsetp,
|  | int | regno
| ) |  |

Definition at line 173 of file i386-linux-nat.c.

References regcache::arch(), gdbarch_num_regs(), i386_linux_gregset_reg_offset, I386_LINUX_ORIG_EAX_REGNUM, I386_NUM_GREGS, and regcache_raw_collect().

Referenced by store_regs().

## ◆ i386_linux_fetch_inferior_registers()

static void i386_linux_fetch_inferior_registers | ( | struct target_ops * | ops,
|  | struct regcache * | regcache,
|  | int | regno
| ) |  |
| static

Definition at line 450 of file i386-linux-nat.c.

References _, regcache::arch(), fetch_fpregs(), fetch_fpxregs(), fetch_register(), fetch_regs(), fetch_xstateregs(), gdbarch_num_regs(), get_ptrace_pid(), GETFPXREGS_SUPPLIES, GETREGS_SUPPLIES, GETXSTATEREGS_SUPPLIES, have_ptrace_getregs, internal_error(), regcache_get_ptid(), and selftests::ptid::tid.

Referenced by _initialize_i386_linux_nat().

## ◆ i386_linux_resume()

static void i386_linux_resume | ( | struct target_ops * | ops,
|  | ptid_t | ptid,
|  | int | step,
|  | enum gdb_signal | signal
| ) |  |
| static

Definition at line 639 of file i386-linux-nat.c.

References regcache::arch(), gdbarch::byte_order, catch_syscall_enabled(), gdb_signal_to_host(), gdbarch_byte_order(), gdbarch_pc_regnum(), get_thread_regcache(), I386_ESP_REGNUM, LINUX_SIGCONTEXT_EFLAGS_OFFSET, linux_syscall, LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, perror_with_name(), pid, regcache::ptid(), ptid_get_lwp(), ptrace(), read_memory(), read_memory_unsigned_integer(), regcache_cooked_read_unsigned(), SYS_rt_sigreturn, SYS_sigreturn, target_read_memory(), and write_memory().

Referenced by _initialize_i386_linux_nat().

## ◆ i386_linux_store_inferior_registers()

static void i386_linux_store_inferior_registers | ( | struct target_ops * | ops,
|  | struct regcache * | regcache,
|  | int | regno
| ) |  |
| static

Definition at line 528 of file i386-linux-nat.c.

References _, regcache::arch(), gdbarch_num_regs(), get_ptrace_pid(), GETFPXREGS_SUPPLIES, GETREGS_SUPPLIES, GETXSTATEREGS_SUPPLIES, have_ptrace_getregs, internal_error(), regcache_get_ptid(), store_fpregs(), store_fpxregs(), store_register(), store_regs(), store_xstateregs(), and selftests::ptid::tid.

Referenced by _initialize_i386_linux_nat().

## ◆ ps_get_thread_area()

ps_err_e ps_get_thread_area | ( | struct ps_prochandle * | ph,
|  | lwpid_t | lwpid,
|  | int | idx,
|  | void ** | base
| ) |  |

Definition at line 595 of file i386-linux-nat.c.

References PS_OK, and x86_linux_get_thread_area().

## ◆ store_fpregs()

static void store_fpregs | ( | const struct regcache * | regcache,
|  | int | tid,
|  | int | regno
| ) |  |
| static

Definition at line 285 of file i386-linux-nat.c.

References _, fill_fpregset(), perror_with_name(), ptrace(), PTRACE_GETFPREGS, PTRACE_SETFPREGS, and selftests::ptid::tid.

Referenced by i386_linux_store_inferior_registers().

## ◆ store_fpxregs()

static int store_fpxregs | ( | const struct regcache * | regcache,
|  | int | tid,
|  | int | regno
| ) |  |
| static

Definition at line 400 of file i386-linux-nat.c.

References _, have_ptrace_getfpxregs, i387_collect_fxsave(), perror_with_name(), ptrace(), and selftests::ptid::tid.

Referenced by i386_linux_store_inferior_registers().

## ◆ store_register()

static void store_register | ( | const struct regcache * | regcache,
|  | int | regno
| ) |  |
| static

Definition at line 124 of file i386-linux-nat.c.

References _, regcache::arch(), error(), gdb_assert, gdbarch_register_name(), get_ptrace_pid(), have_ptrace_getregs, i386_linux_gregset_reg_offset, ptrace(), regcache_get_ptid(), regcache_raw_collect(), safe_strerror(), and selftests::ptid::tid.

Referenced by i386_linux_store_inferior_registers().

## ◆ store_regs()

static void store_regs | ( | const struct regcache * | regcache,
|  | int | tid,
|  | int | regno
| ) |  |
| static

Definition at line 222 of file i386-linux-nat.c.

References _, fill_gregset(), perror_with_name(), ptrace(), PTRACE_GETREGS, PTRACE_SETREGS, gdbarch_tdep::regs, and selftests::ptid::tid.

Referenced by i386_linux_store_inferior_registers().

## ◆ store_xstateregs()

static int store_xstateregs | ( | const struct regcache * | regcache,
|  | int | tid,
|  | int | regno
| ) |  |
| static

Definition at line 343 of file i386-linux-nat.c.

References _, have_ptrace_getregset, i387_collect_xsave(), perror_with_name(), ptrace(), PTRACE_GETREGSET, PTRACE_SETREGSET, selftests::ptid::tid, TRIBOOL_TRUE, and X86_XSTATE_MAX_SIZE.

Referenced by i386_linux_store_inferior_registers().

## ◆ supply_fpregset()

void supply_fpregset | ( | struct regcache * | regcache,
|  | const elf_fpregset_t * | fpregsetp
| ) |  |

Definition at line 249 of file i386-linux-nat.c.

References i387_supply_fsave().

Referenced by fetch_fpregs().

## ◆ supply_gregset()

void supply_gregset | ( | struct regcache * | regcache,
|  | const elf_gregset_t * | gregsetp
| ) |  |

Definition at line 153 of file i386-linux-nat.c.

References regcache::arch(), gdbarch_num_regs(), i386_linux_gregset_reg_offset, I386_LINUX_ORIG_EAX_REGNUM, I386_NUM_GREGS, and regcache_raw_supply().

Referenced by fetch_regs().

## Variable Documentation

## ◆ have_ptrace_getfpxregs

int have_ptrace_getfpxregs

Initial value:
=
-1

Definition at line 82 of file i386-linux-nat.c.

Referenced by fetch_fpxregs(), store_fpxregs(), and x86_linux_read_description().

## ◆ have_ptrace_getregs

int have_ptrace_getregs

Initial value:
=
1

Definition at line 66 of file i386-linux-nat.c.

Referenced by fetch_register(), fetch_regs(), i386_linux_fetch_inferior_registers(), i386_linux_store_inferior_registers(), and store_register().

## ◆ linux_syscall

const unsigned char linux_syscall[] = { 0xcd, 0x80 }
| static

Definition at line 614 of file i386-linux-nat.c.

Referenced by i386_linux_resume().