GDB (xrefs)
/tmp/gdb-7.10/gdb/rs6000-nat.c
Go to the documentation of this file.
1 /* IBM RS/6000 native-dependent code for GDB, the GNU debugger.
2 
3  Copyright (C) 1986-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 "target.h"
23 #include "gdbcore.h"
24 #include "symfile.h"
25 #include "objfiles.h"
26 #include "libbfd.h" /* For bfd_default_set_arch_mach (FIXME) */
27 #include "bfd.h"
28 #include "gdb-stabs.h"
29 #include "regcache.h"
30 #include "arch-utils.h"
31 #include "inf-child.h"
32 #include "inf-ptrace.h"
33 #include "ppc-tdep.h"
34 #include "rs6000-tdep.h"
35 #include "rs6000-aix-tdep.h"
36 #include "exec.h"
37 #include "observer.h"
38 #include "xcoffread.h"
39 
40 #include <sys/ptrace.h>
41 #include <sys/reg.h>
42 
43 #include <sys/dir.h>
44 #include <sys/user.h>
45 #include <signal.h>
46 #include <sys/ioctl.h>
47 #include <fcntl.h>
48 
49 #include <a.out.h>
50 #include <sys/file.h>
51 #include <sys/stat.h>
52 #include "gdb_bfd.h"
53 #include <sys/core.h>
54 #define __LDINFO_PTRACE32__ /* for __ld_info32 */
55 #define __LDINFO_PTRACE64__ /* for __ld_info64 */
56 #include <sys/ldr.h>
57 #include <sys/systemcfg.h>
58 
59 /* On AIX4.3+, sys/ldr.h provides different versions of struct ld_info for
60  debugging 32-bit and 64-bit processes. Define a typedef and macros for
61  accessing fields in the appropriate structures. */
62 
63 /* In 32-bit compilation mode (which is the only mode from which ptrace()
64  works on 4.3), __ld_info32 is #defined as equivalent to ld_info. */
65 
66 #if defined (__ld_info32) || defined (__ld_info64)
67 # define ARCH3264
68 #endif
69 
70 /* Return whether the current architecture is 64-bit. */
71 
72 #ifndef ARCH3264
73 # define ARCH64() 0
74 #else
75 # define ARCH64() (register_size (target_gdbarch (), 0) == 8)
76 #endif
77 
79 
80 /* Given REGNO, a gdb register number, return the corresponding
81  number suitable for use as a ptrace() parameter. Return -1 if
82  there's no suitable mapping. Also, set the int pointed to by
83  ISFLOAT to indicate whether REGNO is a floating point register. */
84 
85 static int
86 regmap (struct gdbarch *gdbarch, int regno, int *isfloat)
87 {
88  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
89 
90  *isfloat = 0;
91  if (tdep->ppc_gp0_regnum <= regno
92  && regno < tdep->ppc_gp0_regnum + ppc_num_gprs)
93  return regno;
94  else if (tdep->ppc_fp0_regnum >= 0
95  && tdep->ppc_fp0_regnum <= regno
96  && regno < tdep->ppc_fp0_regnum + ppc_num_fprs)
97  {
98  *isfloat = 1;
99  return regno - tdep->ppc_fp0_regnum + FPR0;
100  }
101  else if (regno == gdbarch_pc_regnum (gdbarch))
102  return IAR;
103  else if (regno == tdep->ppc_ps_regnum)
104  return MSR;
105  else if (regno == tdep->ppc_cr_regnum)
106  return CR;
107  else if (regno == tdep->ppc_lr_regnum)
108  return LR;
109  else if (regno == tdep->ppc_ctr_regnum)
110  return CTR;
111  else if (regno == tdep->ppc_xer_regnum)
112  return XER;
113  else if (tdep->ppc_fpscr_regnum >= 0
114  && regno == tdep->ppc_fpscr_regnum)
115  return FPSCR;
116  else if (tdep->ppc_mq_regnum >= 0 && regno == tdep->ppc_mq_regnum)
117  return MQ;
118  else
119  return -1;
120 }
121 
122 /* Call ptrace(REQ, ID, ADDR, DATA, BUF). */
123 
124 static int
125 rs6000_ptrace32 (int req, int id, int *addr, int data, int *buf)
126 {
127 #ifdef HAVE_PTRACE64
128  int ret = ptrace64 (req, id, (uintptr_t) addr, data, buf);
129 #else
130  int ret = ptrace (req, id, (int *)addr, data, buf);
131 #endif
132 #if 0
133  printf ("rs6000_ptrace32 (%d, %d, 0x%x, %08x, 0x%x) = 0x%x\n",
134  req, id, (unsigned int)addr, data, (unsigned int)buf, ret);
135 #endif
136  return ret;
137 }
138 
139 /* Call ptracex(REQ, ID, ADDR, DATA, BUF). */
140 
141 static int
142 rs6000_ptrace64 (int req, int id, long long addr, int data, void *buf)
143 {
144 #ifdef ARCH3264
145 # ifdef HAVE_PTRACE64
146  int ret = ptrace64 (req, id, addr, data, buf);
147 # else
148  int ret = ptracex (req, id, addr, data, buf);
149 # endif
150 #else
151  int ret = 0;
152 #endif
153 #if 0
154  printf ("rs6000_ptrace64 (%d, %d, %s, %08x, 0x%x) = 0x%x\n",
155  req, id, hex_string (addr), data, (unsigned int)buf, ret);
156 #endif
157  return ret;
158 }
159 
160 /* Fetch register REGNO from the inferior. */
161 
162 static void
163 fetch_register (struct regcache *regcache, int regno)
164 {
165  struct gdbarch *gdbarch = get_regcache_arch (regcache);
166  int addr[MAX_REGISTER_SIZE];
167  int nr, isfloat;
168 
169  /* Retrieved values may be -1, so infer errors from errno. */
170  errno = 0;
171 
172  nr = regmap (gdbarch, regno, &isfloat);
173 
174  /* Floating-point registers. */
175  if (isfloat)
176  rs6000_ptrace32 (PT_READ_FPR, ptid_get_pid (inferior_ptid), addr, nr, 0);
177 
178  /* Bogus register number. */
179  else if (nr < 0)
180  {
181  if (regno >= gdbarch_num_regs (gdbarch))
183  "gdb error: register no %d not implemented.\n",
184  regno);
185  return;
186  }
187 
188  /* Fixed-point registers. */
189  else
190  {
191  if (!ARCH64 ())
192  *addr = rs6000_ptrace32 (PT_READ_GPR, ptid_get_pid (inferior_ptid),
193  (int *) nr, 0, 0);
194  else
195  {
196  /* PT_READ_GPR requires the buffer parameter to point to long long,
197  even if the register is really only 32 bits. */
198  long long buf;
200  nr, 0, &buf);
201  if (register_size (gdbarch, regno) == 8)
202  memcpy (addr, &buf, 8);
203  else
204  *addr = buf;
205  }
206  }
207 
208  if (!errno)
209  regcache_raw_supply (regcache, regno, (char *) addr);
210  else
211  {
212 #if 0
213  /* FIXME: this happens 3 times at the start of each 64-bit program. */
214  perror (_("ptrace read"));
215 #endif
216  errno = 0;
217  }
218 }
219 
220 /* Store register REGNO back into the inferior. */
221 
222 static void
223 store_register (struct regcache *regcache, int regno)
224 {
225  struct gdbarch *gdbarch = get_regcache_arch (regcache);
226  int addr[MAX_REGISTER_SIZE];
227  int nr, isfloat;
228 
229  /* Fetch the register's value from the register cache. */
230  regcache_raw_collect (regcache, regno, addr);
231 
232  /* -1 can be a successful return value, so infer errors from errno. */
233  errno = 0;
234 
235  nr = regmap (gdbarch, regno, &isfloat);
236 
237  /* Floating-point registers. */
238  if (isfloat)
239  rs6000_ptrace32 (PT_WRITE_FPR, ptid_get_pid (inferior_ptid), addr, nr, 0);
240 
241  /* Bogus register number. */
242  else if (nr < 0)
243  {
244  if (regno >= gdbarch_num_regs (gdbarch))
246  "gdb error: register no %d not implemented.\n",
247  regno);
248  }
249 
250  /* Fixed-point registers. */
251  else
252  {
253  /* The PT_WRITE_GPR operation is rather odd. For 32-bit inferiors,
254  the register's value is passed by value, but for 64-bit inferiors,
255  the address of a buffer containing the value is passed. */
256  if (!ARCH64 ())
257  rs6000_ptrace32 (PT_WRITE_GPR, ptid_get_pid (inferior_ptid),
258  (int *) nr, *addr, 0);
259  else
260  {
261  /* PT_WRITE_GPR requires the buffer parameter to point to an 8-byte
262  area, even if the register is really only 32 bits. */
263  long long buf;
264  if (register_size (gdbarch, regno) == 8)
265  memcpy (&buf, addr, 8);
266  else
267  buf = *addr;
268  rs6000_ptrace64 (PT_WRITE_GPR, ptid_get_pid (inferior_ptid),
269  nr, 0, &buf);
270  }
271  }
272 
273  if (errno)
274  {
275  perror (_("ptrace write"));
276  errno = 0;
277  }
278 }
279 
280 /* Read from the inferior all registers if REGNO == -1 and just register
281  REGNO otherwise. */
282 
283 static void
285  struct regcache *regcache, int regno)
286 {
287  struct gdbarch *gdbarch = get_regcache_arch (regcache);
288  if (regno != -1)
289  fetch_register (regcache, regno);
290 
291  else
292  {
293  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
294 
295  /* Read 32 general purpose registers. */
296  for (regno = tdep->ppc_gp0_regnum;
297  regno < tdep->ppc_gp0_regnum + ppc_num_gprs;
298  regno++)
299  {
300  fetch_register (regcache, regno);
301  }
302 
303  /* Read general purpose floating point registers. */
304  if (tdep->ppc_fp0_regnum >= 0)
305  for (regno = 0; regno < ppc_num_fprs; regno++)
306  fetch_register (regcache, tdep->ppc_fp0_regnum + regno);
307 
308  /* Read special registers. */
309  fetch_register (regcache, gdbarch_pc_regnum (gdbarch));
310  fetch_register (regcache, tdep->ppc_ps_regnum);
311  fetch_register (regcache, tdep->ppc_cr_regnum);
312  fetch_register (regcache, tdep->ppc_lr_regnum);
313  fetch_register (regcache, tdep->ppc_ctr_regnum);
314  fetch_register (regcache, tdep->ppc_xer_regnum);
315  if (tdep->ppc_fpscr_regnum >= 0)
316  fetch_register (regcache, tdep->ppc_fpscr_regnum);
317  if (tdep->ppc_mq_regnum >= 0)
318  fetch_register (regcache, tdep->ppc_mq_regnum);
319  }
320 }
321 
322 /* Store our register values back into the inferior.
323  If REGNO is -1, do this for all registers.
324  Otherwise, REGNO specifies which register (so we can save time). */
325 
326 static void
328  struct regcache *regcache, int regno)
329 {
330  struct gdbarch *gdbarch = get_regcache_arch (regcache);
331  if (regno != -1)
332  store_register (regcache, regno);
333 
334  else
335  {
336  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
337 
338  /* Write general purpose registers first. */
339  for (regno = tdep->ppc_gp0_regnum;
340  regno < tdep->ppc_gp0_regnum + ppc_num_gprs;
341  regno++)
342  {
343  store_register (regcache, regno);
344  }
345 
346  /* Write floating point registers. */
347  if (tdep->ppc_fp0_regnum >= 0)
348  for (regno = 0; regno < ppc_num_fprs; regno++)
349  store_register (regcache, tdep->ppc_fp0_regnum + regno);
350 
351  /* Write special registers. */
352  store_register (regcache, gdbarch_pc_regnum (gdbarch));
353  store_register (regcache, tdep->ppc_ps_regnum);
354  store_register (regcache, tdep->ppc_cr_regnum);
355  store_register (regcache, tdep->ppc_lr_regnum);
356  store_register (regcache, tdep->ppc_ctr_regnum);
357  store_register (regcache, tdep->ppc_xer_regnum);
358  if (tdep->ppc_fpscr_regnum >= 0)
359  store_register (regcache, tdep->ppc_fpscr_regnum);
360  if (tdep->ppc_mq_regnum >= 0)
361  store_register (regcache, tdep->ppc_mq_regnum);
362  }
363 }
364 
365 /* Implement the to_xfer_partial target_ops method. */
366 
367 static enum target_xfer_status
368 rs6000_xfer_partial (struct target_ops *ops, enum target_object object,
369  const char *annex, gdb_byte *readbuf,
370  const gdb_byte *writebuf,
371  ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
372 {
373  pid_t pid = ptid_get_pid (inferior_ptid);
374  int arch64 = ARCH64 ();
375 
376  switch (object)
377  {
379  return rs6000_xfer_shared_libraries (ops, object, annex,
380  readbuf, writebuf,
381  offset, len, xfered_len);
383  {
384  union
385  {
387  gdb_byte byte[sizeof (PTRACE_TYPE_RET)];
388  } buffer;
389  ULONGEST rounded_offset;
390  LONGEST partial_len;
391 
392  /* Round the start offset down to the next long word
393  boundary. */
394  rounded_offset = offset & -(ULONGEST) sizeof (PTRACE_TYPE_RET);
395 
396  /* Since ptrace will transfer a single word starting at that
397  rounded_offset the partial_len needs to be adjusted down to
398  that (remember this function only does a single transfer).
399  Should the required length be even less, adjust it down
400  again. */
401  partial_len = (rounded_offset + sizeof (PTRACE_TYPE_RET)) - offset;
402  if (partial_len > len)
403  partial_len = len;
404 
405  if (writebuf)
406  {
407  /* If OFFSET:PARTIAL_LEN is smaller than
408  ROUNDED_OFFSET:WORDSIZE then a read/modify write will
409  be needed. Read in the entire word. */
410  if (rounded_offset < offset
411  || (offset + partial_len
412  < rounded_offset + sizeof (PTRACE_TYPE_RET)))
413  {
414  /* Need part of initial word -- fetch it. */
415  if (arch64)
416  buffer.word = rs6000_ptrace64 (PT_READ_I, pid,
417  rounded_offset, 0, NULL);
418  else
419  buffer.word = rs6000_ptrace32 (PT_READ_I, pid,
420  (int *) (uintptr_t)
421  rounded_offset,
422  0, NULL);
423  }
424 
425  /* Copy data to be written over corresponding part of
426  buffer. */
427  memcpy (buffer.byte + (offset - rounded_offset),
428  writebuf, partial_len);
429 
430  errno = 0;
431  if (arch64)
433  rounded_offset, buffer.word, NULL);
434  else
436  (int *) (uintptr_t) rounded_offset,
437  buffer.word, NULL);
438  if (errno)
439  return TARGET_XFER_EOF;
440  }
441 
442  if (readbuf)
443  {
444  errno = 0;
445  if (arch64)
446  buffer.word = rs6000_ptrace64 (PT_READ_I, pid,
447  rounded_offset, 0, NULL);
448  else
449  buffer.word = rs6000_ptrace32 (PT_READ_I, pid,
450  (int *)(uintptr_t)rounded_offset,
451  0, NULL);
452  if (errno)
453  return TARGET_XFER_EOF;
454 
455  /* Copy appropriate bytes out of the buffer. */
456  memcpy (readbuf, buffer.byte + (offset - rounded_offset),
457  partial_len);
458  }
459 
460  *xfered_len = (ULONGEST) partial_len;
461  return TARGET_XFER_OK;
462  }
463 
464  default:
465  return TARGET_XFER_E_IO;
466  }
467 }
468 
469 /* Wait for the child specified by PTID to do something. Return the
470  process ID of the child, or MINUS_ONE_PTID in case of error; store
471  the status in *OURSTATUS. */
472 
473 static ptid_t
474 rs6000_wait (struct target_ops *ops,
475  ptid_t ptid, struct target_waitstatus *ourstatus, int options)
476 {
477  pid_t pid;
478  int status, save_errno;
479 
480  do
481  {
482  set_sigint_trap ();
483 
484  do
485  {
486  pid = waitpid (ptid_get_pid (ptid), &status, 0);
487  save_errno = errno;
488  }
489  while (pid == -1 && errno == EINTR);
490 
492 
493  if (pid == -1)
494  {
496  _("Child process unexpectedly missing: %s.\n"),
497  safe_strerror (save_errno));
498 
499  /* Claim it exited with unknown signal. */
500  ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
501  ourstatus->value.sig = GDB_SIGNAL_UNKNOWN;
502  return inferior_ptid;
503  }
504 
505  /* Ignore terminated detached child processes. */
506  if (!WIFSTOPPED (status) && pid != ptid_get_pid (inferior_ptid))
507  pid = -1;
508  }
509  while (pid == -1);
510 
511  /* AIX has a couple of strange returns from wait(). */
512 
513  /* stop after load" status. */
514  if (status == 0x57c)
515  ourstatus->kind = TARGET_WAITKIND_LOADED;
516  /* signal 0. I have no idea why wait(2) returns with this status word. */
517  else if (status == 0x7f)
518  ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
519  /* A normal waitstatus. Let the usual macros deal with it. */
520  else
521  store_waitstatus (ourstatus, status);
522 
523  return pid_to_ptid (pid);
524 }
525 
526 
527 /* Set the current architecture from the host running GDB. Called when
528  starting a child process. */
529 
530 static void (*super_create_inferior) (struct target_ops *,char *exec_file,
531  char *allargs, char **env, int from_tty);
532 static void
533 rs6000_create_inferior (struct target_ops * ops, char *exec_file,
534  char *allargs, char **env, int from_tty)
535 {
536  enum bfd_architecture arch;
537  unsigned long mach;
538  bfd abfd;
539  struct gdbarch_info info;
540 
541  super_create_inferior (ops, exec_file, allargs, env, from_tty);
542 
543  if (__power_rs ())
544  {
545  arch = bfd_arch_rs6000;
546  mach = bfd_mach_rs6k;
547  }
548  else
549  {
550  arch = bfd_arch_powerpc;
551  mach = bfd_mach_ppc;
552  }
553 
554  /* FIXME: schauer/2002-02-25:
555  We don't know if we are executing a 32 or 64 bit executable,
556  and have no way to pass the proper word size to rs6000_gdbarch_init.
557  So we have to avoid switching to a new architecture, if the architecture
558  matches already.
559  Blindly calling rs6000_gdbarch_init used to work in older versions of
560  GDB, as rs6000_gdbarch_init incorrectly used the previous tdep to
561  determine the wordsize. */
562  if (exec_bfd)
563  {
564  const struct bfd_arch_info *exec_bfd_arch_info;
565 
566  exec_bfd_arch_info = bfd_get_arch_info (exec_bfd);
567  if (arch == exec_bfd_arch_info->arch)
568  return;
569  }
570 
571  bfd_default_set_arch_mach (&abfd, arch, mach);
572 
573  gdbarch_info_init (&info);
574  info.bfd_arch_info = bfd_get_arch_info (&abfd);
575  info.abfd = exec_bfd;
576 
577  if (!gdbarch_update_p (info))
578  internal_error (__FILE__, __LINE__,
579  _("rs6000_create_inferior: failed "
580  "to select architecture"));
581 }
582 
583 
584 /* Shared Object support. */
585 
586 /* Return the LdInfo data for the given process. Raises an error
587  if the data could not be obtained.
588 
589  The returned value must be deallocated after use. */
590 
591 static gdb_byte *
593 {
594  const int pid = ptid_get_pid (ptid);
595  int ldi_size = 1024;
596  gdb_byte *ldi = xmalloc (ldi_size);
597  int rc = -1;
598 
599  while (1)
600  {
601  if (ARCH64 ())
602  rc = rs6000_ptrace64 (PT_LDINFO, pid, (unsigned long) ldi, ldi_size,
603  NULL);
604  else
605  rc = rs6000_ptrace32 (PT_LDINFO, pid, (int *) ldi, ldi_size, NULL);
606 
607  if (rc != -1)
608  break; /* Success, we got the entire ld_info data. */
609 
610  if (errno != ENOMEM)
611  perror_with_name (_("ptrace ldinfo"));
612 
613  /* ldi is not big enough. Double it and try again. */
614  ldi_size *= 2;
615  ldi = xrealloc (ldi, ldi_size);
616  }
617 
618  return ldi;
619 }
620 
621 /* Implement the to_xfer_partial target_ops method for
622  TARGET_OBJECT_LIBRARIES_AIX objects. */
623 
624 static enum target_xfer_status
626  (struct target_ops *ops, enum target_object object,
627  const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf,
628  ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
629 {
630  gdb_byte *ldi_buf;
631  ULONGEST result;
632  struct cleanup *cleanup;
633 
634  /* This function assumes that it is being run with a live process.
635  Core files are handled via gdbarch. */
637 
638  if (writebuf)
639  return TARGET_XFER_E_IO;
640 
642  gdb_assert (ldi_buf != NULL);
643  cleanup = make_cleanup (xfree, ldi_buf);
644  result = rs6000_aix_ld_info_to_xml (target_gdbarch (), ldi_buf,
645  readbuf, offset, len, 1);
646  xfree (ldi_buf);
647 
648  do_cleanups (cleanup);
649 
650  if (result == 0)
651  return TARGET_XFER_EOF;
652  else
653  {
654  *xfered_len = result;
655  return TARGET_XFER_OK;
656  }
657 }
658 
659 void _initialize_rs6000_nat (void);
660 
661 void
663 {
664  struct target_ops *t;
665 
666  t = inf_ptrace_target ();
670 
673 
674  t->to_wait = rs6000_wait;
675 
676  add_target (t);
677 }
struct gdbarch * target_gdbarch(void)
Definition: gdbarch.c:5143
void add_target(struct target_ops *t)
Definition: target.c:395
void xfree(void *)
Definition: common-utils.c:97
int ppc_lr_regnum
Definition: ppc-tdep.h:218
struct gdbarch * get_regcache_arch(const struct regcache *regcache)
Definition: regcache.c:297
int ppc_fpscr_regnum
Definition: ppc-tdep.h:228
static enum target_xfer_status rs6000_xfer_partial(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
Definition: rs6000-nat.c:368
void internal_error(const char *file, int line, const char *fmt,...)
Definition: errors.c:50
int gdbarch_update_p(struct gdbarch_info info)
Definition: arch-utils.c:508
void set_sigint_trap(void)
Definition: inflow.c:795
static void rs6000_create_inferior(struct target_ops *ops, char *exec_file, char *allargs, char **env, int from_tty)
Definition: rs6000-nat.c:533
int gdbarch_num_regs(struct gdbarch *gdbarch)
Definition: gdbarch.c:1898
ptid_t(* to_wait)(struct target_ops *, ptid_t, struct target_waitstatus *, int TARGET_DEBUG_PRINTER(target_debug_print_options)) TARGET_DEFAULT_NORETURN(noprocess())
Definition: target.h:468
#define _(String)
Definition: gdb_locale.h:40
const struct bfd_arch_info * bfd_arch_info
Definition: gdbarch.h:1549
struct target_ops * inf_ptrace_target(void)
Definition: inf-ptrace.c:668
int ppc_cr_regnum
Definition: ppc-tdep.h:217
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
Definition: gdbarch.c:1402
static target_xfer_partial_ftype rs6000_xfer_shared_libraries
Definition: rs6000-nat.c:78
#define PT_WRITE_D
Definition: gdb_ptrace.h:63
PTRACE_TYPE_RET ptrace()
Definition: ptid.h:35
static void(* super_create_inferior)(struct target_ops *, char *exec_file, char *allargs, char **env, int from_tty)
Definition: rs6000-nat.c:530
#define PT_READ_I
Definition: gdb_ptrace.h:47
void _initialize_rs6000_nat(void)
Definition: rs6000-nat.c:662
#define exec_bfd
Definition: exec.h:32
enum gdb_signal sig
Definition: waitstatus.h:108
bfd * abfd
Definition: gdbarch.h:1557
static void store_register(struct regcache *regcache, int regno)
Definition: rs6000-nat.c:223
static void rs6000_store_inferior_registers(struct target_ops *ops, struct regcache *regcache, int regno)
Definition: rs6000-nat.c:327
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
Definition: utils.c:2361
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t int status
Definition: gnu-nat.c:1816
int ppc_gp0_regnum
Definition: ppc-tdep.h:214
ptid_t pid_to_ptid(int pid)
Definition: ptid.c:44
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
Definition: cleanups.c:117
void store_waitstatus(struct target_waitstatus *ourstatus, int hoststatus)
Definition: inf-child.c:51
union target_waitstatus::@161 value
target_xfer_status
Definition: target.h:219
const char * word
Definition: symtab.h:1448
static int regmap(struct gdbarch *gdbarch, int regno, int *isfloat)
Definition: rs6000-nat.c:86
enum target_xfer_status target_xfer_partial_ftype(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
#define gdb_assert(expr)
Definition: gdb_assert.h:33
static int rs6000_ptrace64(int req, int id, long long addr, int data, void *buf)
Definition: rs6000-nat.c:142
#define target_has_execution
Definition: target.h:1726
enum target_xfer_status(* to_xfer_partial)(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) TARGET_DEFAULT_RETURN(TARGET_XFER_E_IO)
Definition: target.h:724
void * xmalloc(YYSIZE_T)
target_object
Definition: target.h:136
static ptid_t rs6000_wait(struct target_ops *ops, ptid_t ptid, struct target_waitstatus *ourstatus, int options)
Definition: rs6000-nat.c:474
static void rs6000_fetch_inferior_registers(struct target_ops *ops, struct regcache *regcache, int regno)
Definition: rs6000-nat.c:284
int ptid_get_pid(ptid_t ptid)
Definition: ptid.c:52
PTR xrealloc(PTR ptr, size_t size)
Definition: common-utils.c:51
#define WIFSTOPPED(w)
Definition: gdb_wait.h:62
bfd_byte gdb_byte
Definition: common-types.h:38
int ppc_ctr_regnum
Definition: ppc-tdep.h:219
void(* to_fetch_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_IGNORE()
Definition: target.h:472
void void void void void void void void void perror_with_name(const char *string) ATTRIBUTE_NORETURN
Definition: utils.c:979
enum target_waitkind kind
Definition: waitstatus.h:100
void gdbarch_info_init(struct gdbarch_info *info)
Definition: arch-utils.c:708
struct ui_file * gdb_stderr
Definition: main.c:72
ptid_t inferior_ptid
Definition: infcmd.c:124
static int rs6000_ptrace32(int req, int id, int *addr, int data, int *buf)
Definition: rs6000-nat.c:125
char * safe_strerror(int)
int ppc_ps_regnum
Definition: ppc-tdep.h:216
int offset
Definition: agent.c:65
Definition: buffer.h:23
int ppc_xer_regnum
Definition: ppc-tdep.h:220
void(* to_create_inferior)(struct target_ops *, char *, char *, char **, int)
Definition: target.h:584
int ppc_mq_regnum
Definition: ppc-tdep.h:231
ULONGEST rs6000_aix_ld_info_to_xml(struct gdbarch *gdbarch, const gdb_byte *ldi_buf, gdb_byte *readbuf, ULONGEST offset, ULONGEST len, int close_ldinfo_fd)
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
Definition: regcache.c:1041
static gdb_byte * rs6000_ptrace_ldinfo(ptid_t ptid)
Definition: rs6000-nat.c:592
unsigned long long ULONGEST
Definition: common-types.h:53
void clear_sigint_trap(void)
Definition: inflow.c:810
int register_size(struct gdbarch *gdbarch, int regnum)
Definition: regcache.c:169
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
void(* to_store_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN(noprocess())
Definition: target.h:474
#define ARCH64()
Definition: rs6000-nat.c:73
static int arch64
Definition: aix-thread.c:120
int ppc_fp0_regnum
Definition: ppc-tdep.h:227
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
static void fetch_register(struct regcache *regcache, int regno)
Definition: rs6000-nat.c:163
long long LONGEST
Definition: common-types.h:52
void do_cleanups(struct cleanup *old_chain)
Definition: cleanups.c:175
#define PTRACE_TYPE_RET
Definition: config.h:667
const ULONGEST const LONGEST len
Definition: target.h:309