* gdbserver/low-linux.c (arm_register_u_addr): added.
[deliverable/binutils-gdb.git] / gdb / gdbserver / low-linux.c
1 /* Low level interface to ptrace, for the remote server for GDB.
2 Copyright 1995, 1996, 1998, 1999, 2000, 2001
3 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 2 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, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22 #include "server.h"
23 #include <sys/wait.h>
24 #include "frame.h"
25 #include "inferior.h"
26
27 #include <stdio.h>
28 #include <sys/param.h>
29 #include <sys/dir.h>
30 #include <sys/ptrace.h>
31 #include <sys/user.h>
32 #include <signal.h>
33 #include <sys/ioctl.h>
34 #include <fcntl.h>
35
36 /***************Begin MY defs*********************/
37 static char my_registers[REGISTER_BYTES];
38 char *registers = my_registers;
39 /***************End MY defs*********************/
40
41 #ifdef HAVE_SYS_REG_H
42 #include <sys/reg.h>
43 #endif
44
45 /* Default the type of the ptrace transfer to int. */
46 #ifndef PTRACE_XFER_TYPE
47 #define PTRACE_XFER_TYPE int
48 #endif
49
50 extern int errno;
51
52 static void initialize_arch (void);
53
54 /* Start an inferior process and returns its pid.
55 ALLARGS is a vector of program-name and args. */
56
57 int
58 create_inferior (char *program, char **allargs)
59 {
60 int pid;
61
62 pid = fork ();
63 if (pid < 0)
64 perror_with_name ("fork");
65
66 if (pid == 0)
67 {
68 ptrace (PTRACE_TRACEME, 0, 0, 0);
69
70 execv (program, allargs);
71
72 fprintf (stderr, "Cannot exec %s: %s.\n", program,
73 errno < sys_nerr ? sys_errlist[errno] : "unknown error");
74 fflush (stderr);
75 _exit (0177);
76 }
77
78 return pid;
79 }
80
81 /* Kill the inferior process. Make us have no inferior. */
82
83 void
84 kill_inferior (void)
85 {
86 if (inferior_pid == 0)
87 return;
88 ptrace (PTRACE_KILL, inferior_pid, 0, 0);
89 wait (0);
90 /*************inferior_died ();****VK**************/
91 }
92
93 /* Return nonzero if the given thread is still alive. */
94 int
95 mythread_alive (int pid)
96 {
97 return 1;
98 }
99
100 /* Wait for process, returns status */
101
102 unsigned char
103 mywait (char *status)
104 {
105 int pid;
106 union wait w;
107
108 enable_async_io ();
109 pid = waitpid (inferior_pid, &w, 0);
110 disable_async_io ();
111 if (pid != inferior_pid)
112 perror_with_name ("wait");
113
114 if (WIFEXITED (w))
115 {
116 fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w));
117 *status = 'W';
118 return ((unsigned char) WEXITSTATUS (w));
119 }
120 else if (!WIFSTOPPED (w))
121 {
122 fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w));
123 *status = 'X';
124 return ((unsigned char) WTERMSIG (w));
125 }
126
127 fetch_inferior_registers (0);
128
129 *status = 'T';
130 return ((unsigned char) WSTOPSIG (w));
131 }
132
133 /* Resume execution of the inferior process.
134 If STEP is nonzero, single-step it.
135 If SIGNAL is nonzero, give it that signal. */
136
137 void
138 myresume (int step, int signal)
139 {
140 errno = 0;
141 ptrace (step ? PTRACE_SINGLESTEP : PTRACE_CONT, inferior_pid, 1, signal);
142 if (errno)
143 perror_with_name ("ptrace");
144 }
145
146
147 #if !defined (offsetof)
148 #define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
149 #endif
150
151 /* U_REGS_OFFSET is the offset of the registers within the u area. */
152 #if !defined (U_REGS_OFFSET)
153 #define U_REGS_OFFSET \
154 ptrace (PT_READ_U, inferior_pid, \
155 (PTRACE_ARG3_TYPE) (offsetof (struct user, u_ar0)), 0) \
156 - KERNEL_U_ADDR
157 #endif
158
159 #ifdef I386_GNULINUX_TARGET
160 /* This module only supports access to the general purpose registers.
161 Adjust the relevant constants accordingly.
162
163 FIXME: kettenis/2001-03-28: We should really use PTRACE_GETREGS to
164 get at the registers. Better yet, we should try to share code with
165 i386-linux-nat.c. */
166 #undef NUM_FREGS
167 #define NUM_FREGS 0
168 #undef NUM_REGS
169 #define NUM_REGS NUM_GREGS
170
171 /* This stuff comes from i386-tdep.c. */
172
173 /* i386_register_byte[i] is the offset into the register file of the
174 start of register number i. We initialize this from
175 i386_register_raw_size. */
176 int i386_register_byte[MAX_NUM_REGS];
177
178 /* i386_register_raw_size[i] is the number of bytes of storage in
179 GDB's register array occupied by register i. */
180 int i386_register_raw_size[MAX_NUM_REGS] = {
181 4, 4, 4, 4,
182 4, 4, 4, 4,
183 4, 4, 4, 4,
184 4, 4, 4, 4,
185 10, 10, 10, 10,
186 10, 10, 10, 10,
187 4, 4, 4, 4,
188 4, 4, 4, 4,
189 16, 16, 16, 16,
190 16, 16, 16, 16,
191 4
192 };
193
194 static void
195 initialize_arch (void)
196 {
197 /* Initialize the table saying where each register starts in the
198 register file. */
199 {
200 int i, offset;
201
202 offset = 0;
203 for (i = 0; i < MAX_NUM_REGS; i++)
204 {
205 i386_register_byte[i] = offset;
206 offset += i386_register_raw_size[i];
207 }
208 }
209 }
210
211 /* This stuff comes from i386-linux-nat.c. */
212
213 /* Mapping between the general-purpose registers in `struct user'
214 format and GDB's register array layout. */
215 static int regmap[] =
216 {
217 EAX, ECX, EDX, EBX,
218 UESP, EBP, ESI, EDI,
219 EIP, EFL, CS, SS,
220 DS, ES, FS, GS
221 };
222
223 /* Return the address of register REGNUM. BLOCKEND is the value of
224 u.u_ar0, which should point to the registers. */
225
226 CORE_ADDR
227 register_u_addr (CORE_ADDR blockend, int regnum)
228 {
229 return (blockend + 4 * regmap[regnum]);
230 }
231 #elif defined(TARGET_M68K)
232 static void
233 initialize_arch (void)
234 {
235 return;
236 }
237
238 /* This table must line up with REGISTER_NAMES in tm-m68k.h */
239 static int regmap[] =
240 {
241 #ifdef PT_D0
242 PT_D0, PT_D1, PT_D2, PT_D3, PT_D4, PT_D5, PT_D6, PT_D7,
243 PT_A0, PT_A1, PT_A2, PT_A3, PT_A4, PT_A5, PT_A6, PT_USP,
244 PT_SR, PT_PC,
245 #else
246 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15,
247 17, 18,
248 #endif
249 #ifdef PT_FP0
250 PT_FP0, PT_FP1, PT_FP2, PT_FP3, PT_FP4, PT_FP5, PT_FP6, PT_FP7,
251 PT_FPCR, PT_FPSR, PT_FPIAR
252 #else
253 21, 24, 27, 30, 33, 36, 39, 42, 45, 46, 47
254 #endif
255 };
256
257 /* BLOCKEND is the value of u.u_ar0, and points to the place where GS
258 is stored. */
259
260 int
261 m68k_linux_register_u_addr (int blockend, int regnum)
262 {
263 return (blockend + 4 * regmap[regnum]);
264 }
265 #elif defined(IA64_GNULINUX_TARGET)
266 #undef NUM_FREGS
267 #define NUM_FREGS 0
268
269 #include <asm/ptrace_offsets.h>
270
271 static int u_offsets[] =
272 {
273 /* general registers */
274 -1, /* gr0 not available; i.e, it's always zero */
275 PT_R1,
276 PT_R2,
277 PT_R3,
278 PT_R4,
279 PT_R5,
280 PT_R6,
281 PT_R7,
282 PT_R8,
283 PT_R9,
284 PT_R10,
285 PT_R11,
286 PT_R12,
287 PT_R13,
288 PT_R14,
289 PT_R15,
290 PT_R16,
291 PT_R17,
292 PT_R18,
293 PT_R19,
294 PT_R20,
295 PT_R21,
296 PT_R22,
297 PT_R23,
298 PT_R24,
299 PT_R25,
300 PT_R26,
301 PT_R27,
302 PT_R28,
303 PT_R29,
304 PT_R30,
305 PT_R31,
306 /* gr32 through gr127 not directly available via the ptrace interface */
307 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
308 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
309 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
310 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
311 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
312 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
313 /* Floating point registers */
314 -1, -1, /* f0 and f1 not available (f0 is +0.0 and f1 is +1.0) */
315 PT_F2,
316 PT_F3,
317 PT_F4,
318 PT_F5,
319 PT_F6,
320 PT_F7,
321 PT_F8,
322 PT_F9,
323 PT_F10,
324 PT_F11,
325 PT_F12,
326 PT_F13,
327 PT_F14,
328 PT_F15,
329 PT_F16,
330 PT_F17,
331 PT_F18,
332 PT_F19,
333 PT_F20,
334 PT_F21,
335 PT_F22,
336 PT_F23,
337 PT_F24,
338 PT_F25,
339 PT_F26,
340 PT_F27,
341 PT_F28,
342 PT_F29,
343 PT_F30,
344 PT_F31,
345 PT_F32,
346 PT_F33,
347 PT_F34,
348 PT_F35,
349 PT_F36,
350 PT_F37,
351 PT_F38,
352 PT_F39,
353 PT_F40,
354 PT_F41,
355 PT_F42,
356 PT_F43,
357 PT_F44,
358 PT_F45,
359 PT_F46,
360 PT_F47,
361 PT_F48,
362 PT_F49,
363 PT_F50,
364 PT_F51,
365 PT_F52,
366 PT_F53,
367 PT_F54,
368 PT_F55,
369 PT_F56,
370 PT_F57,
371 PT_F58,
372 PT_F59,
373 PT_F60,
374 PT_F61,
375 PT_F62,
376 PT_F63,
377 PT_F64,
378 PT_F65,
379 PT_F66,
380 PT_F67,
381 PT_F68,
382 PT_F69,
383 PT_F70,
384 PT_F71,
385 PT_F72,
386 PT_F73,
387 PT_F74,
388 PT_F75,
389 PT_F76,
390 PT_F77,
391 PT_F78,
392 PT_F79,
393 PT_F80,
394 PT_F81,
395 PT_F82,
396 PT_F83,
397 PT_F84,
398 PT_F85,
399 PT_F86,
400 PT_F87,
401 PT_F88,
402 PT_F89,
403 PT_F90,
404 PT_F91,
405 PT_F92,
406 PT_F93,
407 PT_F94,
408 PT_F95,
409 PT_F96,
410 PT_F97,
411 PT_F98,
412 PT_F99,
413 PT_F100,
414 PT_F101,
415 PT_F102,
416 PT_F103,
417 PT_F104,
418 PT_F105,
419 PT_F106,
420 PT_F107,
421 PT_F108,
422 PT_F109,
423 PT_F110,
424 PT_F111,
425 PT_F112,
426 PT_F113,
427 PT_F114,
428 PT_F115,
429 PT_F116,
430 PT_F117,
431 PT_F118,
432 PT_F119,
433 PT_F120,
434 PT_F121,
435 PT_F122,
436 PT_F123,
437 PT_F124,
438 PT_F125,
439 PT_F126,
440 PT_F127,
441 /* predicate registers - we don't fetch these individually */
442 -1, -1, -1, -1, -1, -1, -1, -1,
443 -1, -1, -1, -1, -1, -1, -1, -1,
444 -1, -1, -1, -1, -1, -1, -1, -1,
445 -1, -1, -1, -1, -1, -1, -1, -1,
446 -1, -1, -1, -1, -1, -1, -1, -1,
447 -1, -1, -1, -1, -1, -1, -1, -1,
448 -1, -1, -1, -1, -1, -1, -1, -1,
449 -1, -1, -1, -1, -1, -1, -1, -1,
450 /* branch registers */
451 PT_B0,
452 PT_B1,
453 PT_B2,
454 PT_B3,
455 PT_B4,
456 PT_B5,
457 PT_B6,
458 PT_B7,
459 /* virtual frame pointer and virtual return address pointer */
460 -1, -1,
461 /* other registers */
462 PT_PR,
463 PT_CR_IIP, /* ip */
464 PT_CR_IPSR, /* psr */
465 PT_CFM, /* cfm */
466 /* kernel registers not visible via ptrace interface (?) */
467 -1, -1, -1, -1, -1, -1, -1, -1,
468 /* hole */
469 -1, -1, -1, -1, -1, -1, -1, -1,
470 PT_AR_RSC,
471 PT_AR_BSP,
472 PT_AR_BSPSTORE,
473 PT_AR_RNAT,
474 -1,
475 -1, /* Not available: FCR, IA32 floating control register */
476 -1, -1,
477 -1, /* Not available: EFLAG */
478 -1, /* Not available: CSD */
479 -1, /* Not available: SSD */
480 -1, /* Not available: CFLG */
481 -1, /* Not available: FSR */
482 -1, /* Not available: FIR */
483 -1, /* Not available: FDR */
484 -1,
485 PT_AR_CCV,
486 -1, -1, -1,
487 PT_AR_UNAT,
488 -1, -1, -1,
489 PT_AR_FPSR,
490 -1, -1, -1,
491 -1, /* Not available: ITC */
492 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
493 -1, -1, -1, -1, -1, -1, -1, -1, -1,
494 PT_AR_PFS,
495 PT_AR_LC,
496 -1, /* Not available: EC, the Epilog Count register */
497 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
498 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
499 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
500 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
501 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
502 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
503 -1,
504 /* nat bits - not fetched directly; instead we obtain these bits from
505 either rnat or unat or from memory. */
506 -1, -1, -1, -1, -1, -1, -1, -1,
507 -1, -1, -1, -1, -1, -1, -1, -1,
508 -1, -1, -1, -1, -1, -1, -1, -1,
509 -1, -1, -1, -1, -1, -1, -1, -1,
510 -1, -1, -1, -1, -1, -1, -1, -1,
511 -1, -1, -1, -1, -1, -1, -1, -1,
512 -1, -1, -1, -1, -1, -1, -1, -1,
513 -1, -1, -1, -1, -1, -1, -1, -1,
514 -1, -1, -1, -1, -1, -1, -1, -1,
515 -1, -1, -1, -1, -1, -1, -1, -1,
516 -1, -1, -1, -1, -1, -1, -1, -1,
517 -1, -1, -1, -1, -1, -1, -1, -1,
518 -1, -1, -1, -1, -1, -1, -1, -1,
519 -1, -1, -1, -1, -1, -1, -1, -1,
520 -1, -1, -1, -1, -1, -1, -1, -1,
521 -1, -1, -1, -1, -1, -1, -1, -1,
522 };
523
524 int
525 ia64_register_u_addr (int blockend, int regnum)
526 {
527 int addr;
528
529 if (regnum < 0 || regnum >= NUM_REGS)
530 error ("Invalid register number %d.", regnum);
531
532 addr = u_offsets[regnum];
533 if (addr == -1)
534 addr = 0;
535
536 return addr;
537 }
538
539 static void
540 initialize_arch (void)
541 {
542 return;
543 }
544
545 #elif defined(ARM_GNULINUX_TARGET)
546 int arm_register_u_addr(blockend, regnum)
547 int blockend;
548 int regnum;
549 {
550 return blockend + REGISTER_BYTE(regnum);
551 }
552
553 static void
554 initialize_arch ()
555 {
556 }
557 #endif
558
559 CORE_ADDR
560 register_addr (int regno, CORE_ADDR blockend)
561 {
562 CORE_ADDR addr;
563
564 if (regno < 0 || regno >= NUM_REGS)
565 error ("Invalid register number %d.", regno);
566
567 REGISTER_U_ADDR (addr, blockend, regno);
568
569 return addr;
570 }
571
572 /* Fetch one register. */
573
574 static void
575 fetch_register (int regno)
576 {
577 CORE_ADDR regaddr;
578 register int i;
579
580 /* Offset of registers within the u area. */
581 unsigned int offset;
582
583 offset = U_REGS_OFFSET;
584
585 regaddr = register_addr (regno, offset);
586 for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE))
587 {
588 errno = 0;
589 *(PTRACE_XFER_TYPE *) &registers[REGISTER_BYTE (regno) + i] =
590 ptrace (PTRACE_PEEKUSER, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, 0);
591 regaddr += sizeof (PTRACE_XFER_TYPE);
592 if (errno != 0)
593 {
594 /* Warning, not error, in case we are attached; sometimes the
595 kernel doesn't let us at the registers. */
596 char *err = strerror (errno);
597 char *msg = alloca (strlen (err) + 128);
598 sprintf (msg, "reading register %d: %s", regno, err);
599 error (msg);
600 goto error_exit;
601 }
602 }
603 error_exit:;
604 }
605
606 /* Fetch all registers, or just one, from the child process. */
607
608 void
609 fetch_inferior_registers (int regno)
610 {
611 if (regno == -1 || regno == 0)
612 for (regno = 0; regno < NUM_REGS - NUM_FREGS; regno++)
613 fetch_register (regno);
614 else
615 fetch_register (regno);
616 }
617
618 /* Store our register values back into the inferior.
619 If REGNO is -1, do this for all registers.
620 Otherwise, REGNO specifies which register (so we can save time). */
621
622 void
623 store_inferior_registers (int regno)
624 {
625 CORE_ADDR regaddr;
626 int i;
627 unsigned int offset = U_REGS_OFFSET;
628
629 if (regno >= 0)
630 {
631 #if 0
632 if (CANNOT_STORE_REGISTER (regno))
633 return;
634 #endif
635 regaddr = register_addr (regno, offset);
636 errno = 0;
637 #if 0
638 if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM)
639 {
640 scratch = *(int *) &registers[REGISTER_BYTE (regno)] | 0x3;
641 ptrace (PT_WUREGS, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
642 scratch, 0);
643 if (errno != 0)
644 {
645 /* Error, even if attached. Failing to write these two
646 registers is pretty serious. */
647 sprintf (buf, "writing register number %d", regno);
648 perror_with_name (buf);
649 }
650 }
651 else
652 #endif
653 for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
654 {
655 errno = 0;
656 ptrace (PTRACE_POKEUSER, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
657 *(int *) &registers[REGISTER_BYTE (regno) + i]);
658 if (errno != 0)
659 {
660 /* Warning, not error, in case we are attached; sometimes the
661 kernel doesn't let us at the registers. */
662 char *err = strerror (errno);
663 char *msg = alloca (strlen (err) + 128);
664 sprintf (msg, "writing register %d: %s",
665 regno, err);
666 error (msg);
667 return;
668 }
669 regaddr += sizeof (int);
670 }
671 }
672 else
673 for (regno = 0; regno < NUM_REGS - NUM_FREGS; regno++)
674 store_inferior_registers (regno);
675 }
676
677 /* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
678 in the NEW_SUN_PTRACE case.
679 It ought to be straightforward. But it appears that writing did
680 not write the data that I specified. I cannot understand where
681 it got the data that it actually did write. */
682
683 /* Copy LEN bytes from inferior's memory starting at MEMADDR
684 to debugger memory starting at MYADDR. */
685
686 void
687 read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
688 {
689 register int i;
690 /* Round starting address down to longword boundary. */
691 register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_XFER_TYPE);
692 /* Round ending address up; get number of longwords that makes. */
693 register int count
694 = (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1)
695 / sizeof (PTRACE_XFER_TYPE);
696 /* Allocate buffer of that many longwords. */
697 register PTRACE_XFER_TYPE *buffer
698 = (PTRACE_XFER_TYPE *) alloca (count * sizeof (PTRACE_XFER_TYPE));
699
700 /* Read all the longwords */
701 for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE))
702 {
703 buffer[i] = ptrace (PTRACE_PEEKTEXT, inferior_pid, addr, 0);
704 }
705
706 /* Copy appropriate bytes out of the buffer. */
707 memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)), len);
708 }
709
710 /* Copy LEN bytes of data from debugger memory at MYADDR
711 to inferior's memory at MEMADDR.
712 On failure (cannot write the inferior)
713 returns the value of errno. */
714
715 int
716 write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
717 {
718 register int i;
719 /* Round starting address down to longword boundary. */
720 register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_XFER_TYPE);
721 /* Round ending address up; get number of longwords that makes. */
722 register int count
723 = (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1) / sizeof (PTRACE_XFER_TYPE);
724 /* Allocate buffer of that many longwords. */
725 register PTRACE_XFER_TYPE *buffer = (PTRACE_XFER_TYPE *) alloca (count * sizeof (PTRACE_XFER_TYPE));
726 extern int errno;
727
728 /* Fill start and end extra bytes of buffer with existing memory data. */
729
730 buffer[0] = ptrace (PTRACE_PEEKTEXT, inferior_pid, addr, 0);
731
732 if (count > 1)
733 {
734 buffer[count - 1]
735 = ptrace (PTRACE_PEEKTEXT, inferior_pid,
736 addr + (count - 1) * sizeof (PTRACE_XFER_TYPE), 0);
737 }
738
739 /* Copy data to be written over corresponding part of buffer */
740
741 memcpy ((char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)), myaddr, len);
742
743 /* Write the entire buffer. */
744
745 for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE))
746 {
747 errno = 0;
748 ptrace (PTRACE_POKETEXT, inferior_pid, addr, buffer[i]);
749 if (errno)
750 return errno;
751 }
752
753 return 0;
754 }
755 \f
756 void
757 initialize_low (void)
758 {
759 initialize_arch ();
760 }
This page took 0.045871 seconds and 4 git commands to generate.