| OLD | NEW |
| 1 /* S390 native-dependent code for GDB, the GNU debugger. | 1 /* S390 native-dependent code for GDB, the GNU debugger. |
| 2 Copyright (C) 2001, 2003-2007, 2009, 2012 Free Software Foundation, | 2 Copyright (C) 2001, 2003-2007, 2009, 2012 Free Software Foundation, |
| 3 Inc. | 3 Inc. |
| 4 | 4 |
| 5 Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) | 5 Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) |
| 6 for IBM Deutschland Entwicklung GmbH, IBM Corporation. | 6 for IBM Deutschland Entwicklung GmbH, IBM Corporation. |
| 7 | 7 |
| 8 This file is part of GDB. | 8 This file is part of GDB. |
| 9 | 9 |
| 10 This program is free software; you can redistribute it and/or modify | 10 This program is free software; you can redistribute it and/or modify |
| 11 it under the terms of the GNU General Public License as published by | 11 it under the terms of the GNU General Public License as published by |
| 12 the Free Software Foundation; either version 3 of the License, or | 12 the Free Software Foundation; either version 3 of the License, or |
| 13 (at your option) any later version. | 13 (at your option) any later version. |
| 14 | 14 |
| 15 This program is distributed in the hope that it will be useful, | 15 This program is distributed in the hope that it will be useful, |
| 16 but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 GNU General Public License for more details. | 18 GNU General Public License for more details. |
| 19 | 19 |
| 20 You should have received a copy of the GNU General Public License | 20 You should have received a copy of the GNU General Public License |
| 21 along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 21 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 22 | 22 |
| 23 #include "defs.h" | 23 #include "defs.h" |
| 24 #include "regcache.h" | 24 #include "regcache.h" |
| 25 #include "inferior.h" | 25 #include "inferior.h" |
| 26 #include "target.h" | 26 #include "target.h" |
| 27 #include "linux-nat.h" | 27 #include "linux-nat.h" |
| 28 #include "auxv.h" | 28 #include "auxv.h" |
| 29 #include "gregset.h" |
| 29 | 30 |
| 30 #include "s390-tdep.h" | 31 #include "s390-tdep.h" |
| 31 #include "elf/common.h" | 32 #include "elf/common.h" |
| 32 | 33 |
| 33 #include <asm/ptrace.h> | 34 #include <asm/ptrace.h> |
| 34 #include <sys/ptrace.h> | 35 #include <sys/ptrace.h> |
| 35 #include <asm/types.h> | 36 #include <asm/types.h> |
| 36 #include <sys/procfs.h> | 37 #include <sys/procfs.h> |
| 37 #include <sys/ucontext.h> | 38 #include <sys/ucontext.h> |
| 38 #include <elf.h> | 39 #include <elf.h> |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 /* Do not report this watchpoint again. */ | 466 /* Do not report this watchpoint again. */ |
| 466 memset (&per_lowcore, 0, sizeof (per_lowcore)); | 467 memset (&per_lowcore, 0, sizeof (per_lowcore)); |
| 467 if (ptrace (PTRACE_POKEUSR_AREA, s390_inferior_tid (), &parea) < 0) | 468 if (ptrace (PTRACE_POKEUSR_AREA, s390_inferior_tid (), &parea) < 0) |
| 468 perror_with_name (_("Couldn't clear watchpoint status")); | 469 perror_with_name (_("Couldn't clear watchpoint status")); |
| 469 } | 470 } |
| 470 | 471 |
| 471 return result; | 472 return result; |
| 472 } | 473 } |
| 473 | 474 |
| 474 static void | 475 static void |
| 475 s390_fix_watch_points (ptid_t ptid) | 476 s390_fix_watch_points (struct lwp_info *lp) |
| 476 { | 477 { |
| 477 int tid; | 478 int tid; |
| 478 | 479 |
| 479 per_struct per_info; | 480 per_struct per_info; |
| 480 ptrace_area parea; | 481 ptrace_area parea; |
| 481 | 482 |
| 482 CORE_ADDR watch_lo_addr = (CORE_ADDR)-1, watch_hi_addr = 0; | 483 CORE_ADDR watch_lo_addr = (CORE_ADDR)-1, watch_hi_addr = 0; |
| 483 struct watch_area *area; | 484 struct watch_area *area; |
| 484 | 485 |
| 485 tid = TIDGET (ptid); | 486 tid = TIDGET (lp->ptid); |
| 486 if (tid == 0) | 487 if (tid == 0) |
| 487 tid = PIDGET (ptid); | 488 tid = PIDGET (lp->ptid); |
| 488 | 489 |
| 489 for (area = watch_base; area; area = area->next) | 490 for (area = watch_base; area; area = area->next) |
| 490 { | 491 { |
| 491 watch_lo_addr = min (watch_lo_addr, area->lo_addr); | 492 watch_lo_addr = min (watch_lo_addr, area->lo_addr); |
| 492 watch_hi_addr = max (watch_hi_addr, area->hi_addr); | 493 watch_hi_addr = max (watch_hi_addr, area->hi_addr); |
| 493 } | 494 } |
| 494 | 495 |
| 495 parea.len = sizeof (per_info); | 496 parea.len = sizeof (per_info); |
| 496 parea.process_addr = (addr_t) & per_info; | 497 parea.process_addr = (addr_t) & per_info; |
| 497 parea.kernel_addr = offsetof (struct user_regs_struct, per_info); | 498 parea.kernel_addr = offsetof (struct user_regs_struct, per_info); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 525 if (!area) | 526 if (!area) |
| 526 return -1; | 527 return -1; |
| 527 | 528 |
| 528 area->lo_addr = addr; | 529 area->lo_addr = addr; |
| 529 area->hi_addr = addr + len - 1; | 530 area->hi_addr = addr + len - 1; |
| 530 | 531 |
| 531 area->next = watch_base; | 532 area->next = watch_base; |
| 532 watch_base = area; | 533 watch_base = area; |
| 533 | 534 |
| 534 ALL_LWPS (lp) | 535 ALL_LWPS (lp) |
| 535 s390_fix_watch_points (lp->ptid); | 536 s390_fix_watch_points (lp); |
| 536 return 0; | 537 return 0; |
| 537 } | 538 } |
| 538 | 539 |
| 539 static int | 540 static int |
| 540 s390_remove_watchpoint (CORE_ADDR addr, int len, int type, | 541 s390_remove_watchpoint (CORE_ADDR addr, int len, int type, |
| 541 struct expression *cond) | 542 struct expression *cond) |
| 542 { | 543 { |
| 543 struct lwp_info *lp; | 544 struct lwp_info *lp; |
| 544 struct watch_area *area, **parea; | 545 struct watch_area *area, **parea; |
| 545 | 546 |
| 546 for (parea = &watch_base; *parea; parea = &(*parea)->next) | 547 for (parea = &watch_base; *parea; parea = &(*parea)->next) |
| 547 if ((*parea)->lo_addr == addr | 548 if ((*parea)->lo_addr == addr |
| 548 && (*parea)->hi_addr == addr + len - 1) | 549 && (*parea)->hi_addr == addr + len - 1) |
| 549 break; | 550 break; |
| 550 | 551 |
| 551 if (!*parea) | 552 if (!*parea) |
| 552 { | 553 { |
| 553 fprintf_unfiltered (gdb_stderr, | 554 fprintf_unfiltered (gdb_stderr, |
| 554 "Attempt to remove nonexistent watchpoint.\n"); | 555 "Attempt to remove nonexistent watchpoint.\n"); |
| 555 return -1; | 556 return -1; |
| 556 } | 557 } |
| 557 | 558 |
| 558 area = *parea; | 559 area = *parea; |
| 559 *parea = area->next; | 560 *parea = area->next; |
| 560 xfree (area); | 561 xfree (area); |
| 561 | 562 |
| 562 ALL_LWPS (lp) | 563 ALL_LWPS (lp) |
| 563 s390_fix_watch_points (lp->ptid); | 564 s390_fix_watch_points (lp); |
| 564 return 0; | 565 return 0; |
| 565 } | 566 } |
| 566 | 567 |
| 567 static int | 568 static int |
| 568 s390_can_use_hw_breakpoint (int type, int cnt, int othertype) | 569 s390_can_use_hw_breakpoint (int type, int cnt, int othertype) |
| 569 { | 570 { |
| 570 return type == bp_hardware_watchpoint; | 571 return type == bp_hardware_watchpoint; |
| 571 } | 572 } |
| 572 | 573 |
| 573 static int | 574 static int |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 t->to_remove_watchpoint = s390_remove_watchpoint; | 691 t->to_remove_watchpoint = s390_remove_watchpoint; |
| 691 | 692 |
| 692 /* Detect target architecture. */ | 693 /* Detect target architecture. */ |
| 693 t->to_read_description = s390_read_description; | 694 t->to_read_description = s390_read_description; |
| 694 t->to_auxv_parse = s390_auxv_parse; | 695 t->to_auxv_parse = s390_auxv_parse; |
| 695 | 696 |
| 696 /* Register the target. */ | 697 /* Register the target. */ |
| 697 linux_nat_add_target (t); | 698 linux_nat_add_target (t); |
| 698 linux_nat_set_new_thread (t, s390_fix_watch_points); | 699 linux_nat_set_new_thread (t, s390_fix_watch_points); |
| 699 } | 700 } |
| OLD | NEW |