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