From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14356 invoked by alias); 6 Feb 2014 20:55:57 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 14283 invoked by uid 89); 6 Feb 2014 20:55:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 06 Feb 2014 20:55:49 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s16KtkpO003745 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 6 Feb 2014 15:55:47 -0500 Received: from barimba.redhat.com (ovpn-113-148.phx2.redhat.com [10.3.113.148]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s16KtfZS013306; Thu, 6 Feb 2014 15:55:45 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFC v2 07/38] Add target_ops argument to to_close Date: Thu, 06 Feb 2014 20:56:00 -0000 Message-Id: <1391720136-2121-8-git-send-email-tromey@redhat.com> In-Reply-To: <1391720136-2121-1-git-send-email-tromey@redhat.com> References: <1391720136-2121-1-git-send-email-tromey@redhat.com> X-SW-Source: 2014-02/txt/msg00146.txt.bz2 2014-02-06 Tom Tromey * windows-nat.c (windows_close): Add 'self' argument. * tracepoint.c (tfile_close): Add 'self' argument. * target.h (struct target_ops) : Add argument. * target.c (target_close): Add argument. (update_current_target): Update. * remote.c (remote_close): Add 'self' argument. * remote-sim.c (gdbsim_close): Add 'self' argument. * remote-mips.c (mips_close): Add 'self' argument. * remote-m32r-sdi.c (m32r_close): Add 'self' argument. * record-full.c (record_full_close): Add 'self' argument. * record-btrace.c (record_btrace_close): Add 'self' argument. * monitor.h (monitor_close): Add 'self' argument. * monitor.c (monitor_close): Add 'self' argument. * mips-linux-nat.c (mips_linux_close): Add 'self' argument. * linux-nat.c (linux_nat_close): Add argument. * go32-nat.c (go32_close): Add 'self' argument. * exec.c (exec_close_1): Add 'self' argument. * ctf.c (ctf_close): Add 'self' argument. * corelow.c (core_close): Add 'self' argument. (core_close_cleanup): Update. * bsd-uthread.c (bsd_uthread_close): Add 'self' argument. * bsd-kvm.c (bsd_kvm_close): Add 'self' argument. Add target_ops argument to to_post_attach 2014-02-06 Tom Tromey * target.h (struct target_ops) : Add argument. (target_post_attach): Add argument. * target.c (debug_to_post_attach): Add argument. (update_current_target): Update. * spu-linux-nat.c (spu_child_post_attach): Add 'self' argument. * nto-procfs.c (procfs_post_attach): Add 'self' argument. * linux-nat.c (linux_child_post_attach): Add 'self' argument. * inf-ptrace.c (inf_ptrace_post_attach): Add 'self' argument. * inf-child.c (inf_child_post_attach): Add 'self' argument. Add target_ops argument to to_can_use_hw_breakpoint 2014-02-06 Tom Tromey * target.h (struct target_ops) : Add argument. (target_can_use_hardware_watchpoint): Add argument. * target.c (debug_to_can_use_hw_breakpoint): Add argument. (update_current_target): Update. * spu-linux-nat.c (spu_can_use_hw_breakpoint): Add 'self' argument. * s390-linux-nat.c (s390_can_use_hw_breakpoint): Add 'self' argument. * remote.c (remote_check_watch_resources): Add 'self' argument. * remote-mips.c (mips_can_use_watchpoint): Add 'self' argument. * remote-m32r-sdi.c (m32r_can_use_hw_watchpoint): Add 'self' argument. * procfs.c (procfs_can_use_hw_breakpoint): Add 'self' argument. * ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Add 'self' argument. * nto-procfs.c (procfs_can_use_hw_breakpoint): Add 'self' argument. * mips-linux-nat.c (mips_linux_can_use_hw_breakpoint): Add 'self' argument. * inf-ttrace.c (inf_ttrace_can_use_hw_breakpoint): Add 'self' argument. * ia64-linux-nat.c (ia64_linux_can_use_hw_breakpoint): Add 'self' argument. * ia64-hpux-nat.c (ia64_hpux_can_use_hw_breakpoint): Add 'self' argument. * i386-nat.c (i386_can_use_hw_breakpoint): Add 'self' argument. * arm-linux-nat.c (arm_linux_can_use_hw_breakpoint): Add 'self' argument. * aarch64-linux-nat.c (aarch64_linux_can_use_hw_breakpoint): Add 'self' argument. Add target_ops argument to to_insert_hw_breakpoint 2014-02-06 Tom Tromey * target.h (struct target_ops) : Add argument. (target_insert_hw_breakpoint): Add argument. * target.c (debug_to_insert_hw_breakpoint): Add argument. (update_current_target): Update. * remote.c (remote_insert_hw_breakpoint): Add 'self' argument. * ppc-linux-nat.c (ppc_linux_insert_hw_breakpoint): Add 'self' argument. * nto-procfs.c (procfs_insert_hw_breakpoint): Add 'self' argument. * i386-nat.c (i386_insert_hw_breakpoint): Add 'self' argument. * arm-linux-nat.c (arm_linux_insert_hw_breakpoint): Add 'self' argument. * aarch64-linux-nat.c (aarch64_linux_insert_hw_breakpoint): Add 'self' argument. Add target_ops argument to to_remove_hw_breakpoint 2014-02-06 Tom Tromey * target.h (struct target_ops) : Add argument. (target_remove_hw_breakpoint): Add argument. * target.c (debug_to_remove_hw_breakpoint): Add argument. (update_current_target): Update. * remote.c (remote_remove_hw_breakpoint): Add 'self' argument. * ppc-linux-nat.c (ppc_linux_remove_hw_breakpoint): Add 'self' argument. * i386-nat.c (i386_remove_hw_breakpoint): Add 'self' argument. * arm-linux-nat.c (arm_linux_remove_hw_breakpoint): Add 'self' argument. * aarch64-linux-nat.c (aarch64_linux_remove_hw_breakpoint): Add 'self' argument. Add target_ops argument to to_remove_watchpoint 2014-02-06 Tom Tromey * target.h (struct target_ops) : Add argument. (target_remove_watchpoint): Add argument. * target.c (debug_to_remove_watchpoint): Add argument. (update_current_target): Update. * s390-linux-nat.c (s390_remove_watchpoint): Add 'self' argument. * remote.c (remote_remove_watchpoint): Add 'self' argument. * remote-mips.c (mips_remove_watchpoint): Add 'self' argument. * remote-m32r-sdi.c (m32r_remove_watchpoint): Add 'self' argument. * procfs.c (procfs_remove_watchpoint): Add 'self' argument. * ppc-linux-nat.c (ppc_linux_remove_watchpoint): Add 'self' argument. * nto-procfs.c (procfs_remove_hw_watchpoint): Add 'self' argument. * mips-linux-nat.c (mips_linux_remove_watchpoint): Add 'self' argument. * inf-ttrace.c (inf_ttrace_remove_watchpoint): Add 'self' argument. * ia64-linux-nat.c (ia64_linux_remove_watchpoint): Add 'self' argument. * i386-nat.c (i386_remove_watchpoint): Add 'self' argument. * arm-linux-nat.c (arm_linux_remove_watchpoint): Add 'self' argument. * aarch64-linux-nat.c (aarch64_linux_remove_watchpoint): Add 'self' argument. Add target_ops argument to to_insert_watchpoint 2014-02-06 Tom Tromey * target.h (struct target_ops) : Add argument. (target_insert_watchpoint): Add argument. * target.c (debug_to_insert_watchpoint): Add argument. (update_current_target): Update. * s390-linux-nat.c (s390_insert_watchpoint): Add 'self' argument. * remote.c (remote_insert_watchpoint): Add 'self' argument. * remote-mips.c (mips_insert_watchpoint): Add 'self' argument. * remote-m32r-sdi.c (m32r_insert_watchpoint): Add 'self' argument. * procfs.c (procfs_insert_watchpoint): Add 'self' argument. * ppc-linux-nat.c (ppc_linux_insert_watchpoint): Add 'self' argument. * nto-procfs.c (procfs_insert_hw_watchpoint): Add 'self' argument. (procfs_insert_hw_watchpoint): Add 'self' argument. * mips-linux-nat.c (mips_linux_insert_watchpoint): Add 'self' argument. * inf-ttrace.c (inf_ttrace_insert_watchpoint): Add 'self' argument. * ia64-linux-nat.c (ia64_linux_insert_watchpoint): Add 'self' argument. * i386-nat.c (i386_insert_watchpoint): Add 'self' argument. * arm-linux-nat.c (arm_linux_insert_watchpoint): Add 'self' argument. * aarch64-linux-nat.c (aarch64_linux_insert_watchpoint): Add 'self' argument. Add target_ops argument to to_region_ok_for_hw_watchpoint 2014-02-06 Tom Tromey * target.h (struct target_ops) : Add argument. (target_region_ok_for_hw_watchpoint): Add argument. * target.c (debug_to_region_ok_for_hw_watchpoint): Add argument. (default_region_ok_for_hw_watchpoint): Add argument. * spu-multiarch.c (spu_region_ok_for_hw_watchpoint): Add argument. * s390-linux-nat.c (s390_region_ok_for_hw_watchpoint): Add 'self' argument. * remote.c (remote_region_ok_for_hw_watchpoint): Add 'self' argument. * procfs.c (procfs_region_ok_for_hw_watchpoint): Add 'self' argument. * ppc-linux-nat.c (ppc_linux_region_ok_for_hw_watchpoint): Add 'self' argument. * mips-linux-nat.c (mips_linux_region_ok_for_hw_watchpoint): Add 'self' argument. * inf-ttrace.c (inf_ttrace_region_ok_for_hw_watchpoint): Add 'self' argument. * i386-nat.c (i386_region_ok_for_watchpoint): Add 'self' argument. * arm-linux-nat.c (arm_linux_region_ok_for_hw_watchpoint): Add 'self' argument. * aarch64-linux-nat.c (aarch64_linux_region_ok_for_hw_watchpoint): Add 'self' argument. Add target_ops argument to to_can_accel_watchpoint_condition 2014-02-06 Tom Tromey * target.h (struct target_ops) : Add argument. (target_can_accel_watchpoint_condition): Add argument. * target.c (debug_to_can_accel_watchpoint_condition): Add argument. (update_current_target): Update. * ppc-linux-nat.c (ppc_linux_can_accel_watchpoint_condition): Add 'self' argument. --- gdb/ChangeLog | 196 ++++++++++++++++++++++++++++++++++++++++++++++++ gdb/aarch64-linux-nat.c | 18 +++-- gdb/arm-linux-nat.c | 18 +++-- gdb/bsd-kvm.c | 2 +- gdb/bsd-uthread.c | 2 +- gdb/corelow.c | 6 +- gdb/ctf.c | 2 +- gdb/exec.c | 2 +- gdb/go32-nat.c | 3 +- gdb/i386-nat.c | 16 ++-- gdb/ia64-hpux-nat.c | 3 +- gdb/ia64-linux-nat.c | 9 ++- gdb/inf-child.c | 2 +- gdb/inf-ptrace.c | 2 +- gdb/inf-ttrace.c | 12 ++- gdb/linux-nat.c | 6 +- gdb/mips-linux-nat.c | 14 ++-- gdb/monitor.c | 2 +- gdb/monitor.h | 2 +- gdb/nto-procfs.c | 22 ++++-- gdb/ppc-linux-nat.c | 21 ++++-- gdb/procfs.c | 15 ++-- gdb/record-btrace.c | 2 +- gdb/record-full.c | 2 +- gdb/remote-m32r-sdi.c | 11 ++- gdb/remote-mips.c | 13 ++-- gdb/remote-sim.c | 4 +- gdb/remote.c | 20 +++-- gdb/s390-linux-nat.c | 12 ++- gdb/spu-linux-nat.c | 5 +- gdb/spu-multiarch.c | 6 +- gdb/target.c | 96 +++++++++++++++--------- gdb/target.h | 47 +++++++----- gdb/tracepoint.c | 2 +- gdb/windows-nat.c | 2 +- 35 files changed, 448 insertions(+), 149 deletions(-) diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index 703c4ed..c6437fe 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -941,7 +941,8 @@ aarch64_align_watchpoint (CORE_ADDR addr, int len, CORE_ADDR *aligned_addr_p, sharing implemented via reference counts. */ static int -aarch64_linux_can_use_hw_breakpoint (int type, int cnt, int othertype) +aarch64_linux_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int othertype) { return 1; } @@ -1201,7 +1202,8 @@ aarch64_handle_breakpoint (int type, CORE_ADDR addr, int len, int is_insert) Return 0 on success, -1 on failure. */ static int -aarch64_linux_insert_hw_breakpoint (struct gdbarch *gdbarch, +aarch64_linux_insert_hw_breakpoint (struct target_ops *self, + struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { int ret; @@ -1233,7 +1235,8 @@ aarch64_linux_insert_hw_breakpoint (struct gdbarch *gdbarch, Return 0 on success, -1 on failure. */ static int -aarch64_linux_remove_hw_breakpoint (struct gdbarch *gdbarch, +aarch64_linux_remove_hw_breakpoint (struct target_ops *self, + struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { int ret; @@ -1337,7 +1340,8 @@ aarch64_handle_watchpoint (int type, CORE_ADDR addr, int len, int is_insert) of the type TYPE. Return 0 on success, -1 on failure. */ static int -aarch64_linux_insert_watchpoint (CORE_ADDR addr, int len, int type, +aarch64_linux_insert_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { int ret; @@ -1369,7 +1373,8 @@ aarch64_linux_insert_watchpoint (CORE_ADDR addr, int len, int type, type TYPE. Return 0 on success, -1 on failure. */ static int -aarch64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type, +aarch64_linux_remove_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { int ret; @@ -1398,7 +1403,8 @@ aarch64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type, /* Implement the "to_region_ok_for_hw_watchpoint" target_ops method. */ static int -aarch64_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) +aarch64_linux_region_ok_for_hw_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len) { CORE_ADDR aligned_addr; diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 9fa5f5b..75f58ca 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -747,7 +747,8 @@ arm_linux_get_hw_watchpoint_count (void) /* Have we got a free break-/watch-point available for use? Returns -1 if there is not an appropriate resource available, otherwise returns 1. */ static int -arm_linux_can_use_hw_breakpoint (int type, int cnt, int ot) +arm_linux_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int ot) { if (type == bp_hardware_watchpoint || type == bp_read_watchpoint || type == bp_access_watchpoint || type == bp_watchpoint) @@ -1036,7 +1037,8 @@ arm_linux_remove_hw_breakpoint1 (const struct arm_linux_hw_breakpoint *bpt, /* Insert a Hardware breakpoint. */ static int -arm_linux_insert_hw_breakpoint (struct gdbarch *gdbarch, +arm_linux_insert_hw_breakpoint (struct target_ops *self, + struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { struct lwp_info *lp; @@ -1054,7 +1056,8 @@ arm_linux_insert_hw_breakpoint (struct gdbarch *gdbarch, /* Remove a hardware breakpoint. */ static int -arm_linux_remove_hw_breakpoint (struct gdbarch *gdbarch, +arm_linux_remove_hw_breakpoint (struct target_ops *self, + struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { struct lwp_info *lp; @@ -1073,7 +1076,8 @@ arm_linux_remove_hw_breakpoint (struct gdbarch *gdbarch, /* Are we able to use a hardware watchpoint for the LEN bytes starting at ADDR? */ static int -arm_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) +arm_linux_region_ok_for_hw_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len) { const struct arm_linux_hwbp_cap *cap = arm_linux_get_hwbp_cap (); CORE_ADDR max_wp_length, aligned_addr; @@ -1105,7 +1109,8 @@ arm_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) /* Insert a Hardware breakpoint. */ static int -arm_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, +arm_linux_insert_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int rw, struct expression *cond) { struct lwp_info *lp; @@ -1123,7 +1128,8 @@ arm_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, /* Remove a hardware breakpoint. */ static int -arm_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw, +arm_linux_remove_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int rw, struct expression *cond) { struct lwp_info *lp; diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c index cfa8867..f57ae72 100644 --- a/gdb/bsd-kvm.c +++ b/gdb/bsd-kvm.c @@ -105,7 +105,7 @@ bsd_kvm_open (char *filename, int from_tty) } static void -bsd_kvm_close (void) +bsd_kvm_close (struct target_ops *self) { if (core_kd) { diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index 4683abf..39218ba 100644 --- a/gdb/bsd-uthread.c +++ b/gdb/bsd-uthread.c @@ -204,7 +204,7 @@ bsd_uthread_activate (struct objfile *objfile) /* Cleanup due to deactivation. */ static void -bsd_uthread_close (void) +bsd_uthread_close (struct target_ops *self) { bsd_uthread_active = 0; bsd_uthread_thread_run_addr = 0; diff --git a/gdb/corelow.c b/gdb/corelow.c index 2d4a719..1198a51 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -85,7 +85,7 @@ static int gdb_check_format (bfd *); static void core_open (char *, int); -static void core_close (void); +static void core_close (struct target_ops *self); static void core_close_cleanup (void *ignore); @@ -192,7 +192,7 @@ gdb_check_format (bfd *abfd) stack spaces as empty. */ static void -core_close (void) +core_close (struct target_ops *self) { if (core_bfd) { @@ -223,7 +223,7 @@ core_close (void) static void core_close_cleanup (void *ignore) { - core_close (); + core_close (NULL); } /* Look for sections whose names start with `.reg/' so that we can diff --git a/gdb/ctf.c b/gdb/ctf.c index 6035c2b..6caca5f 100644 --- a/gdb/ctf.c +++ b/gdb/ctf.c @@ -1204,7 +1204,7 @@ ctf_open (char *dirname, int from_tty) CTF iterator and context. */ static void -ctf_close (void) +ctf_close (struct target_ops *self) { int pid; diff --git a/gdb/exec.c b/gdb/exec.c index b5aa7f2..cc7fa13 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -112,7 +112,7 @@ exec_close (void) sections and closes all executable bfds from all program spaces. */ static void -exec_close_1 (void) +exec_close_1 (struct target_ops *self) { using_exec_ops = 0; diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index 7dc6307..1529cc3 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -234,7 +234,6 @@ static int dr_ref_count[4]; #define SOME_PID 42 static int prog_has_started = 0; - static void go32_mourn_inferior (struct target_ops *ops); static struct target_ops go32_ops; @@ -347,7 +346,7 @@ go32_open (char *name, int from_tty) } static void -go32_close (void) +go32_close (struct target_ops *self) { } diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c index 23edc38..2f80a6e 100644 --- a/gdb/i386-nat.c +++ b/gdb/i386-nat.c @@ -589,7 +589,8 @@ i386_update_inferior_debug_regs (struct i386_debug_reg_state *new_state) of the type TYPE. Return 0 on success, -1 on failure. */ static int -i386_insert_watchpoint (CORE_ADDR addr, int len, int type, +i386_insert_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { struct i386_debug_reg_state *state @@ -627,7 +628,8 @@ i386_insert_watchpoint (CORE_ADDR addr, int len, int type, address ADDR, whose length is LEN bytes, and for accesses of the type TYPE. Return 0 on success, -1 on failure. */ static int -i386_remove_watchpoint (CORE_ADDR addr, int len, int type, +i386_remove_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { struct i386_debug_reg_state *state @@ -662,7 +664,8 @@ i386_remove_watchpoint (CORE_ADDR addr, int len, int type, address ADDR and whose length is LEN bytes. */ static int -i386_region_ok_for_watchpoint (CORE_ADDR addr, int len) +i386_region_ok_for_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len) { struct i386_debug_reg_state *state = i386_debug_reg_state (ptid_get_pid (inferior_ptid)); @@ -765,7 +768,7 @@ i386_stopped_by_watchpoint (struct target_ops *ops) /* Insert a hardware-assisted breakpoint at BP_TGT->placed_address. Return 0 on success, EBUSY on failure. */ static int -i386_insert_hw_breakpoint (struct gdbarch *gdbarch, +i386_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { struct i386_debug_reg_state *state @@ -791,7 +794,7 @@ i386_insert_hw_breakpoint (struct gdbarch *gdbarch, Return 0 on success, -1 on failure. */ static int -i386_remove_hw_breakpoint (struct gdbarch *gdbarch, +i386_remove_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { struct i386_debug_reg_state *state @@ -831,7 +834,8 @@ i386_remove_hw_breakpoint (struct gdbarch *gdbarch, sharing implemented via reference counts in i386-nat.c. */ static int -i386_can_use_hw_breakpoint (int type, int cnt, int othertype) +i386_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int othertype) { return 1; } diff --git a/gdb/ia64-hpux-nat.c b/gdb/ia64-hpux-nat.c index 2b0e889..c5053fc 100644 --- a/gdb/ia64-hpux-nat.c +++ b/gdb/ia64-hpux-nat.c @@ -694,7 +694,8 @@ ia64_hpux_xfer_partial (struct target_ops *ops, enum target_object object, /* The "to_can_use_hw_breakpoint" target_ops routine for ia64-hpux. */ static int -ia64_hpux_can_use_hw_breakpoint (int type, int cnt, int othertype) +ia64_hpux_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int othertype) { /* No hardware watchpoint/breakpoint support yet. */ return 0; diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c index ea575c8..ccd55b2 100644 --- a/gdb/ia64-linux-nat.c +++ b/gdb/ia64-linux-nat.c @@ -542,7 +542,8 @@ is_power_of_2 (int val) } static int -ia64_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, +ia64_linux_insert_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int rw, struct expression *cond) { struct lwp_info *lp; @@ -596,7 +597,8 @@ ia64_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, } static int -ia64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type, +ia64_linux_remove_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { int idx; @@ -676,7 +678,8 @@ ia64_linux_stopped_by_watchpoint (struct target_ops *ops) } static int -ia64_linux_can_use_hw_breakpoint (int type, int cnt, int othertype) +ia64_linux_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int othertype) { return 1; } diff --git a/gdb/inf-child.c b/gdb/inf-child.c index 549e44a..c142912 100644 --- a/gdb/inf-child.c +++ b/gdb/inf-child.c @@ -87,7 +87,7 @@ inf_child_store_inferior_registers (struct target_ops *ops, } static void -inf_child_post_attach (int pid) +inf_child_post_attach (struct target_ops *self, int pid) { /* This version of Unix doesn't require a meaningful "post attach" operation by a debugger. */ diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index a64c876..d054126 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -246,7 +246,7 @@ inf_ptrace_attach (struct target_ops *ops, char *args, int from_tty) #ifdef PT_GET_PROCESS_STATE static void -inf_ptrace_post_attach (int pid) +inf_ptrace_post_attach (struct target_ops *self, int pid) { ptrace_event_t pe; diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c index de95ec7..e9da0e7 100644 --- a/gdb/inf-ttrace.c +++ b/gdb/inf-ttrace.c @@ -314,7 +314,8 @@ inf_ttrace_disable_page_protections (pid_t pid) type TYPE. */ static int -inf_ttrace_insert_watchpoint (CORE_ADDR addr, int len, int type, +inf_ttrace_insert_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { const int pagesize = inf_ttrace_page_dict.pagesize; @@ -338,7 +339,8 @@ inf_ttrace_insert_watchpoint (CORE_ADDR addr, int len, int type, type TYPE. */ static int -inf_ttrace_remove_watchpoint (CORE_ADDR addr, int len, int type, +inf_ttrace_remove_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { const int pagesize = inf_ttrace_page_dict.pagesize; @@ -359,13 +361,15 @@ inf_ttrace_remove_watchpoint (CORE_ADDR addr, int len, int type, } static int -inf_ttrace_can_use_hw_breakpoint (int type, int len, int ot) +inf_ttrace_can_use_hw_breakpoint (struct target_ops *self, + int type, int len, int ot) { return (type == bp_hardware_watchpoint); } static int -inf_ttrace_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) +inf_ttrace_region_ok_for_hw_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len) { return 1; } diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index e5938d3..0475eb3 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -329,7 +329,7 @@ linux_init_ptrace (pid_t pid) } static void -linux_child_post_attach (int pid) +linux_child_post_attach (struct target_ops *self, int pid) { linux_init_ptrace (pid); } @@ -4751,14 +4751,14 @@ linux_nat_stop (ptid_t ptid) } static void -linux_nat_close (void) +linux_nat_close (struct target_ops *self) { /* Unregister from the event loop. */ if (linux_nat_is_async_p (NULL)) linux_nat_async (NULL, NULL, 0); if (linux_ops->to_close) - linux_ops->to_close (); + linux_ops->to_close (linux_ops); } /* When requests are passed down from the linux-nat layer to the diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index 627241f..4c28733 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -512,7 +512,8 @@ mips_show_dr (const char *func, CORE_ADDR addr, handle the specified watch type. */ static int -mips_linux_can_use_hw_breakpoint (int type, int cnt, int ot) +mips_linux_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int ot) { int i; uint32_t wanted_mask, irw_mask; @@ -588,7 +589,8 @@ mips_linux_stopped_data_address (struct target_ops *t, CORE_ADDR *paddr) the specified region can be covered by the watch registers. */ static int -mips_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) +mips_linux_region_ok_for_hw_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len) { struct pt_watch_regs dummy_regs; int i; @@ -644,7 +646,8 @@ mips_linux_new_thread (struct lwp_info *lp) watch. Return zero on success. */ static int -mips_linux_insert_watchpoint (CORE_ADDR addr, int len, int type, +mips_linux_insert_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { struct pt_watch_regs regs; @@ -697,7 +700,8 @@ mips_linux_insert_watchpoint (CORE_ADDR addr, int len, int type, Return zero on success. */ static int -mips_linux_remove_watchpoint (CORE_ADDR addr, int len, int type, +mips_linux_remove_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { int retval; @@ -744,7 +748,7 @@ mips_linux_remove_watchpoint (CORE_ADDR addr, int len, int type, super implementation. */ static void -mips_linux_close (void) +mips_linux_close (struct target_ops *self) { struct mips_watchpoint *w; struct mips_watchpoint *nw; diff --git a/gdb/monitor.c b/gdb/monitor.c index 29c3f71..8129d20 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -853,7 +853,7 @@ monitor_open (char *args, struct monitor_ops *mon_ops, int from_tty) control. */ void -monitor_close (void) +monitor_close (struct target_ops *self) { if (monitor_desc) serial_close (monitor_desc); diff --git a/gdb/monitor.h b/gdb/monitor.h index c7e7af8..07caf97 100644 --- a/gdb/monitor.h +++ b/gdb/monitor.h @@ -240,7 +240,7 @@ struct monitor_ops #define SREC_SIZE 160 extern void monitor_open (char *args, struct monitor_ops *ops, int from_tty); -extern void monitor_close (void); +extern void monitor_close (struct target_ops *self); extern char *monitor_supply_register (struct regcache *regcache, int regno, char *valstr); extern int monitor_expect (char *prompt, char *buf, int buflen); diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index 7739197..0a7ed55 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -67,12 +67,15 @@ static void init_procfs_ops (void); static ptid_t do_attach (ptid_t ptid); -static int procfs_can_use_hw_breakpoint (int, int, int); +static int procfs_can_use_hw_breakpoint (struct target_ops *self, + int, int, int); -static int procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type, +static int procfs_insert_hw_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond); -static int procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type, +static int procfs_remove_hw_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond); static int procfs_stopped_by_watchpoint (struct target_ops *ops); @@ -648,7 +651,7 @@ procfs_attach (struct target_ops *ops, char *args, int from_tty) } static void -procfs_post_attach (pid_t pid) +procfs_post_attach (struct target_ops *self, pid_t pid) { if (exec_bfd) solib_create_inferior_hook (0); @@ -936,7 +939,7 @@ procfs_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, } static int -procfs_insert_hw_breakpoint (struct gdbarch *gdbarch, +procfs_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { return procfs_breakpoint (bp_tgt->placed_address, @@ -1488,20 +1491,23 @@ procfs_hw_watchpoint (int addr, int len, int type) } static int -procfs_can_use_hw_breakpoint (int type, int cnt, int othertype) +procfs_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int othertype) { return 1; } static int -procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type, +procfs_remove_hw_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { return procfs_hw_watchpoint (addr, -1, type); } static int -procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type, +procfs_insert_hw_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { return procfs_hw_watchpoint (addr, len, type); diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index b38b33e..fcfd452 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -1444,7 +1444,8 @@ have_ptrace_hwdebug_interface (void) } static int -ppc_linux_can_use_hw_breakpoint (int type, int cnt, int ot) +ppc_linux_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int ot) { int total_hw_wp, total_hw_bp; @@ -1496,7 +1497,8 @@ ppc_linux_can_use_hw_breakpoint (int type, int cnt, int ot) } static int -ppc_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) +ppc_linux_region_ok_for_hw_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len) { /* Handle sub-8-byte quantities. */ if (len <= 0) @@ -1672,7 +1674,8 @@ ppc_linux_ranged_break_num_registers (struct target_ops *target) success, 1 if hardware breakpoints are not supported or -1 for failure. */ static int -ppc_linux_insert_hw_breakpoint (struct gdbarch *gdbarch, +ppc_linux_insert_hw_breakpoint (struct target_ops *self, + struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { struct lwp_info *lp; @@ -1708,7 +1711,8 @@ ppc_linux_insert_hw_breakpoint (struct gdbarch *gdbarch, } static int -ppc_linux_remove_hw_breakpoint (struct gdbarch *gdbarch, +ppc_linux_remove_hw_breakpoint (struct target_ops *self, + struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { struct lwp_info *lp; @@ -2011,7 +2015,8 @@ check_condition (CORE_ADDR watch_addr, struct expression *cond, the condition expression, thus only triggering the watchpoint when it is true. */ static int -ppc_linux_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw, +ppc_linux_can_accel_watchpoint_condition (struct target_ops *self, + CORE_ADDR addr, int len, int rw, struct expression *cond) { CORE_ADDR data_value; @@ -2073,7 +2078,8 @@ create_watchpoint_request (struct ppc_hw_breakpoint *p, CORE_ADDR addr, } static int -ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, +ppc_linux_insert_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int rw, struct expression *cond) { struct lwp_info *lp; @@ -2141,7 +2147,8 @@ ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, } static int -ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw, +ppc_linux_remove_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int rw, struct expression *cond) { struct lwp_info *lp; diff --git a/gdb/procfs.c b/gdb/procfs.c index bd0829d..bd1ce41 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -140,7 +140,8 @@ static int proc_find_memory_regions (find_memory_region_ftype, void *); static char * procfs_make_note_section (bfd *, int *); -static int procfs_can_use_hw_breakpoint (int, int, int); +static int procfs_can_use_hw_breakpoint (struct target_ops *self, + int, int, int); static void procfs_info_proc (struct target_ops *, char *, enum info_proc_what); @@ -4832,7 +4833,8 @@ procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rwflag, target_can_use_hardware_watchpoint. */ static int -procfs_can_use_hw_breakpoint (int type, int cnt, int othertype) +procfs_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int othertype) { /* Due to the way that proc_set_watchpoint() is implemented, host and target pointers must be of the same size. If they are not, @@ -4895,7 +4897,8 @@ procfs_stopped_data_address (struct target_ops *targ, CORE_ADDR *addr) } static int -procfs_insert_watchpoint (CORE_ADDR addr, int len, int type, +procfs_insert_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { if (!target_have_steppable_watchpoint @@ -4917,14 +4920,16 @@ procfs_insert_watchpoint (CORE_ADDR addr, int len, int type, } static int -procfs_remove_watchpoint (CORE_ADDR addr, int len, int type, +procfs_remove_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { return procfs_set_watchpoint (inferior_ptid, addr, 0, 0, 0); } static int -procfs_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) +procfs_region_ok_for_hw_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len) { /* The man page for proc(4) on Solaris 2.6 and up says that the system can support "thousands" of hardware watchpoints, but gives diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index e1125b5..7d43330 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -211,7 +211,7 @@ record_btrace_stop_recording (void) /* The to_close method of target record-btrace. */ static void -record_btrace_close (void) +record_btrace_close (struct target_ops *self) { struct thread_info *tp; diff --git a/gdb/record-full.c b/gdb/record-full.c index d330892..fa9fbf5 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -877,7 +877,7 @@ record_full_open (char *name, int from_tty) /* "to_close" target method. Close the process record target. */ static void -record_full_close (void) +record_full_close (struct target_ops *self) { struct record_full_core_buf_entry *entry; diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index 48c4b4b..37649e4 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -429,7 +429,7 @@ m32r_open (char *args, int from_tty) /* Close out all files and local state before this target loses control. */ static void -m32r_close (void) +m32r_close (struct target_ops *self) { if (remote_debug) fprintf_unfiltered (gdb_stdlog, "m32r_close()\n"); @@ -1407,7 +1407,8 @@ m32r_stop (ptid_t ptid) implements the target_can_use_hardware_watchpoint macro. */ static int -m32r_can_use_hw_watchpoint (int type, int cnt, int othertype) +m32r_can_use_hw_watchpoint (struct target_ops *self, + int type, int cnt, int othertype) { return sdi_desc != NULL && cnt < max_access_breaks; } @@ -1417,7 +1418,8 @@ m32r_can_use_hw_watchpoint (int type, int cnt, int othertype) watchpoint. */ static int -m32r_insert_watchpoint (CORE_ADDR addr, int len, int type, +m32r_insert_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { int i; @@ -1442,7 +1444,8 @@ m32r_insert_watchpoint (CORE_ADDR addr, int len, int type, } static int -m32r_remove_watchpoint (CORE_ADDR addr, int len, int type, +m32r_remove_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { int i; diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 6109e64..e8ef449 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -84,7 +84,7 @@ static void ddb_open (char *name, int from_tty); static void lsi_open (char *name, int from_tty); -static void mips_close (void); +static void mips_close (struct target_ops *self); static int mips_map_regno (struct gdbarch *, int); @@ -1732,7 +1732,7 @@ lsi_open (char *name, int from_tty) /* Close a connection to the remote board. */ static void -mips_close (void) +mips_close (struct target_ops *self) { if (mips_is_open) { @@ -2391,7 +2391,8 @@ mips_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, implements the target_can_use_hardware_watchpoint macro. */ static int -mips_can_use_watchpoint (int type, int cnt, int othertype) +mips_can_use_watchpoint (struct target_ops *self, + int type, int cnt, int othertype) { return cnt < MAX_LSI_BREAKPOINTS && strcmp (target_shortname, "lsi") == 0; } @@ -2425,7 +2426,8 @@ calculate_mask (CORE_ADDR addr, int len) watchpoint. */ static int -mips_insert_watchpoint (CORE_ADDR addr, int len, int type, +mips_insert_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { if (mips_set_breakpoint (addr, len, type)) @@ -2437,7 +2439,8 @@ mips_insert_watchpoint (CORE_ADDR addr, int len, int type, /* Remove a watchpoint. */ static int -mips_remove_watchpoint (CORE_ADDR addr, int len, int type, +mips_remove_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { if (mips_clear_breakpoint (addr, len, type)) diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 9309087..220ce9d 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -76,7 +76,7 @@ static void gdbsim_load (char *prog, int fromtty); static void gdbsim_open (char *args, int from_tty); -static void gdbsim_close (void); +static void gdbsim_close (struct target_ops *self); static void gdbsim_detach (struct target_ops *ops, const char *args, int from_tty); @@ -788,7 +788,7 @@ gdbsim_close_inferior (struct inferior *inf, void *arg) /* Close out all files and local state before this target loses control. */ static void -gdbsim_close (void) +gdbsim_close (struct target_ops *self) { struct sim_inferior_data *sim_data = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED); diff --git a/gdb/remote.c b/gdb/remote.c index 88feab0..dedfc77 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -106,7 +106,7 @@ static void extended_remote_open (char *name, int from_tty); static void remote_open_1 (char *, int, struct target_ops *, int extended_p); -static void remote_close (void); +static void remote_close (struct target_ops *self); static void remote_mourn (struct target_ops *ops); @@ -3059,7 +3059,7 @@ extended_remote_restart (void) /* Clean up connection to a remote debugger. */ static void -remote_close (void) +remote_close (struct target_ops *self) { struct remote_state *rs = get_remote_state (); @@ -8371,7 +8371,8 @@ watchpoint_to_Z_packet (int type) } static int -remote_insert_watchpoint (CORE_ADDR addr, int len, int type, +remote_insert_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { struct remote_state *rs = get_remote_state (); @@ -8420,7 +8421,8 @@ remote_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr, static int -remote_remove_watchpoint (CORE_ADDR addr, int len, int type, +remote_remove_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { struct remote_state *rs = get_remote_state (); @@ -8462,7 +8464,8 @@ int remote_hw_watchpoint_length_limit = -1; int remote_hw_breakpoint_limit = -1; static int -remote_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) +remote_region_ok_for_hw_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len) { if (remote_hw_watchpoint_length_limit == 0) return 0; @@ -8475,7 +8478,8 @@ remote_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) } static int -remote_check_watch_resources (int type, int cnt, int ot) +remote_check_watch_resources (struct target_ops *self, + int type, int cnt, int ot) { if (type == bp_hardware_breakpoint) { @@ -8525,7 +8529,7 @@ remote_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p) static int -remote_insert_hw_breakpoint (struct gdbarch *gdbarch, +remote_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { CORE_ADDR addr; @@ -8589,7 +8593,7 @@ remote_insert_hw_breakpoint (struct gdbarch *gdbarch, static int -remote_remove_hw_breakpoint (struct gdbarch *gdbarch, +remote_remove_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { CORE_ADDR addr; diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c index 8cc9060..5c38952 100644 --- a/gdb/s390-linux-nat.c +++ b/gdb/s390-linux-nat.c @@ -508,7 +508,8 @@ s390_fix_watch_points (struct lwp_info *lp) } static int -s390_insert_watchpoint (CORE_ADDR addr, int len, int type, +s390_insert_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { struct lwp_info *lp; @@ -529,7 +530,8 @@ s390_insert_watchpoint (CORE_ADDR addr, int len, int type, } static int -s390_remove_watchpoint (CORE_ADDR addr, int len, int type, +s390_remove_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { struct lwp_info *lp; @@ -557,13 +559,15 @@ s390_remove_watchpoint (CORE_ADDR addr, int len, int type, } static int -s390_can_use_hw_breakpoint (int type, int cnt, int othertype) +s390_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int othertype) { return type == bp_hardware_watchpoint; } static int -s390_region_ok_for_hw_watchpoint (CORE_ADDR addr, int cnt) +s390_region_ok_for_hw_watchpoint (struct target_ops *self, + CORE_ADDR addr, int cnt) { return 1; } diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c index 784939b..ab80abf 100644 --- a/gdb/spu-linux-nat.c +++ b/gdb/spu-linux-nat.c @@ -409,7 +409,7 @@ spu_child_post_startup_inferior (ptid_t ptid) /* Override the post_attach routine to try load the SPE executable file image from its copy inside the target process. */ static void -spu_child_post_attach (int pid) +spu_child_post_attach (struct target_ops *self, int pid) { int fd; ULONGEST addr; @@ -606,7 +606,8 @@ spu_xfer_partial (struct target_ops *ops, /* Override the to_can_use_hw_breakpoint routine. */ static int -spu_can_use_hw_breakpoint (int type, int cnt, int othertype) +spu_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int othertype) { return 0; } diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c index 11a566a..dd842f1 100644 --- a/gdb/spu-multiarch.c +++ b/gdb/spu-multiarch.c @@ -118,7 +118,8 @@ spu_thread_architecture (struct target_ops *ops, ptid_t ptid) /* Override the to_region_ok_for_hw_watchpoint routine. */ static int -spu_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) +spu_region_ok_for_hw_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len) { struct target_ops *ops_beneath = find_target_beneath (&spu_ops); while (ops_beneath && !ops_beneath->to_region_ok_for_hw_watchpoint) @@ -129,7 +130,8 @@ spu_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) return 0; if (ops_beneath) - return ops_beneath->to_region_ok_for_hw_watchpoint (addr, len); + return ops_beneath->to_region_ok_for_hw_watchpoint (ops_beneath, + addr, len); return 0; } diff --git a/gdb/target.c b/gdb/target.c index 8ab9cbf..7ed433f 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -52,7 +52,8 @@ static void default_terminal_info (const char *, int); static int default_watchpoint_addr_within_range (struct target_ops *, CORE_ADDR, CORE_ADDR, int); -static int default_region_ok_for_hw_watchpoint (CORE_ADDR, int); +static int default_region_ok_for_hw_watchpoint (struct target_ops *, + CORE_ADDR, int); static void tcomplain (void) ATTRIBUTE_NORETURN; @@ -100,18 +101,23 @@ static int debug_to_insert_breakpoint (struct target_ops *, struct gdbarch *, static int debug_to_remove_breakpoint (struct target_ops *, struct gdbarch *, struct bp_target_info *); -static int debug_to_can_use_hw_breakpoint (int, int, int); +static int debug_to_can_use_hw_breakpoint (struct target_ops *self, + int, int, int); -static int debug_to_insert_hw_breakpoint (struct gdbarch *, +static int debug_to_insert_hw_breakpoint (struct target_ops *self, + struct gdbarch *, struct bp_target_info *); -static int debug_to_remove_hw_breakpoint (struct gdbarch *, +static int debug_to_remove_hw_breakpoint (struct target_ops *self, + struct gdbarch *, struct bp_target_info *); -static int debug_to_insert_watchpoint (CORE_ADDR, int, int, +static int debug_to_insert_watchpoint (struct target_ops *self, + CORE_ADDR, int, int, struct expression *); -static int debug_to_remove_watchpoint (CORE_ADDR, int, int, +static int debug_to_remove_watchpoint (struct target_ops *self, + CORE_ADDR, int, int, struct expression *); static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *); @@ -119,9 +125,11 @@ static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *); static int debug_to_watchpoint_addr_within_range (struct target_ops *, CORE_ADDR, CORE_ADDR, int); -static int debug_to_region_ok_for_hw_watchpoint (CORE_ADDR, int); +static int debug_to_region_ok_for_hw_watchpoint (struct target_ops *self, + CORE_ADDR, int); -static int debug_to_can_accel_watchpoint_condition (CORE_ADDR, int, int, +static int debug_to_can_accel_watchpoint_condition (struct target_ops *self, + CORE_ADDR, int, int, struct expression *); static void debug_to_terminal_init (void); @@ -718,10 +726,10 @@ update_current_target (void) (void (*) (char *, int)) tcomplain); de_fault (to_close, - (void (*) (void)) + (void (*) (struct target_ops *)) target_ignore); de_fault (to_post_attach, - (void (*) (int)) + (void (*) (struct target_ops *, int)) target_ignore); de_fault (to_prepare_to_store, (void (*) (struct target_ops *, struct regcache *)) @@ -734,26 +742,31 @@ update_current_target (void) (void (*) (struct target_ops *)) target_ignore); de_fault (to_can_use_hw_breakpoint, - (int (*) (int, int, int)) + (int (*) (struct target_ops *, int, int, int)) return_zero); de_fault (to_insert_hw_breakpoint, - (int (*) (struct gdbarch *, struct bp_target_info *)) + (int (*) (struct target_ops *, struct gdbarch *, + struct bp_target_info *)) return_minus_one); de_fault (to_remove_hw_breakpoint, - (int (*) (struct gdbarch *, struct bp_target_info *)) + (int (*) (struct target_ops *, struct gdbarch *, + struct bp_target_info *)) return_minus_one); de_fault (to_insert_watchpoint, - (int (*) (CORE_ADDR, int, int, struct expression *)) + (int (*) (struct target_ops *, CORE_ADDR, int, int, + struct expression *)) return_minus_one); de_fault (to_remove_watchpoint, - (int (*) (CORE_ADDR, int, int, struct expression *)) + (int (*) (struct target_ops *, CORE_ADDR, int, int, + struct expression *)) return_minus_one); de_fault (to_watchpoint_addr_within_range, default_watchpoint_addr_within_range); de_fault (to_region_ok_for_hw_watchpoint, default_region_ok_for_hw_watchpoint); de_fault (to_can_accel_watchpoint_condition, - (int (*) (CORE_ADDR, int, int, struct expression *)) + (int (*) (struct target_ops *, CORE_ADDR, int, int, + struct expression *)) return_zero); de_fault (to_terminal_init, (void (*) (void)) @@ -3571,7 +3584,8 @@ target_fileio_read_stralloc (const char *filename) static int -default_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) +default_region_ok_for_hw_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len) { return (len <= gdbarch_ptr_bit (target_gdbarch ()) / TARGET_CHAR_BIT); } @@ -3772,7 +3786,7 @@ target_close (struct target_ops *targ) if (targ->to_xclose != NULL) targ->to_xclose (targ); else if (targ->to_close != NULL) - targ->to_close (); + targ->to_close (targ); if (targetdebug) fprintf_unfiltered (gdb_stdlog, "target_close ()\n"); @@ -3853,9 +3867,9 @@ target_stop (ptid_t ptid) } static void -debug_to_post_attach (int pid) +debug_to_post_attach (struct target_ops *self, int pid) { - debug_target.to_post_attach (pid); + debug_target.to_post_attach (&debug_target, pid); fprintf_unfiltered (gdb_stdlog, "target_post_attach (%d)\n", pid); } @@ -4559,11 +4573,13 @@ debug_to_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, } static int -debug_to_can_use_hw_breakpoint (int type, int cnt, int from_tty) +debug_to_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int from_tty) { int retval; - retval = debug_target.to_can_use_hw_breakpoint (type, cnt, from_tty); + retval = debug_target.to_can_use_hw_breakpoint (&debug_target, + type, cnt, from_tty); fprintf_unfiltered (gdb_stdlog, "target_can_use_hw_breakpoint (%ld, %ld, %ld) = %ld\n", @@ -4575,11 +4591,13 @@ debug_to_can_use_hw_breakpoint (int type, int cnt, int from_tty) } static int -debug_to_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) +debug_to_region_ok_for_hw_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len) { CORE_ADDR retval; - retval = debug_target.to_region_ok_for_hw_watchpoint (addr, len); + retval = debug_target.to_region_ok_for_hw_watchpoint (&debug_target, + addr, len); fprintf_unfiltered (gdb_stdlog, "target_region_ok_for_hw_watchpoint (%s, %ld) = %s\n", @@ -4589,12 +4607,14 @@ debug_to_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) } static int -debug_to_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw, +debug_to_can_accel_watchpoint_condition (struct target_ops *self, + CORE_ADDR addr, int len, int rw, struct expression *cond) { int retval; - retval = debug_target.to_can_accel_watchpoint_condition (addr, len, + retval = debug_target.to_can_accel_watchpoint_condition (&debug_target, + addr, len, rw, cond); fprintf_unfiltered (gdb_stdlog, @@ -4650,12 +4670,14 @@ debug_to_watchpoint_addr_within_range (struct target_ops *target, } static int -debug_to_insert_hw_breakpoint (struct gdbarch *gdbarch, +debug_to_insert_hw_breakpoint (struct target_ops *self, + struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { int retval; - retval = debug_target.to_insert_hw_breakpoint (gdbarch, bp_tgt); + retval = debug_target.to_insert_hw_breakpoint (&debug_target, + gdbarch, bp_tgt); fprintf_unfiltered (gdb_stdlog, "target_insert_hw_breakpoint (%s, xxx) = %ld\n", @@ -4665,12 +4687,14 @@ debug_to_insert_hw_breakpoint (struct gdbarch *gdbarch, } static int -debug_to_remove_hw_breakpoint (struct gdbarch *gdbarch, +debug_to_remove_hw_breakpoint (struct target_ops *self, + struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { int retval; - retval = debug_target.to_remove_hw_breakpoint (gdbarch, bp_tgt); + retval = debug_target.to_remove_hw_breakpoint (&debug_target, + gdbarch, bp_tgt); fprintf_unfiltered (gdb_stdlog, "target_remove_hw_breakpoint (%s, xxx) = %ld\n", @@ -4680,12 +4704,14 @@ debug_to_remove_hw_breakpoint (struct gdbarch *gdbarch, } static int -debug_to_insert_watchpoint (CORE_ADDR addr, int len, int type, +debug_to_insert_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { int retval; - retval = debug_target.to_insert_watchpoint (addr, len, type, cond); + retval = debug_target.to_insert_watchpoint (&debug_target, + addr, len, type, cond); fprintf_unfiltered (gdb_stdlog, "target_insert_watchpoint (%s, %d, %d, %s) = %ld\n", @@ -4695,12 +4721,14 @@ debug_to_insert_watchpoint (CORE_ADDR addr, int len, int type, } static int -debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type, +debug_to_remove_watchpoint (struct target_ops *self, + CORE_ADDR addr, int len, int type, struct expression *cond) { int retval; - retval = debug_target.to_remove_watchpoint (addr, len, type, cond); + retval = debug_target.to_remove_watchpoint (&debug_target, + addr, len, type, cond); fprintf_unfiltered (gdb_stdlog, "target_remove_watchpoint (%s, %d, %d, %s) = %ld\n", diff --git a/gdb/target.h b/gdb/target.h index 76a2d1b..50d5c20 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -393,9 +393,9 @@ struct target_ops New re-entrant targets provide "to_xclose" and that is expected to xfree everything (including the "struct target_ops"). */ void (*to_xclose) (struct target_ops *targ); - void (*to_close) (void); + void (*to_close) (struct target_ops *); void (*to_attach) (struct target_ops *ops, char *, int); - void (*to_post_attach) (int); + void (*to_post_attach) (struct target_ops *, int); void (*to_detach) (struct target_ops *ops, const char *, int); void (*to_disconnect) (struct target_ops *, char *, int); void (*to_resume) (struct target_ops *, ptid_t, int, enum gdb_signal) @@ -441,15 +441,19 @@ struct target_ops int (*to_remove_breakpoint) (struct target_ops *, struct gdbarch *, struct bp_target_info *) TARGET_DEFAULT_FUNC (memory_remove_breakpoint); - int (*to_can_use_hw_breakpoint) (int, int, int); + int (*to_can_use_hw_breakpoint) (struct target_ops *, int, int, int); int (*to_ranged_break_num_registers) (struct target_ops *); - int (*to_insert_hw_breakpoint) (struct gdbarch *, struct bp_target_info *); - int (*to_remove_hw_breakpoint) (struct gdbarch *, struct bp_target_info *); + int (*to_insert_hw_breakpoint) (struct target_ops *, + struct gdbarch *, struct bp_target_info *); + int (*to_remove_hw_breakpoint) (struct target_ops *, + struct gdbarch *, struct bp_target_info *); /* Documentation of what the two routines below are expected to do is provided with the corresponding target_* macros. */ - int (*to_remove_watchpoint) (CORE_ADDR, int, int, struct expression *); - int (*to_insert_watchpoint) (CORE_ADDR, int, int, struct expression *); + int (*to_remove_watchpoint) (struct target_ops *, + CORE_ADDR, int, int, struct expression *); + int (*to_insert_watchpoint) (struct target_ops *, + CORE_ADDR, int, int, struct expression *); int (*to_insert_mask_watchpoint) (struct target_ops *, CORE_ADDR, CORE_ADDR, int); @@ -466,9 +470,11 @@ struct target_ops /* Documentation of this routine is provided with the corresponding target_* macro. */ - int (*to_region_ok_for_hw_watchpoint) (CORE_ADDR, int); + int (*to_region_ok_for_hw_watchpoint) (struct target_ops *, + CORE_ADDR, int); - int (*to_can_accel_watchpoint_condition) (CORE_ADDR, int, int, + int (*to_can_accel_watchpoint_condition) (struct target_ops *, + CORE_ADDR, int, int, struct expression *); int (*to_masked_watch_num_registers) (struct target_ops *, CORE_ADDR, CORE_ADDR); @@ -1006,7 +1012,7 @@ void target_attach (char *, int); This operation provides a target-specific hook that allows the necessary bookkeeping to be performed after an attach completes. */ #define target_post_attach(pid) \ - (*current_target.to_post_attach) (pid) + (*current_target.to_post_attach) (¤t_target, pid) /* Takes a program previously attached to and detaches it. The program may resume execution (some targets do, some don't) and will @@ -1582,13 +1588,15 @@ extern char *target_thread_name (struct thread_info *); (including this one?). OTHERTYPE is who knows what... */ #define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \ - (*current_target.to_can_use_hw_breakpoint) (TYPE, CNT, OTHERTYPE); + (*current_target.to_can_use_hw_breakpoint) (¤t_target, \ + TYPE, CNT, OTHERTYPE); /* Returns the number of debug registers needed to watch the given memory region, or zero if not supported. */ #define target_region_ok_for_hw_watchpoint(addr, len) \ - (*current_target.to_region_ok_for_hw_watchpoint) (addr, len) + (*current_target.to_region_ok_for_hw_watchpoint) (¤t_target, \ + addr, len) /* Set/clear a hardware watchpoint starting at ADDR, for LEN bytes. @@ -1598,10 +1606,12 @@ extern char *target_thread_name (struct thread_info *); -1 for failure. */ #define target_insert_watchpoint(addr, len, type, cond) \ - (*current_target.to_insert_watchpoint) (addr, len, type, cond) + (*current_target.to_insert_watchpoint) (¤t_target, \ + addr, len, type, cond) #define target_remove_watchpoint(addr, len, type, cond) \ - (*current_target.to_remove_watchpoint) (addr, len, type, cond) + (*current_target.to_remove_watchpoint) (¤t_target, \ + addr, len, type, cond) /* Insert a new masked watchpoint at ADDR using the mask MASK. RW may be hw_read for a read watchpoint, hw_write for a write watchpoint @@ -1623,10 +1633,12 @@ extern int target_remove_mask_watchpoint (CORE_ADDR, CORE_ADDR, int); message) otherwise. */ #define target_insert_hw_breakpoint(gdbarch, bp_tgt) \ - (*current_target.to_insert_hw_breakpoint) (gdbarch, bp_tgt) + (*current_target.to_insert_hw_breakpoint) (¤t_target, \ + gdbarch, bp_tgt) #define target_remove_hw_breakpoint(gdbarch, bp_tgt) \ - (*current_target.to_remove_hw_breakpoint) (gdbarch, bp_tgt) + (*current_target.to_remove_hw_breakpoint) (¤t_target, \ + gdbarch, bp_tgt) /* Return number of debug registers needed for a ranged breakpoint, or -1 if ranged breakpoints are not supported. */ @@ -1655,7 +1667,8 @@ extern int target_ranged_break_num_registers (void); For this reason, GDB will still evaluate the condition expression when the watchpoint triggers. */ #define target_can_accel_watchpoint_condition(addr, len, type, cond) \ - (*current_target.to_can_accel_watchpoint_condition) (addr, len, type, cond) + (*current_target.to_can_accel_watchpoint_condition) (¤t_target, \ + addr, len, type, cond) /* Return number of debug registers needed for a masked watchpoint, -1 if masked watchpoints are not supported or -2 if the given address diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 0a50606..d4937be 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -4755,7 +4755,7 @@ parse_tsv_definition (char *line, struct uploaded_tsv **utsvp) /* Close the trace file and generally clean up. */ static void -tfile_close (void) +tfile_close (struct target_ops *self) { int pid; diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 5bcb7b7..b0ed3f6 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -2480,7 +2480,7 @@ windows_can_run (void) } static void -windows_close (void) +windows_close (struct target_ops *self) { DEBUG_EVENTS (("gdb: windows_close, inferior_ptid=%d\n", ptid_get_pid (inferior_ptid))); -- 1.8.1.4