GDB (xrefs)
/tmp/gdb-8.1/gdb/i386-linux-nat.c
Go to the documentation of this file.
1 /* Native-dependent code for GNU/Linux i386.
2 
3  Copyright (C) 1999-2018 Free Software Foundation, Inc.
4 
5  This file is part of GDB.
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 
20 #include "defs.h"
21 #include "inferior.h"
22 #include "gdbcore.h"
23 #include "regcache.h"
24 #include "elf/common.h"
25 #include "nat/gdb_ptrace.h"
26 #include <sys/uio.h>
27 #include "gregset.h"
28 #include "gdb_proc_service.h"
29 
30 #include "i386-linux-nat.h"
31 #include "i387-tdep.h"
32 #include "i386-tdep.h"
33 #include "i386-linux-tdep.h"
34 #include "x86-xstate.h"
35 
36 #include "linux-nat.h"
37 #include "x86-linux-nat.h"
38 #include "nat/linux-ptrace.h"
39 #include "inf-ptrace.h"
40 
41 /* The register sets used in GNU/Linux ELF core-dumps are identical to
42  the register sets in `struct user' that is used for a.out
43  core-dumps, and is also used by `ptrace'. The corresponding types
44  are `elf_gregset_t' for the general-purpose registers (with
45  `elf_greg_t' the type of a single GP register) and `elf_fpregset_t'
46  for the floating-point registers.
47 
48  Those types used to be available under the names `gregset_t' and
49  `fpregset_t' too, and this file used those names in the past. But
50  those names are now used for the register sets used in the
51  `mcontext_t' type, and have a different size and layout. */
52 
53 /* Which ptrace request retrieves which registers?
54  These apply to the corresponding SET requests as well. */
55 
56 #define GETREGS_SUPPLIES(regno) \
57  ((0 <= (regno) && (regno) <= 15) || (regno) == I386_LINUX_ORIG_EAX_REGNUM)
58 
59 #define GETFPXREGS_SUPPLIES(regno) \
60  (I386_ST0_REGNUM <= (regno) && (regno) < I386_SSE_NUM_REGS)
61 
62 #define GETXSTATEREGS_SUPPLIES(regno) \
63  (I386_ST0_REGNUM <= (regno) && (regno) < I386_PKEYS_NUM_REGS)
64 
65 /* Does the current host support the GETREGS request? */
67 #ifdef HAVE_PTRACE_GETREGS
68  1
69 #else
70  0
71 #endif
72 ;
73 
74 /* Does the current host support the GETFPXREGS request? The header
75  file may or may not define it, and even if it is defined, the
76  kernel will return EIO if it's running on a pre-SSE processor.
77 
78  My instinct is to attach this to some architecture- or
79  target-specific data structure, but really, a particular GDB
80  process can only run on top of one kernel at a time. So it's okay
81  for this to be a simple variable. */
83 #ifdef HAVE_PTRACE_GETFPXREGS
84  -1
85 #else
86  0
87 #endif
88 ;
89 
90 
91 /* Accessing registers through the U area, one at a time. */
92 
93 /* Fetch one register. */
94 
95 static void
96 fetch_register (struct regcache *regcache, int regno)
97 {
98  pid_t tid;
99  int val;
100 
102  if (i386_linux_gregset_reg_offset[regno] == -1)
103  {
104  regcache_raw_supply (regcache, regno, NULL);
105  return;
106  }
107 
109 
110  errno = 0;
111  val = ptrace (PTRACE_PEEKUSER, tid,
113  if (errno != 0)
114  error (_("Couldn't read register %s (#%d): %s."),
115  gdbarch_register_name (regcache->arch (), regno),
116  regno, safe_strerror (errno));
117 
118  regcache_raw_supply (regcache, regno, &val);
119 }
120 
121 /* Store one register. */
122 
123 static void
124 store_register (const struct regcache *regcache, int regno)
125 {
126  pid_t tid;
127  int val;
128 
130  if (i386_linux_gregset_reg_offset[regno] == -1)
131  return;
132 
134 
135  errno = 0;
136  regcache_raw_collect (regcache, regno, &val);
137  ptrace (PTRACE_POKEUSER, tid,
138  i386_linux_gregset_reg_offset[regno], val);
139  if (errno != 0)
140  error (_("Couldn't write register %s (#%d): %s."),
141  gdbarch_register_name (regcache->arch (), regno),
142  regno, safe_strerror (errno));
143 }
144 
145 
146 /* Transfering the general-purpose registers between GDB, inferiors
147  and core files. */
148 
149 /* Fill GDB's register array with the general-purpose register values
150  in *GREGSETP. */
151 
152 void
153 supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
154 {
155  const gdb_byte *regp = (const gdb_byte *) gregsetp;
156  int i;
157 
158  for (i = 0; i < I386_NUM_GREGS; i++)
161 
166 }
167 
168 /* Fill register REGNO (if it is a general-purpose register) in
169  *GREGSETPS with the value in GDB's register array. If REGNO is -1,
170  do this for all registers. */
171 
172 void
174  elf_gregset_t *gregsetp, int regno)
175 {
176  gdb_byte *regp = (gdb_byte *) gregsetp;
177  int i;
178 
179  for (i = 0; i < I386_NUM_GREGS; i++)
180  if (regno == -1 || regno == i)
183 
184  if ((regno == -1 || regno == I386_LINUX_ORIG_EAX_REGNUM)
189 }
190 
191 #ifdef HAVE_PTRACE_GETREGS
192 
193 /* Fetch all general-purpose registers from process/thread TID and
194  store their values in GDB's register array. */
195 
196 static void
198 {
199  elf_gregset_t regs;
200  elf_gregset_t *regs_p = &regs;
201 
202  if (ptrace (PTRACE_GETREGS, tid, 0, (int) &regs) < 0)
203  {
204  if (errno == EIO)
205  {
206  /* The kernel we're running on doesn't support the GETREGS
207  request. Reset `have_ptrace_getregs'. */
209  return;
210  }
211 
212  perror_with_name (_("Couldn't get registers"));
213  }
214 
215  supply_gregset (regcache, (const elf_gregset_t *) regs_p);
216 }
217 
218 /* Store all valid general-purpose registers in GDB's register array
219  into the process/thread specified by TID. */
220 
221 static void
222 store_regs (const struct regcache *regcache, int tid, int regno)
223 {
224  elf_gregset_t regs;
225 
226  if (ptrace (PTRACE_GETREGS, tid, 0, (int) &regs) < 0)
227  perror_with_name (_("Couldn't get registers"));
228 
229  fill_gregset (regcache, &regs, regno);
230 
231  if (ptrace (PTRACE_SETREGS, tid, 0, (int) &regs) < 0)
232  perror_with_name (_("Couldn't write registers"));
233 }
234 
235 #else
236 
237 static void fetch_regs (struct regcache *regcache, int tid) {}
238 static void store_regs (const struct regcache *regcache, int tid, int regno) {}
239 
240 #endif
241 
242 
243 /* Transfering floating-point registers between GDB, inferiors and cores. */
244 
245 /* Fill GDB's register array with the floating-point register values in
246  *FPREGSETP. */
247 
248 void
249 supply_fpregset (struct regcache *regcache, const elf_fpregset_t *fpregsetp)
250 {
251  i387_supply_fsave (regcache, -1, fpregsetp);
252 }
253 
254 /* Fill register REGNO (if it is a floating-point register) in
255  *FPREGSETP with the value in GDB's register array. If REGNO is -1,
256  do this for all registers. */
257 
258 void
260  elf_fpregset_t *fpregsetp, int regno)
261 {
262  i387_collect_fsave (regcache, regno, fpregsetp);
263 }
264 
265 #ifdef HAVE_PTRACE_GETREGS
266 
267 /* Fetch all floating-point registers from process/thread TID and store
268  thier values in GDB's register array. */
269 
270 static void
272 {
273  elf_fpregset_t fpregs;
274 
275  if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
276  perror_with_name (_("Couldn't get floating point status"));
277 
278  supply_fpregset (regcache, (const elf_fpregset_t *) &fpregs);
279 }
280 
281 /* Store all valid floating-point registers in GDB's register array
282  into the process/thread specified by TID. */
283 
284 static void
285 store_fpregs (const struct regcache *regcache, int tid, int regno)
286 {
287  elf_fpregset_t fpregs;
288 
289  if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
290  perror_with_name (_("Couldn't get floating point status"));
291 
292  fill_fpregset (regcache, &fpregs, regno);
293 
294  if (ptrace (PTRACE_SETFPREGS, tid, 0, (int) &fpregs) < 0)
295  perror_with_name (_("Couldn't write floating point status"));
296 }
297 
298 #else
299 
300 static void
301 fetch_fpregs (struct regcache *regcache, int tid)
302 {
303 }
304 
305 static void
306 store_fpregs (const struct regcache *regcache, int tid, int regno)
307 {
308 }
309 
310 #endif
311 
312 
313 /* Transfering floating-point and SSE registers to and from GDB. */
314 
315 /* Fetch all registers covered by the PTRACE_GETREGSET request from
316  process/thread TID and store their values in GDB's register array.
317  Return non-zero if successful, zero otherwise. */
318 
319 static int
321 {
322  char xstateregs[X86_XSTATE_MAX_SIZE];
323  struct iovec iov;
324 
326  return 0;
327 
328  iov.iov_base = xstateregs;
329  iov.iov_len = sizeof(xstateregs);
330  if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE,
331  &iov) < 0)
332  perror_with_name (_("Couldn't read extended state status"));
333 
334  i387_supply_xsave (regcache, -1, xstateregs);
335  return 1;
336 }
337 
338 /* Store all valid registers in GDB's register array covered by the
339  PTRACE_SETREGSET request into the process/thread specified by TID.
340  Return non-zero if successful, zero otherwise. */
341 
342 static int
343 store_xstateregs (const struct regcache *regcache, int tid, int regno)
344 {
345  char xstateregs[X86_XSTATE_MAX_SIZE];
346  struct iovec iov;
347 
349  return 0;
350 
351  iov.iov_base = xstateregs;
352  iov.iov_len = sizeof(xstateregs);
353  if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE,
354  &iov) < 0)
355  perror_with_name (_("Couldn't read extended state status"));
356 
357  i387_collect_xsave (regcache, regno, xstateregs, 0);
358 
359  if (ptrace (PTRACE_SETREGSET, tid, (unsigned int) NT_X86_XSTATE,
360  (int) &iov) < 0)
361  perror_with_name (_("Couldn't write extended state status"));
362 
363  return 1;
364 }
365 
366 #ifdef HAVE_PTRACE_GETFPXREGS
367 
368 /* Fetch all registers covered by the PTRACE_GETFPXREGS request from
369  process/thread TID and store their values in GDB's register array.
370  Return non-zero if successful, zero otherwise. */
371 
372 static int
374 {
375  elf_fpxregset_t fpxregs;
376 
378  return 0;
379 
380  if (ptrace (PTRACE_GETFPXREGS, tid, 0, (int) &fpxregs) < 0)
381  {
382  if (errno == EIO)
383  {
385  return 0;
386  }
387 
388  perror_with_name (_("Couldn't read floating-point and SSE registers"));
389  }
390 
391  i387_supply_fxsave (regcache, -1, (const elf_fpxregset_t *) &fpxregs);
392  return 1;
393 }
394 
395 /* Store all valid registers in GDB's register array covered by the
396  PTRACE_SETFPXREGS request into the process/thread specified by TID.
397  Return non-zero if successful, zero otherwise. */
398 
399 static int
400 store_fpxregs (const struct regcache *regcache, int tid, int regno)
401 {
402  elf_fpxregset_t fpxregs;
403 
405  return 0;
406 
407  if (ptrace (PTRACE_GETFPXREGS, tid, 0, &fpxregs) == -1)
408  {
409  if (errno == EIO)
410  {
412  return 0;
413  }
414 
415  perror_with_name (_("Couldn't read floating-point and SSE registers"));
416  }
417 
418  i387_collect_fxsave (regcache, regno, &fpxregs);
419 
420  if (ptrace (PTRACE_SETFPXREGS, tid, 0, &fpxregs) == -1)
421  perror_with_name (_("Couldn't write floating-point and SSE registers"));
422 
423  return 1;
424 }
425 
426 #else
427 
428 static int
429 fetch_fpxregs (struct regcache *regcache, int tid)
430 {
431  return 0;
432 }
433 
434 static int
435 store_fpxregs (const struct regcache *regcache, int tid, int regno)
436 {
437  return 0;
438 }
439 
440 #endif /* HAVE_PTRACE_GETFPXREGS */
441 
442 
443 /* Transferring arbitrary registers between GDB and inferior. */
444 
445 /* Fetch register REGNO from the child process. If REGNO is -1, do
446  this for all registers (including the floating point and SSE
447  registers). */
448 
449 static void
451  struct regcache *regcache, int regno)
452 {
453  pid_t tid;
454 
455  /* Use the old method of peeking around in `struct user' if the
456  GETREGS request isn't available. */
457  if (!have_ptrace_getregs)
458  {
459  int i;
460 
461  for (i = 0; i < gdbarch_num_regs (regcache->arch ()); i++)
462  if (regno == -1 || regno == i)
464 
465  return;
466  }
467 
469 
470  /* Use the PTRACE_GETFPXREGS request whenever possible, since it
471  transfers more registers in one system call, and we'll cache the
472  results. But remember that fetch_fpxregs can fail, and return
473  zero. */
474  if (regno == -1)
475  {
477 
478  /* The call above might reset `have_ptrace_getregs'. */
479  if (!have_ptrace_getregs)
480  {
482  return;
483  }
484 
486  return;
487  if (fetch_fpxregs (regcache, tid))
488  return;
490  return;
491  }
492 
493  if (GETREGS_SUPPLIES (regno))
494  {
496  return;
497  }
498 
499  if (GETXSTATEREGS_SUPPLIES (regno))
500  {
502  return;
503  }
504 
505  if (GETFPXREGS_SUPPLIES (regno))
506  {
507  if (fetch_fpxregs (regcache, tid))
508  return;
509 
510  /* Either our processor or our kernel doesn't support the SSE
511  registers, so read the FP registers in the traditional way,
512  and fill the SSE registers with dummy values. It would be
513  more graceful to handle differences in the register set using
514  gdbarch. Until then, this will at least make things work
515  plausibly. */
517  return;
518  }
519 
520  internal_error (__FILE__, __LINE__,
521  _("Got request for bad register number %d."), regno);
522 }
523 
524 /* Store register REGNO back into the child process. If REGNO is -1,
525  do this for all registers (including the floating point and SSE
526  registers). */
527 static void
529  struct regcache *regcache, int regno)
530 {
531  pid_t tid;
532 
533  /* Use the old method of poking around in `struct user' if the
534  SETREGS request isn't available. */
535  if (!have_ptrace_getregs)
536  {
537  int i;
538 
539  for (i = 0; i < gdbarch_num_regs (regcache->arch ()); i++)
540  if (regno == -1 || regno == i)
542 
543  return;
544  }
545 
547 
548  /* Use the PTRACE_SETFPXREGS requests whenever possible, since it
549  transfers more registers in one system call. But remember that
550  store_fpxregs can fail, and return zero. */
551  if (regno == -1)
552  {
553  store_regs (regcache, tid, regno);
554  if (store_xstateregs (regcache, tid, regno))
555  return;
556  if (store_fpxregs (regcache, tid, regno))
557  return;
558  store_fpregs (regcache, tid, regno);
559  return;
560  }
561 
562  if (GETREGS_SUPPLIES (regno))
563  {
564  store_regs (regcache, tid, regno);
565  return;
566  }
567 
568  if (GETXSTATEREGS_SUPPLIES (regno))
569  {
570  if (store_xstateregs (regcache, tid, regno))
571  return;
572  }
573 
574  if (GETFPXREGS_SUPPLIES (regno))
575  {
576  if (store_fpxregs (regcache, tid, regno))
577  return;
578 
579  /* Either our processor or our kernel doesn't support the SSE
580  registers, so just write the FP registers in the traditional
581  way. */
582  store_fpregs (regcache, tid, regno);
583  return;
584  }
585 
586  internal_error (__FILE__, __LINE__,
587  _("Got request to store bad register number %d."), regno);
588 }
589 
590 
591 /* Called by libthread_db. Returns a pointer to the thread local
592  storage (or its descriptor). */
593 
594 ps_err_e
596  lwpid_t lwpid, int idx, void **base)
597 {
598  unsigned int base_addr;
599  ps_err_e result;
600 
601  result = x86_linux_get_thread_area (lwpid, (void *) idx, &base_addr);
602 
603  if (result == PS_OK)
604  *(int *) base = base_addr;
605 
606  return result;
607 }
608 
609 
610 /* The instruction for a GNU/Linux system call is:
611  int $0x80
612  or 0xcd 0x80. */
613 
614 static const unsigned char linux_syscall[] = { 0xcd, 0x80 };
615 
616 #define LINUX_SYSCALL_LEN (sizeof linux_syscall)
617 
618 /* The system call number is stored in the %eax register. */
619 #define LINUX_SYSCALL_REGNUM I386_EAX_REGNUM
620 
621 /* We are specifically interested in the sigreturn and rt_sigreturn
622  system calls. */
623 
624 #ifndef SYS_sigreturn
625 #define SYS_sigreturn 0x77
626 #endif
627 #ifndef SYS_rt_sigreturn
628 #define SYS_rt_sigreturn 0xad
629 #endif
630 
631 /* Offset to saved processor flags, from <asm/sigcontext.h>. */
632 #define LINUX_SIGCONTEXT_EFLAGS_OFFSET (64)
633 
634 /* Resume execution of the inferior process.
635  If STEP is nonzero, single-step it.
636  If SIGNAL is nonzero, give it that signal. */
637 
638 static void
640  ptid_t ptid, int step, enum gdb_signal signal)
641 {
642  int pid = ptid_get_lwp (ptid);
643  int request;
644 
645  if (catch_syscall_enabled () > 0)
646  request = PTRACE_SYSCALL;
647  else
648  request = PTRACE_CONT;
649 
650  if (step)
651  {
653  struct gdbarch *gdbarch = regcache->arch ();
654  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
655  ULONGEST pc;
657 
658  request = PTRACE_SINGLESTEP;
659 
661  gdbarch_pc_regnum (gdbarch), &pc);
662 
663  /* Returning from a signal trampoline is done by calling a
664  special system call (sigreturn or rt_sigreturn, see
665  i386-linux-tdep.c for more information). This system call
666  restores the registers that were saved when the signal was
667  raised, including %eflags. That means that single-stepping
668  won't work. Instead, we'll have to modify the signal context
669  that's about to be restored, and set the trace flag there. */
670 
671  /* First check if PC is at a system call. */
672  if (target_read_memory (pc, buf, LINUX_SYSCALL_LEN) == 0
673  && memcmp (buf, linux_syscall, LINUX_SYSCALL_LEN) == 0)
674  {
678 
679  /* Then check the system call number. */
681  {
682  ULONGEST sp, addr;
683  unsigned long int eflags;
684 
686  if (syscall == SYS_rt_sigreturn)
687  addr = read_memory_unsigned_integer (sp + 8, 4, byte_order)
688  + 20;
689  else
690  addr = sp;
691 
692  /* Set the trace flag in the context that's about to be
693  restored. */
695  read_memory (addr, (gdb_byte *) &eflags, 4);
696  eflags |= 0x0100;
697  write_memory (addr, (gdb_byte *) &eflags, 4);
698  }
699  }
700  }
701 
702  if (ptrace (request, pid, 0, gdb_signal_to_host (signal)) == -1)
703  perror_with_name (("ptrace"));
704 }
705 
706 void
708 {
709  /* Create a generic x86 GNU/Linux target. */
710  struct target_ops *t = x86_linux_create_target ();
711 
712  /* Override the default ptrace resume method. */
714 
715  /* Add our register access methods. */
718 
719  /* Add the target. */
721 }
unsigned int lwpid_t
void i387_collect_fsave(const struct regcache *regcache, int regnum, void *fsave)
Definition: i387-tdep.c:493
#define I386_NUM_GREGS
Definition: i386-tdep.h:332
#define GETXSTATEREGS_SUPPLIES(regno)
static constexpr ptid_t tid
#define GETREGS_SUPPLIES(regno)
int catch_syscall_enabled(void)
static void i386_linux_resume(struct target_ops *ops, ptid_t ptid, int step, enum gdb_signal signal)
struct regcache * get_thread_regcache(ptid_t ptid)
Definition: regcache.c:434
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int int rusage_t pid_t pid
Definition: gnu-nat.c:1824
void fill_gregset(const struct regcache *regcache, elf_gregset_t *gregsetp, int regno)
void i387_supply_fxsave(struct regcache *regcache, int regnum, const void *fxsave)
Definition: i387-tdep.c:586
static void fetch_regs(struct regcache *regcache, int tid)
ptid_t regcache_get_ptid(const struct regcache *regcache)
Definition: regcache.c:229
void internal_error(const char *file, int line, const char *fmt,...)
Definition: errors.c:50
struct target_ops * x86_linux_create_target(void)
ps_err_e
void supply_fpregset(struct regcache *regcache, const elf_fpregset_t *fpregsetp)
ps_err_e x86_linux_get_thread_area(pid_t pid, void *addr, unsigned int *base_addr)
int have_ptrace_getregs
void i387_supply_fsave(struct regcache *regcache, int regnum, const void *fsave)
Definition: i387-tdep.c:438
int gdbarch_num_regs(struct gdbarch *gdbarch)
Definition: gdbarch.c:2039
#define PTRACE_SETFPREGS
#define _(String)
Definition: gdb_locale.h:35
int have_ptrace_getfpxregs
#define SYS_sigreturn
PTRACE_TYPE_RET ptrace()
ps_err_e ps_get_thread_area(struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base)
static void store_register(const struct regcache *regcache, int regno)
static int store_fpxregs(const struct regcache *regcache, int tid, int regno)
#define LINUX_SIGCONTEXT_EFLAGS_OFFSET
#define SYS_rt_sigreturn
enum tribool have_ptrace_getregset
Definition: linux-nat.c:190
void i387_collect_fxsave(const struct regcache *regcache, int regnum, void *fxsave)
Definition: i387-tdep.c:669
void _initialize_i386_linux_nat(void)
#define PTRACE_GETFPREGS
static void i386_linux_store_inferior_registers(struct target_ops *ops, struct regcache *regcache, int regno)
static const unsigned char linux_syscall[]
enum register_status regcache_cooked_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
Definition: regcache.c:777
Definition: ptid.h:35
void(* to_resume)(struct target_ops *, ptid_t, int TARGET_DEBUG_PRINTER(target_debug_print_step), enum gdb_signal) TARGET_DEFAULT_NORETURN(noprocess())
Definition: target.h:447
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
Definition: gdbarch.c:1509
int gdb_signal_to_host(enum gdb_signal)
Definition: signals.c:639
static void store_fpregs(const struct regcache *regcache, int tid, int regno)
void x86_linux_add_target(struct target_ops *t)
void fill_fpregset(const struct regcache *regcache, elf_fpregset_t *fpregsetp, int regno)
const char * gdbarch_register_name(struct gdbarch *gdbarch, int regnr)
Definition: gdbarch.c:2282
#define PTRACE_SETREGSET
Definition: linux-ptrace.h:51
#define LINUX_SYSCALL_LEN
void read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
Definition: corefile.c:258
static int store_xstateregs(const struct regcache *regcache, int tid, int regno)
long ptid_get_lwp(const ptid_t &ptid)
Definition: ptid.c:55
#define X86_XSTATE_MAX_SIZE
Definition: x86-xstate.h:59
#define PTRACE_GETREGSET
Definition: linux-ptrace.h:47
static void fetch_fpregs(struct regcache *regcache, int tid)
#define gdb_assert(expr)
Definition: gdb_assert.h:32
void i387_collect_xsave(const struct regcache *regcache, int regnum, void *xsave, int gcore)
Definition: i387-tdep.c:1306
bfd_byte gdb_byte
Definition: common-types.h:38
void(* to_fetch_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_IGNORE()
Definition: target.h:457
#define I386_LINUX_ORIG_EAX_REGNUM
void void void void void void void void void perror_with_name(const char *string) ATTRIBUTE_NORETURN
Definition: utils.c:692
static int fetch_fpxregs(struct regcache *regcache, int tid)
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
Definition: target.c:1370
char * safe_strerror(int)
#define LINUX_SYSCALL_REGNUM
void supply_gregset(struct regcache *regcache, const elf_gregset_t *gregsetp)
gdbarch * arch() const
Definition: regcache.c:221
#define PTRACE_SETREGS
static int fetch_xstateregs(struct regcache *regcache, int tid)
static void fetch_register(struct regcache *regcache, int regno)
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
Definition: regcache.c:1004
static void i386_linux_fetch_inferior_registers(struct target_ops *ops, struct regcache *regcache, int regno)
unsigned long long ULONGEST
Definition: common-types.h:53
int i386_linux_gregset_reg_offset[]
void regcache_raw_collect(const struct regcache *regcache, int regnum, void *buf)
Definition: regcache.c:1085
int gdbarch_pc_regnum(struct gdbarch *gdbarch)
Definition: gdbarch.c:2163
pid_t get_ptrace_pid(ptid_t ptid)
Definition: inf-ptrace.c:320
ULONGEST read_memory_unsigned_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
Definition: corefile.c:326
ptid_t ptid() const
Definition: regcache.h:325
void write_memory(CORE_ADDR memaddr, const bfd_byte *myaddr, ssize_t len)
Definition: corefile.c:394
static void store_regs(const struct regcache *regcache, int tid, int regno)
void i387_supply_xsave(struct regcache *regcache, int regnum, const void *xsave)
Definition: i387-tdep.c:898
void(* to_store_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN(noprocess())
Definition: target.h:459
#define GETFPXREGS_SUPPLIES(regno)
enum bfd_endian byte_order
Definition: gdbarch.c:137
void error(const char *fmt,...)
Definition: errors.c:38
#define PTRACE_GETREGS