1 /* Low-level child interface to ptrace.
3 Copyright (C) 1988-2014 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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/>. */
28 #include "gdb_assert.h"
30 #include "gdb_ptrace.h"
34 #include "inf-ptrace.h"
35 #include "inf-child.h"
36 #include "gdbthread.h"
40 #ifdef PT_GET_PROCESS_STATE
43 inf_ptrace_follow_fork (struct target_ops *ops, int follow_child,
49 pid = ptid_get_pid (inferior_ptid);
51 if (ptrace (PT_GET_PROCESS_STATE, pid,
52 (PTRACE_TYPE_ARG3)&pe, sizeof pe) == -1)
53 perror_with_name (("ptrace"));
55 gdb_assert (pe.pe_report_event == PTRACE_FORK);
56 fpid = pe.pe_other_pid;
60 struct inferior *parent_inf, *child_inf;
61 struct thread_info *tp;
63 parent_inf = find_inferior_pid (pid);
66 child_inf = add_inferior (fpid);
67 child_inf->attach_flag = parent_inf->attach_flag;
68 copy_terminal_info (child_inf, parent_inf);
69 child_inf->pspace = parent_inf->pspace;
70 child_inf->aspace = parent_inf->aspace;
72 /* Before detaching from the parent, remove all breakpoints from
74 remove_breakpoints ();
76 if (ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3)1, 0) == -1)
77 perror_with_name (("ptrace"));
79 /* Switch inferior_ptid out of the parent's way. */
80 inferior_ptid = pid_to_ptid (fpid);
82 /* Delete the parent. */
83 detach_inferior (pid);
85 add_thread_silent (inferior_ptid);
89 /* Breakpoints have already been detached from the child by
92 if (ptrace (PT_DETACH, fpid, (PTRACE_TYPE_ARG3)1, 0) == -1)
93 perror_with_name (("ptrace"));
99 #endif /* PT_GET_PROCESS_STATE */
102 /* Prepare to be traced. */
107 /* "Trace me, Dr. Memory!" */
108 ptrace (PT_TRACE_ME, 0, (PTRACE_TYPE_ARG3)0, 0);
111 /* Start a new inferior Unix child process. EXEC_FILE is the file to
112 run, ALLARGS is a string containing the arguments to the program.
113 ENV is the environment vector to pass. If FROM_TTY is non-zero, be
117 inf_ptrace_create_inferior (struct target_ops *ops,
118 char *exec_file, char *allargs, char **env,
123 /* Do not change either targets above or the same target if already present.
124 The reason is the target stack is shared across multiple inferiors. */
125 int ops_already_pushed = target_is_pushed (ops);
126 struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
128 if (! ops_already_pushed)
130 /* Clear possible core file with its process_stratum. */
132 make_cleanup_unpush_target (ops);
135 pid = fork_inferior (exec_file, allargs, env, inf_ptrace_me, NULL,
138 discard_cleanups (back_to);
140 startup_inferior (START_INFERIOR_TRAPS_EXPECTED);
142 /* On some targets, there must be some explicit actions taken after
143 the inferior has been started up. */
144 target_post_startup_inferior (pid_to_ptid (pid));
147 #ifdef PT_GET_PROCESS_STATE
150 inf_ptrace_post_startup_inferior (struct target_ops *self, ptid_t pid)
154 /* Set the initial event mask. */
155 memset (&pe, 0, sizeof pe);
156 pe.pe_set_event |= PTRACE_FORK;
157 if (ptrace (PT_SET_EVENT_MASK, ptid_get_pid (pid),
158 (PTRACE_TYPE_ARG3)&pe, sizeof pe) == -1)
159 perror_with_name (("ptrace"));
164 /* Clean up a rotting corpse of an inferior after it died. */
167 inf_ptrace_mourn_inferior (struct target_ops *ops)
171 /* Wait just one more time to collect the inferior's exit status.
172 Do not check whether this succeeds though, since we may be
173 dealing with a process that we attached to. Such a process will
174 only report its exit status to its original parent. */
175 waitpid (ptid_get_pid (inferior_ptid), &status, 0);
177 inf_child_mourn_inferior (ops);
180 /* Attach to the process specified by ARGS. If FROM_TTY is non-zero,
181 be chatty about it. */
184 inf_ptrace_attach (struct target_ops *ops, const char *args, int from_tty)
188 struct inferior *inf;
190 /* Do not change either targets above or the same target if already present.
191 The reason is the target stack is shared across multiple inferiors. */
192 int ops_already_pushed = target_is_pushed (ops);
193 struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
195 pid = parse_pid_to_attach (args);
197 if (pid == getpid ()) /* Trying to masturbate? */
198 error (_("I refuse to debug myself!"));
200 if (! ops_already_pushed)
202 /* target_pid_to_str already uses the target. Also clear possible core
203 file with its process_stratum. */
205 make_cleanup_unpush_target (ops);
210 exec_file = get_exec_file (0);
213 printf_unfiltered (_("Attaching to program: %s, %s\n"), exec_file,
214 target_pid_to_str (pid_to_ptid (pid)));
216 printf_unfiltered (_("Attaching to %s\n"),
217 target_pid_to_str (pid_to_ptid (pid)));
219 gdb_flush (gdb_stdout);
224 ptrace (PT_ATTACH, pid, (PTRACE_TYPE_ARG3)0, 0);
226 perror_with_name (("ptrace"));
228 error (_("This system does not support attaching to a process"));
231 inf = current_inferior ();
232 inferior_appeared (inf, pid);
233 inf->attach_flag = 1;
234 inferior_ptid = pid_to_ptid (pid);
236 /* Always add a main thread. If some target extends the ptrace
237 target, it should decorate the ptid later with more info. */
238 add_thread_silent (inferior_ptid);
240 discard_cleanups (back_to);
243 #ifdef PT_GET_PROCESS_STATE
246 inf_ptrace_post_attach (struct target_ops *self, int pid)
250 /* Set the initial event mask. */
251 memset (&pe, 0, sizeof pe);
252 pe.pe_set_event |= PTRACE_FORK;
253 if (ptrace (PT_SET_EVENT_MASK, pid,
254 (PTRACE_TYPE_ARG3)&pe, sizeof pe) == -1)
255 perror_with_name (("ptrace"));
260 /* Detach from the inferior, optionally passing it the signal
261 specified by ARGS. If FROM_TTY is non-zero, be chatty about it. */
264 inf_ptrace_detach (struct target_ops *ops, const char *args, int from_tty)
266 pid_t pid = ptid_get_pid (inferior_ptid);
271 char *exec_file = get_exec_file (0);
274 printf_unfiltered (_("Detaching from program: %s, %s\n"), exec_file,
275 target_pid_to_str (pid_to_ptid (pid)));
276 gdb_flush (gdb_stdout);
282 /* We'd better not have left any breakpoints in the program or it'll
283 die when it hits one. Also note that this may only work if we
284 previously attached to the inferior. It *might* work if we
285 started the process ourselves. */
287 ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3)1, sig);
289 perror_with_name (("ptrace"));
291 error (_("This system does not support detaching from a process"));
294 inferior_ptid = null_ptid;
295 detach_inferior (pid);
297 inf_child_maybe_unpush_target (ops);
300 /* Kill the inferior. */
303 inf_ptrace_kill (struct target_ops *ops)
305 pid_t pid = ptid_get_pid (inferior_ptid);
311 ptrace (PT_KILL, pid, (PTRACE_TYPE_ARG3)0, 0);
312 waitpid (pid, &status, 0);
314 target_mourn_inferior ();
317 /* Stop the inferior. */
320 inf_ptrace_stop (struct target_ops *self, ptid_t ptid)
322 /* Send a SIGINT to the process group. This acts just like the user
323 typed a ^C on the controlling terminal. Note that using a
324 negative process number in kill() is a System V-ism. The proper
325 BSD interface is killpg(). However, all modern BSDs support the
326 System V interface too. */
327 kill (-inferior_process_group (), SIGINT);
330 /* Resume execution of thread PTID, or all threads if PTID is -1. If
331 STEP is nonzero, single-step it. If SIGNAL is nonzero, give it
335 inf_ptrace_resume (struct target_ops *ops,
336 ptid_t ptid, int step, enum gdb_signal signal)
338 pid_t pid = ptid_get_pid (ptid);
342 /* Resume all threads. Traditionally ptrace() only supports
343 single-threaded processes, so simply resume the inferior. */
344 pid = ptid_get_pid (inferior_ptid);
346 if (catch_syscall_enabled () > 0)
347 request = PT_SYSCALL;
349 request = PT_CONTINUE;
353 /* If this system does not support PT_STEP, a higher level
354 function will have called single_step() to transmute the step
355 request into a continue request (by setting breakpoints on
356 all possible successor instructions), so we don't have to
357 worry about that here. */
361 /* An address of (PTRACE_TYPE_ARG3)1 tells ptrace to continue from
362 where it was. If GDB wanted it to start some other way, we have
363 already written a new program counter value to the child. */
365 ptrace (request, pid, (PTRACE_TYPE_ARG3)1, gdb_signal_to_host (signal));
367 perror_with_name (("ptrace"));
370 /* Wait for the child specified by PTID to do something. Return the
371 process ID of the child, or MINUS_ONE_PTID in case of error; store
372 the status in *OURSTATUS. */
375 inf_ptrace_wait (struct target_ops *ops,
376 ptid_t ptid, struct target_waitstatus *ourstatus, int options)
379 int status, save_errno;
387 pid = waitpid (ptid_get_pid (ptid), &status, 0);
390 while (pid == -1 && errno == EINTR);
392 clear_sigint_trap ();
396 fprintf_unfiltered (gdb_stderr,
397 _("Child process unexpectedly missing: %s.\n"),
398 safe_strerror (save_errno));
400 /* Claim it exited with unknown signal. */
401 ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
402 ourstatus->value.sig = GDB_SIGNAL_UNKNOWN;
403 return inferior_ptid;
406 /* Ignore terminated detached child processes. */
407 if (!WIFSTOPPED (status) && pid != ptid_get_pid (inferior_ptid))
412 #ifdef PT_GET_PROCESS_STATE
413 if (WIFSTOPPED (status))
418 if (ptrace (PT_GET_PROCESS_STATE, pid,
419 (PTRACE_TYPE_ARG3)&pe, sizeof pe) == -1)
420 perror_with_name (("ptrace"));
422 switch (pe.pe_report_event)
425 ourstatus->kind = TARGET_WAITKIND_FORKED;
426 ourstatus->value.related_pid = pid_to_ptid (pe.pe_other_pid);
428 /* Make sure the other end of the fork is stopped too. */
429 fpid = waitpid (pe.pe_other_pid, &status, 0);
431 perror_with_name (("waitpid"));
433 if (ptrace (PT_GET_PROCESS_STATE, fpid,
434 (PTRACE_TYPE_ARG3)&pe, sizeof pe) == -1)
435 perror_with_name (("ptrace"));
437 gdb_assert (pe.pe_report_event == PTRACE_FORK);
438 gdb_assert (pe.pe_other_pid == pid);
439 if (fpid == ptid_get_pid (inferior_ptid))
441 ourstatus->value.related_pid = pid_to_ptid (pe.pe_other_pid);
442 return pid_to_ptid (fpid);
445 return pid_to_ptid (pid);
450 store_waitstatus (ourstatus, status);
451 return pid_to_ptid (pid);
454 /* Implement the to_xfer_partial target_ops method. */
456 static enum target_xfer_status
457 inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
458 const char *annex, gdb_byte *readbuf,
459 const gdb_byte *writebuf,
460 ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
462 pid_t pid = ptid_get_pid (inferior_ptid);
466 case TARGET_OBJECT_MEMORY:
468 /* OpenBSD 3.1, NetBSD 1.6 and FreeBSD 5.0 have a new PT_IO
469 request that promises to be much more efficient in reading
470 and writing data in the traced process's address space. */
472 struct ptrace_io_desc piod;
474 /* NOTE: We assume that there are no distinct address spaces
475 for instruction and data. However, on OpenBSD 3.9 and
476 later, PIOD_WRITE_D doesn't allow changing memory that's
477 mapped read-only. Since most code segments will be
478 read-only, using PIOD_WRITE_D will prevent us from
479 inserting breakpoints, so we use PIOD_WRITE_I instead. */
480 piod.piod_op = writebuf ? PIOD_WRITE_I : PIOD_READ_D;
481 piod.piod_addr = writebuf ? (void *) writebuf : readbuf;
482 piod.piod_offs = (void *) (long) offset;
486 if (ptrace (PT_IO, pid, (caddr_t)&piod, 0) == 0)
488 /* Return the actual number of bytes read or written. */
489 *xfered_len = piod.piod_len;
490 return (piod.piod_len == 0) ? TARGET_XFER_EOF : TARGET_XFER_OK;
492 /* If the PT_IO request is somehow not supported, fallback on
493 using PT_WRITE_D/PT_READ_D. Otherwise we will return zero
494 to indicate failure. */
496 return TARGET_XFER_EOF;
502 PTRACE_TYPE_RET word;
503 gdb_byte byte[sizeof (PTRACE_TYPE_RET)];
505 ULONGEST rounded_offset;
506 ULONGEST partial_len;
508 /* Round the start offset down to the next long word
510 rounded_offset = offset & -(ULONGEST) sizeof (PTRACE_TYPE_RET);
512 /* Since ptrace will transfer a single word starting at that
513 rounded_offset the partial_len needs to be adjusted down to
514 that (remember this function only does a single transfer).
515 Should the required length be even less, adjust it down
517 partial_len = (rounded_offset + sizeof (PTRACE_TYPE_RET)) - offset;
518 if (partial_len > len)
523 /* If OFFSET:PARTIAL_LEN is smaller than
524 ROUNDED_OFFSET:WORDSIZE then a read/modify write will
525 be needed. Read in the entire word. */
526 if (rounded_offset < offset
527 || (offset + partial_len
528 < rounded_offset + sizeof (PTRACE_TYPE_RET)))
529 /* Need part of initial word -- fetch it. */
530 buffer.word = ptrace (PT_READ_I, pid,
531 (PTRACE_TYPE_ARG3)(uintptr_t)
534 /* Copy data to be written over corresponding part of
536 memcpy (buffer.byte + (offset - rounded_offset),
537 writebuf, partial_len);
540 ptrace (PT_WRITE_D, pid,
541 (PTRACE_TYPE_ARG3)(uintptr_t)rounded_offset,
545 /* Using the appropriate one (I or D) is necessary for
546 Gould NP1, at least. */
548 ptrace (PT_WRITE_I, pid,
549 (PTRACE_TYPE_ARG3)(uintptr_t)rounded_offset,
552 return TARGET_XFER_EOF;
559 buffer.word = ptrace (PT_READ_I, pid,
560 (PTRACE_TYPE_ARG3)(uintptr_t)rounded_offset,
563 return TARGET_XFER_EOF;
564 /* Copy appropriate bytes out of the buffer. */
565 memcpy (readbuf, buffer.byte + (offset - rounded_offset),
569 *xfered_len = partial_len;
570 return TARGET_XFER_OK;
573 case TARGET_OBJECT_UNWIND_TABLE:
574 return TARGET_XFER_E_IO;
576 case TARGET_OBJECT_AUXV:
577 #if defined (PT_IO) && defined (PIOD_READ_AUXV)
578 /* OpenBSD 4.5 has a new PIOD_READ_AUXV operation for the PT_IO
579 request that allows us to read the auxilliary vector. Other
580 BSD's may follow if they feel the need to support PIE. */
582 struct ptrace_io_desc piod;
585 return TARGET_XFER_E_IO;
586 piod.piod_op = PIOD_READ_AUXV;
587 piod.piod_addr = readbuf;
588 piod.piod_offs = (void *) (long) offset;
592 if (ptrace (PT_IO, pid, (caddr_t)&piod, 0) == 0)
594 /* Return the actual number of bytes read or written. */
595 *xfered_len = piod.piod_len;
596 return (piod.piod_len == 0) ? TARGET_XFER_EOF : TARGET_XFER_OK;
600 return TARGET_XFER_E_IO;
602 case TARGET_OBJECT_WCOOKIE:
603 return TARGET_XFER_E_IO;
606 return TARGET_XFER_E_IO;
610 /* Return non-zero if the thread specified by PTID is alive. */
613 inf_ptrace_thread_alive (struct target_ops *ops, ptid_t ptid)
615 /* ??? Is kill the right way to do this? */
616 return (kill (ptid_get_pid (ptid), 0) != -1);
619 /* Print status information about what we're accessing. */
622 inf_ptrace_files_info (struct target_ops *ignore)
624 struct inferior *inf = current_inferior ();
626 printf_filtered (_("\tUsing the running image of %s %s.\n"),
627 inf->attach_flag ? "attached" : "child",
628 target_pid_to_str (inferior_ptid));
632 inf_ptrace_pid_to_str (struct target_ops *ops, ptid_t ptid)
634 return normal_pid_to_str (ptid);
637 #if defined (PT_IO) && defined (PIOD_READ_AUXV)
639 /* Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
640 Return 0 if *READPTR is already at the end of the buffer.
641 Return -1 if there is insufficient buffer for a whole entry.
642 Return 1 if an entry was read into *TYPEP and *VALP. */
645 inf_ptrace_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
646 gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
648 struct type *int_type = builtin_type (target_gdbarch ())->builtin_int;
649 struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
650 const int sizeof_auxv_type = TYPE_LENGTH (int_type);
651 const int sizeof_auxv_val = TYPE_LENGTH (ptr_type);
652 enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
653 gdb_byte *ptr = *readptr;
658 if (endptr - ptr < 2 * sizeof_auxv_val)
661 *typep = extract_unsigned_integer (ptr, sizeof_auxv_type, byte_order);
662 ptr += sizeof_auxv_val; /* Alignment. */
663 *valp = extract_unsigned_integer (ptr, sizeof_auxv_val, byte_order);
664 ptr += sizeof_auxv_val;
672 /* Create a prototype ptrace target. The client can override it with
676 inf_ptrace_target (void)
678 struct target_ops *t = inf_child_target ();
680 t->to_attach = inf_ptrace_attach;
681 t->to_detach = inf_ptrace_detach;
682 t->to_resume = inf_ptrace_resume;
683 t->to_wait = inf_ptrace_wait;
684 t->to_files_info = inf_ptrace_files_info;
685 t->to_kill = inf_ptrace_kill;
686 t->to_create_inferior = inf_ptrace_create_inferior;
687 #ifdef PT_GET_PROCESS_STATE
688 t->to_follow_fork = inf_ptrace_follow_fork;
689 t->to_post_startup_inferior = inf_ptrace_post_startup_inferior;
690 t->to_post_attach = inf_ptrace_post_attach;
692 t->to_mourn_inferior = inf_ptrace_mourn_inferior;
693 t->to_thread_alive = inf_ptrace_thread_alive;
694 t->to_pid_to_str = inf_ptrace_pid_to_str;
695 t->to_stop = inf_ptrace_stop;
696 t->to_xfer_partial = inf_ptrace_xfer_partial;
697 #if defined (PT_IO) && defined (PIOD_READ_AUXV)
698 t->to_auxv_parse = inf_ptrace_auxv_parse;
705 /* Pointer to a function that returns the offset within the user area
706 where a particular register is stored. */
707 static CORE_ADDR (*inf_ptrace_register_u_offset)(struct gdbarch *, int, int);
709 /* Fetch register REGNUM from the inferior. */
712 inf_ptrace_fetch_register (struct regcache *regcache, int regnum)
714 struct gdbarch *gdbarch = get_regcache_arch (regcache);
717 PTRACE_TYPE_RET *buf;
720 /* This isn't really an address, but ptrace thinks of it as one. */
721 addr = inf_ptrace_register_u_offset (gdbarch, regnum, 0);
722 if (addr == (CORE_ADDR)-1
723 || gdbarch_cannot_fetch_register (gdbarch, regnum))
725 regcache_raw_supply (regcache, regnum, NULL);
729 /* Cater for systems like GNU/Linux, that implement threads as
730 separate processes. */
731 pid = ptid_get_lwp (inferior_ptid);
733 pid = ptid_get_pid (inferior_ptid);
735 size = register_size (gdbarch, regnum);
736 gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
739 /* Read the register contents from the inferior a chunk at a time. */
740 for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
743 buf[i] = ptrace (PT_READ_U, pid, (PTRACE_TYPE_ARG3)(uintptr_t)addr, 0);
745 error (_("Couldn't read register %s (#%d): %s."),
746 gdbarch_register_name (gdbarch, regnum),
747 regnum, safe_strerror (errno));
749 addr += sizeof (PTRACE_TYPE_RET);
751 regcache_raw_supply (regcache, regnum, buf);
754 /* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
755 for all registers. */
758 inf_ptrace_fetch_registers (struct target_ops *ops,
759 struct regcache *regcache, int regnum)
763 regnum < gdbarch_num_regs (get_regcache_arch (regcache));
765 inf_ptrace_fetch_register (regcache, regnum);
767 inf_ptrace_fetch_register (regcache, regnum);
770 /* Store register REGNUM into the inferior. */
773 inf_ptrace_store_register (const struct regcache *regcache, int regnum)
775 struct gdbarch *gdbarch = get_regcache_arch (regcache);
778 PTRACE_TYPE_RET *buf;
781 /* This isn't really an address, but ptrace thinks of it as one. */
782 addr = inf_ptrace_register_u_offset (gdbarch, regnum, 1);
783 if (addr == (CORE_ADDR)-1
784 || gdbarch_cannot_store_register (gdbarch, regnum))
787 /* Cater for systems like GNU/Linux, that implement threads as
788 separate processes. */
789 pid = ptid_get_lwp (inferior_ptid);
791 pid = ptid_get_pid (inferior_ptid);
793 size = register_size (gdbarch, regnum);
794 gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
797 /* Write the register contents into the inferior a chunk at a time. */
798 regcache_raw_collect (regcache, regnum, buf);
799 for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
802 ptrace (PT_WRITE_U, pid, (PTRACE_TYPE_ARG3)(uintptr_t)addr, buf[i]);
804 error (_("Couldn't write register %s (#%d): %s."),
805 gdbarch_register_name (gdbarch, regnum),
806 regnum, safe_strerror (errno));
808 addr += sizeof (PTRACE_TYPE_RET);
812 /* Store register REGNUM back into the inferior. If REGNUM is -1, do
813 this for all registers. */
816 inf_ptrace_store_registers (struct target_ops *ops,
817 struct regcache *regcache, int regnum)
821 regnum < gdbarch_num_regs (get_regcache_arch (regcache));
823 inf_ptrace_store_register (regcache, regnum);
825 inf_ptrace_store_register (regcache, regnum);
828 /* Create a "traditional" ptrace target. REGISTER_U_OFFSET should be
829 a function returning the offset within the user area where a
830 particular register is stored. */
833 inf_ptrace_trad_target (CORE_ADDR (*register_u_offset)
834 (struct gdbarch *, int, int))
836 struct target_ops *t = inf_ptrace_target();
838 gdb_assert (register_u_offset);
839 inf_ptrace_register_u_offset = register_u_offset;
840 t->to_fetch_registers = inf_ptrace_fetch_registers;
841 t->to_store_registers = inf_ptrace_store_registers;