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