Add target_ops argument to to_remove_watchpoint
[deliverable/binutils-gdb.git] / gdb / s390-linux-nat.c
1 /* S390 native-dependent code for GDB, the GNU debugger.
2 Copyright (C) 2001-2014 Free Software Foundation, Inc.
3
4 Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
5 for IBM Deutschland Entwicklung GmbH, IBM Corporation.
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
22 #include "defs.h"
23 #include "regcache.h"
24 #include "inferior.h"
25 #include "target.h"
26 #include "linux-nat.h"
27 #include "auxv.h"
28 #include "gregset.h"
29
30 #include "s390-linux-tdep.h"
31 #include "elf/common.h"
32
33 #include <asm/ptrace.h>
34 #include <sys/ptrace.h>
35 #include <asm/types.h>
36 #include <sys/procfs.h>
37 #include <sys/ucontext.h>
38 #include <elf.h>
39
40 #ifndef PTRACE_GETREGSET
41 #define PTRACE_GETREGSET 0x4204
42 #endif
43
44 #ifndef PTRACE_SETREGSET
45 #define PTRACE_SETREGSET 0x4205
46 #endif
47
48 static int have_regset_last_break = 0;
49 static int have_regset_system_call = 0;
50 static int have_regset_tdb = 0;
51
52 /* Map registers to gregset/ptrace offsets.
53 These arrays are defined in s390-tdep.c. */
54
55 #ifdef __s390x__
56 #define regmap_gregset s390x_regmap_gregset
57 #else
58 #define regmap_gregset s390_regmap_gregset
59 #endif
60
61 #define regmap_fpregset s390_regmap_fpregset
62
63 /* Fill the regset described by MAP into REGCACHE, using the values
64 from REGP. The MAP array represents each register as a pair
65 (offset, regno) of short integers and is terminated with -1. */
66
67 static void
68 s390_native_supply (struct regcache *regcache, const short *map,
69 const gdb_byte *regp)
70 {
71 for (; map[0] >= 0; map += 2)
72 regcache_raw_supply (regcache, map[1], regp ? regp + map[0] : NULL);
73 }
74
75 /* Collect the register REGNO out of the regset described by MAP from
76 REGCACHE into REGP. If REGNO == -1, do this for all registers in
77 this regset. */
78
79 static void
80 s390_native_collect (const struct regcache *regcache, const short *map,
81 int regno, gdb_byte *regp)
82 {
83 for (; map[0] >= 0; map += 2)
84 if (regno == -1 || regno == map[1])
85 regcache_raw_collect (regcache, map[1], regp + map[0]);
86 }
87
88 /* Fill GDB's register array with the general-purpose register values
89 in *REGP.
90
91 When debugging a 32-bit executable running under a 64-bit kernel,
92 we have to fix up the 64-bit registers we get from the kernel to
93 make them look like 32-bit registers. */
94
95 void
96 supply_gregset (struct regcache *regcache, const gregset_t *regp)
97 {
98 #ifdef __s390x__
99 struct gdbarch *gdbarch = get_regcache_arch (regcache);
100 if (gdbarch_ptr_bit (gdbarch) == 32)
101 {
102 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
103 ULONGEST pswm = 0, pswa = 0;
104 gdb_byte buf[4];
105 const short *map;
106
107 for (map = regmap_gregset; map[0] >= 0; map += 2)
108 {
109 const gdb_byte *p = (const gdb_byte *) regp + map[0];
110 int regno = map[1];
111
112 if (regno == S390_PSWM_REGNUM)
113 pswm = extract_unsigned_integer (p, 8, byte_order);
114 else if (regno == S390_PSWA_REGNUM)
115 pswa = extract_unsigned_integer (p, 8, byte_order);
116 else
117 {
118 if ((regno >= S390_R0_REGNUM && regno <= S390_R15_REGNUM)
119 || regno == S390_ORIG_R2_REGNUM)
120 p += 4;
121 regcache_raw_supply (regcache, regno, p);
122 }
123 }
124
125 store_unsigned_integer (buf, 4, byte_order, (pswm >> 32) | 0x80000);
126 regcache_raw_supply (regcache, S390_PSWM_REGNUM, buf);
127 store_unsigned_integer (buf, 4, byte_order,
128 (pswa & 0x7fffffff) | (pswm & 0x80000000));
129 regcache_raw_supply (regcache, S390_PSWA_REGNUM, buf);
130 return;
131 }
132 #endif
133
134 s390_native_supply (regcache, regmap_gregset, (const gdb_byte *) regp);
135 }
136
137 /* Fill register REGNO (if it is a general-purpose register) in
138 *REGP with the value in GDB's register array. If REGNO is -1,
139 do this for all registers. */
140
141 void
142 fill_gregset (const struct regcache *regcache, gregset_t *regp, int regno)
143 {
144 #ifdef __s390x__
145 struct gdbarch *gdbarch = get_regcache_arch (regcache);
146 if (gdbarch_ptr_bit (gdbarch) == 32)
147 {
148 gdb_byte *psw_p[2];
149 const short *map;
150
151 for (map = regmap_gregset; map[0] >= 0; map += 2)
152 {
153 gdb_byte *p = (gdb_byte *) regp + map[0];
154 int reg = map[1];
155
156 if (reg >= S390_PSWM_REGNUM && reg <= S390_PSWA_REGNUM)
157 psw_p[reg - S390_PSWM_REGNUM] = p;
158
159 else if (regno == -1 || regno == reg)
160 {
161 if ((reg >= S390_R0_REGNUM && reg <= S390_R15_REGNUM)
162 || reg == S390_ORIG_R2_REGNUM)
163 {
164 memset (p, 0, 4);
165 p += 4;
166 }
167 regcache_raw_collect (regcache, reg, p + 4);
168 }
169 }
170
171 if (regno == -1
172 || regno == S390_PSWM_REGNUM || regno == S390_PSWA_REGNUM)
173 {
174 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
175 ULONGEST pswa, pswm;
176 gdb_byte buf[4];
177
178 regcache_raw_collect (regcache, S390_PSWM_REGNUM, buf);
179 pswm = extract_unsigned_integer (buf, 4, byte_order);
180 regcache_raw_collect (regcache, S390_PSWA_REGNUM, buf);
181 pswa = extract_unsigned_integer (buf, 4, byte_order);
182
183 if (regno == -1 || regno == S390_PSWM_REGNUM)
184 store_unsigned_integer (psw_p[0], 8, byte_order,
185 ((pswm & 0xfff7ffff) << 32) |
186 (pswa & 0x80000000));
187 if (regno == -1 || regno == S390_PSWA_REGNUM)
188 store_unsigned_integer (psw_p[1], 8, byte_order,
189 pswa & 0x7fffffff);
190 }
191 return;
192 }
193 #endif
194
195 s390_native_collect (regcache, regmap_gregset, regno, (gdb_byte *) regp);
196 }
197
198 /* Fill GDB's register array with the floating-point register values
199 in *REGP. */
200 void
201 supply_fpregset (struct regcache *regcache, const fpregset_t *regp)
202 {
203 s390_native_supply (regcache, regmap_fpregset, (const gdb_byte *) regp);
204 }
205
206 /* Fill register REGNO (if it is a general-purpose register) in
207 *REGP with the value in GDB's register array. If REGNO is -1,
208 do this for all registers. */
209 void
210 fill_fpregset (const struct regcache *regcache, fpregset_t *regp, int regno)
211 {
212 s390_native_collect (regcache, regmap_fpregset, regno, (gdb_byte *) regp);
213 }
214
215 /* Find the TID for the current inferior thread to use with ptrace. */
216 static int
217 s390_inferior_tid (void)
218 {
219 /* GNU/Linux LWP ID's are process ID's. */
220 int tid = ptid_get_lwp (inferior_ptid);
221 if (tid == 0)
222 tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
223
224 return tid;
225 }
226
227 /* Fetch all general-purpose registers from process/thread TID and
228 store their values in GDB's register cache. */
229 static void
230 fetch_regs (struct regcache *regcache, int tid)
231 {
232 gregset_t regs;
233 ptrace_area parea;
234
235 parea.len = sizeof (regs);
236 parea.process_addr = (addr_t) &regs;
237 parea.kernel_addr = offsetof (struct user_regs_struct, psw);
238 if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
239 perror_with_name (_("Couldn't get registers"));
240
241 supply_gregset (regcache, (const gregset_t *) &regs);
242 }
243
244 /* Store all valid general-purpose registers in GDB's register cache
245 into the process/thread specified by TID. */
246 static void
247 store_regs (const struct regcache *regcache, int tid, int regnum)
248 {
249 gregset_t regs;
250 ptrace_area parea;
251
252 parea.len = sizeof (regs);
253 parea.process_addr = (addr_t) &regs;
254 parea.kernel_addr = offsetof (struct user_regs_struct, psw);
255 if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
256 perror_with_name (_("Couldn't get registers"));
257
258 fill_gregset (regcache, &regs, regnum);
259
260 if (ptrace (PTRACE_POKEUSR_AREA, tid, (long) &parea) < 0)
261 perror_with_name (_("Couldn't write registers"));
262 }
263
264 /* Fetch all floating-point registers from process/thread TID and store
265 their values in GDB's register cache. */
266 static void
267 fetch_fpregs (struct regcache *regcache, int tid)
268 {
269 fpregset_t fpregs;
270 ptrace_area parea;
271
272 parea.len = sizeof (fpregs);
273 parea.process_addr = (addr_t) &fpregs;
274 parea.kernel_addr = offsetof (struct user_regs_struct, fp_regs);
275 if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
276 perror_with_name (_("Couldn't get floating point status"));
277
278 supply_fpregset (regcache, (const fpregset_t *) &fpregs);
279 }
280
281 /* Store all valid floating-point registers in GDB's register cache
282 into the process/thread specified by TID. */
283 static void
284 store_fpregs (const struct regcache *regcache, int tid, int regnum)
285 {
286 fpregset_t fpregs;
287 ptrace_area parea;
288
289 parea.len = sizeof (fpregs);
290 parea.process_addr = (addr_t) &fpregs;
291 parea.kernel_addr = offsetof (struct user_regs_struct, fp_regs);
292 if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
293 perror_with_name (_("Couldn't get floating point status"));
294
295 fill_fpregset (regcache, &fpregs, regnum);
296
297 if (ptrace (PTRACE_POKEUSR_AREA, tid, (long) &parea) < 0)
298 perror_with_name (_("Couldn't write floating point status"));
299 }
300
301 /* Fetch all registers in the kernel's register set whose number is REGSET,
302 whose size is REGSIZE, and whose layout is described by REGMAP, from
303 process/thread TID and store their values in GDB's register cache. */
304 static void
305 fetch_regset (struct regcache *regcache, int tid,
306 int regset, int regsize, const short *regmap)
307 {
308 gdb_byte *buf = alloca (regsize);
309 struct iovec iov;
310
311 iov.iov_base = buf;
312 iov.iov_len = regsize;
313
314 if (ptrace (PTRACE_GETREGSET, tid, (long) regset, (long) &iov) < 0)
315 {
316 if (errno == ENODATA)
317 s390_native_supply (regcache, regmap, NULL);
318 else
319 perror_with_name (_("Couldn't get register set"));
320 }
321 else
322 s390_native_supply (regcache, regmap, buf);
323 }
324
325 /* Store all registers in the kernel's register set whose number is REGSET,
326 whose size is REGSIZE, and whose layout is described by REGMAP, from
327 GDB's register cache back to process/thread TID. */
328 static void
329 store_regset (struct regcache *regcache, int tid,
330 int regset, int regsize, const short *regmap)
331 {
332 gdb_byte *buf = alloca (regsize);
333 struct iovec iov;
334
335 iov.iov_base = buf;
336 iov.iov_len = regsize;
337
338 if (ptrace (PTRACE_GETREGSET, tid, (long) regset, (long) &iov) < 0)
339 perror_with_name (_("Couldn't get register set"));
340
341 s390_native_collect (regcache, regmap, -1, buf);
342
343 if (ptrace (PTRACE_SETREGSET, tid, (long) regset, (long) &iov) < 0)
344 perror_with_name (_("Couldn't set register set"));
345 }
346
347 /* Check whether the kernel provides a register set with number REGSET
348 of size REGSIZE for process/thread TID. */
349 static int
350 check_regset (int tid, int regset, int regsize)
351 {
352 gdb_byte *buf = alloca (regsize);
353 struct iovec iov;
354
355 iov.iov_base = buf;
356 iov.iov_len = regsize;
357
358 if (ptrace (PTRACE_GETREGSET, tid, (long) regset, (long) &iov) >= 0
359 || errno == ENODATA)
360 return 1;
361 return 0;
362 }
363
364 /* Fetch register REGNUM from the child process. If REGNUM is -1, do
365 this for all registers. */
366 static void
367 s390_linux_fetch_inferior_registers (struct target_ops *ops,
368 struct regcache *regcache, int regnum)
369 {
370 int tid = s390_inferior_tid ();
371
372 if (regnum == -1 || S390_IS_GREGSET_REGNUM (regnum))
373 fetch_regs (regcache, tid);
374
375 if (regnum == -1 || S390_IS_FPREGSET_REGNUM (regnum))
376 fetch_fpregs (regcache, tid);
377
378 if (have_regset_last_break)
379 if (regnum == -1 || regnum == S390_LAST_BREAK_REGNUM)
380 fetch_regset (regcache, tid, NT_S390_LAST_BREAK, 8,
381 (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32
382 ? s390_regmap_last_break : s390x_regmap_last_break));
383
384 if (have_regset_system_call)
385 if (regnum == -1 || regnum == S390_SYSTEM_CALL_REGNUM)
386 fetch_regset (regcache, tid, NT_S390_SYSTEM_CALL, 4,
387 s390_regmap_system_call);
388
389 if (have_regset_tdb)
390 if (regnum == -1 || S390_IS_TDBREGSET_REGNUM (regnum))
391 fetch_regset (regcache, tid, NT_S390_TDB, s390_sizeof_tdbregset,
392 s390_regmap_tdb);
393 }
394
395 /* Store register REGNUM back into the child process. If REGNUM is
396 -1, do this for all registers. */
397 static void
398 s390_linux_store_inferior_registers (struct target_ops *ops,
399 struct regcache *regcache, int regnum)
400 {
401 int tid = s390_inferior_tid ();
402
403 if (regnum == -1 || S390_IS_GREGSET_REGNUM (regnum))
404 store_regs (regcache, tid, regnum);
405
406 if (regnum == -1 || S390_IS_FPREGSET_REGNUM (regnum))
407 store_fpregs (regcache, tid, regnum);
408
409 /* S390_LAST_BREAK_REGNUM is read-only. */
410
411 if (have_regset_system_call)
412 if (regnum == -1 || regnum == S390_SYSTEM_CALL_REGNUM)
413 store_regset (regcache, tid, NT_S390_SYSTEM_CALL, 4,
414 s390_regmap_system_call);
415 }
416
417
418 /* Hardware-assisted watchpoint handling. */
419
420 /* We maintain a list of all currently active watchpoints in order
421 to properly handle watchpoint removal.
422
423 The only thing we actually need is the total address space area
424 spanned by the watchpoints. */
425
426 struct watch_area
427 {
428 struct watch_area *next;
429 CORE_ADDR lo_addr;
430 CORE_ADDR hi_addr;
431 };
432
433 static struct watch_area *watch_base = NULL;
434
435 static int
436 s390_stopped_by_watchpoint (struct target_ops *ops)
437 {
438 per_lowcore_bits per_lowcore;
439 ptrace_area parea;
440 int result;
441
442 /* Speed up common case. */
443 if (!watch_base)
444 return 0;
445
446 parea.len = sizeof (per_lowcore);
447 parea.process_addr = (addr_t) & per_lowcore;
448 parea.kernel_addr = offsetof (struct user_regs_struct, per_info.lowcore);
449 if (ptrace (PTRACE_PEEKUSR_AREA, s390_inferior_tid (), &parea) < 0)
450 perror_with_name (_("Couldn't retrieve watchpoint status"));
451
452 result = (per_lowcore.perc_storage_alteration == 1
453 && per_lowcore.perc_store_real_address == 0);
454
455 if (result)
456 {
457 /* Do not report this watchpoint again. */
458 memset (&per_lowcore, 0, sizeof (per_lowcore));
459 if (ptrace (PTRACE_POKEUSR_AREA, s390_inferior_tid (), &parea) < 0)
460 perror_with_name (_("Couldn't clear watchpoint status"));
461 }
462
463 return result;
464 }
465
466 static void
467 s390_fix_watch_points (struct lwp_info *lp)
468 {
469 int tid;
470
471 per_struct per_info;
472 ptrace_area parea;
473
474 CORE_ADDR watch_lo_addr = (CORE_ADDR)-1, watch_hi_addr = 0;
475 struct watch_area *area;
476
477 tid = ptid_get_lwp (lp->ptid);
478 if (tid == 0)
479 tid = ptid_get_pid (lp->ptid);
480
481 for (area = watch_base; area; area = area->next)
482 {
483 watch_lo_addr = min (watch_lo_addr, area->lo_addr);
484 watch_hi_addr = max (watch_hi_addr, area->hi_addr);
485 }
486
487 parea.len = sizeof (per_info);
488 parea.process_addr = (addr_t) & per_info;
489 parea.kernel_addr = offsetof (struct user_regs_struct, per_info);
490 if (ptrace (PTRACE_PEEKUSR_AREA, tid, &parea) < 0)
491 perror_with_name (_("Couldn't retrieve watchpoint status"));
492
493 if (watch_base)
494 {
495 per_info.control_regs.bits.em_storage_alteration = 1;
496 per_info.control_regs.bits.storage_alt_space_ctl = 1;
497 }
498 else
499 {
500 per_info.control_regs.bits.em_storage_alteration = 0;
501 per_info.control_regs.bits.storage_alt_space_ctl = 0;
502 }
503 per_info.starting_addr = watch_lo_addr;
504 per_info.ending_addr = watch_hi_addr;
505
506 if (ptrace (PTRACE_POKEUSR_AREA, tid, &parea) < 0)
507 perror_with_name (_("Couldn't modify watchpoint status"));
508 }
509
510 static int
511 s390_insert_watchpoint (CORE_ADDR addr, int len, int type,
512 struct expression *cond)
513 {
514 struct lwp_info *lp;
515 struct watch_area *area = xmalloc (sizeof (struct watch_area));
516
517 if (!area)
518 return -1;
519
520 area->lo_addr = addr;
521 area->hi_addr = addr + len - 1;
522
523 area->next = watch_base;
524 watch_base = area;
525
526 ALL_LWPS (lp)
527 s390_fix_watch_points (lp);
528 return 0;
529 }
530
531 static int
532 s390_remove_watchpoint (struct target_ops *self,
533 CORE_ADDR addr, int len, int type,
534 struct expression *cond)
535 {
536 struct lwp_info *lp;
537 struct watch_area *area, **parea;
538
539 for (parea = &watch_base; *parea; parea = &(*parea)->next)
540 if ((*parea)->lo_addr == addr
541 && (*parea)->hi_addr == addr + len - 1)
542 break;
543
544 if (!*parea)
545 {
546 fprintf_unfiltered (gdb_stderr,
547 "Attempt to remove nonexistent watchpoint.\n");
548 return -1;
549 }
550
551 area = *parea;
552 *parea = area->next;
553 xfree (area);
554
555 ALL_LWPS (lp)
556 s390_fix_watch_points (lp);
557 return 0;
558 }
559
560 static int
561 s390_can_use_hw_breakpoint (struct target_ops *self,
562 int type, int cnt, int othertype)
563 {
564 return type == bp_hardware_watchpoint;
565 }
566
567 static int
568 s390_region_ok_for_hw_watchpoint (CORE_ADDR addr, int cnt)
569 {
570 return 1;
571 }
572
573 static int
574 s390_target_wordsize (void)
575 {
576 int wordsize = 4;
577
578 /* Check for 64-bit inferior process. This is the case when the host is
579 64-bit, and in addition bit 32 of the PSW mask is set. */
580 #ifdef __s390x__
581 long pswm;
582
583 errno = 0;
584 pswm = (long) ptrace (PTRACE_PEEKUSER, s390_inferior_tid (), PT_PSWMASK, 0);
585 if (errno == 0 && (pswm & 0x100000000ul) != 0)
586 wordsize = 8;
587 #endif
588
589 return wordsize;
590 }
591
592 static int
593 s390_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
594 gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
595 {
596 int sizeof_auxv_field = s390_target_wordsize ();
597 enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
598 gdb_byte *ptr = *readptr;
599
600 if (endptr == ptr)
601 return 0;
602
603 if (endptr - ptr < sizeof_auxv_field * 2)
604 return -1;
605
606 *typep = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
607 ptr += sizeof_auxv_field;
608 *valp = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
609 ptr += sizeof_auxv_field;
610
611 *readptr = ptr;
612 return 1;
613 }
614
615 #ifdef __s390x__
616 static unsigned long
617 s390_get_hwcap (void)
618 {
619 CORE_ADDR field;
620
621 if (target_auxv_search (&current_target, AT_HWCAP, &field))
622 return (unsigned long) field;
623
624 return 0;
625 }
626 #endif
627
628 static const struct target_desc *
629 s390_read_description (struct target_ops *ops)
630 {
631 int tid = s390_inferior_tid ();
632
633 have_regset_last_break
634 = check_regset (tid, NT_S390_LAST_BREAK, 8);
635 have_regset_system_call
636 = check_regset (tid, NT_S390_SYSTEM_CALL, 4);
637
638 #ifdef __s390x__
639 /* If GDB itself is compiled as 64-bit, we are running on a machine in
640 z/Architecture mode. If the target is running in 64-bit addressing
641 mode, report s390x architecture. If the target is running in 31-bit
642 addressing mode, but the kernel supports using 64-bit registers in
643 that mode, report s390 architecture with 64-bit GPRs. */
644
645 have_regset_tdb = (s390_get_hwcap () & HWCAP_S390_TE) ?
646 check_regset (tid, NT_S390_TDB, s390_sizeof_tdbregset) : 0;
647
648 if (s390_target_wordsize () == 8)
649 return (have_regset_tdb ? tdesc_s390x_te_linux64 :
650 have_regset_system_call? tdesc_s390x_linux64v2 :
651 have_regset_last_break? tdesc_s390x_linux64v1 :
652 tdesc_s390x_linux64);
653
654 if (s390_get_hwcap () & HWCAP_S390_HIGH_GPRS)
655 return (have_regset_tdb ? tdesc_s390_te_linux64 :
656 have_regset_system_call? tdesc_s390_linux64v2 :
657 have_regset_last_break? tdesc_s390_linux64v1 :
658 tdesc_s390_linux64);
659 #endif
660
661 /* If GDB itself is compiled as 31-bit, or if we're running a 31-bit inferior
662 on a 64-bit kernel that does not support using 64-bit registers in 31-bit
663 mode, report s390 architecture with 32-bit GPRs. */
664 return (have_regset_system_call? tdesc_s390_linux32v2 :
665 have_regset_last_break? tdesc_s390_linux32v1 :
666 tdesc_s390_linux32);
667 }
668
669 void _initialize_s390_nat (void);
670
671 void
672 _initialize_s390_nat (void)
673 {
674 struct target_ops *t;
675
676 /* Fill in the generic GNU/Linux methods. */
677 t = linux_target ();
678
679 /* Add our register access methods. */
680 t->to_fetch_registers = s390_linux_fetch_inferior_registers;
681 t->to_store_registers = s390_linux_store_inferior_registers;
682
683 /* Add our watchpoint methods. */
684 t->to_can_use_hw_breakpoint = s390_can_use_hw_breakpoint;
685 t->to_region_ok_for_hw_watchpoint = s390_region_ok_for_hw_watchpoint;
686 t->to_have_continuable_watchpoint = 1;
687 t->to_stopped_by_watchpoint = s390_stopped_by_watchpoint;
688 t->to_insert_watchpoint = s390_insert_watchpoint;
689 t->to_remove_watchpoint = s390_remove_watchpoint;
690
691 /* Detect target architecture. */
692 t->to_read_description = s390_read_description;
693 t->to_auxv_parse = s390_auxv_parse;
694
695 /* Register the target. */
696 linux_nat_add_target (t);
697 linux_nat_set_new_thread (t, s390_fix_watch_points);
698 }
This page took 0.045288 seconds and 5 git commands to generate.