From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32545 invoked by alias); 13 Jan 2014 19:13:06 -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 32480 invoked by uid 89); 13 Jan 2014 19:13:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 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; Mon, 13 Jan 2014 19:13:01 +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 s0DJD09f029805 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 13 Jan 2014 14:13:00 -0500 Received: from barimba.redhat.com (ovpn-113-85.phx2.redhat.com [10.3.113.85]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s0DJCptG016701; Mon, 13 Jan 2014 14:12:59 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFC 10/32] Add target_ops argument to to_terminal_init Date: Mon, 13 Jan 2014 19:13:00 -0000 Message-Id: <1389640367-5571-11-git-send-email-tromey@redhat.com> In-Reply-To: <1389640367-5571-1-git-send-email-tromey@redhat.com> References: <1389640367-5571-1-git-send-email-tromey@redhat.com> X-SW-Source: 2014-01/txt/msg00343.txt.bz2 2014-01-08 Tom Tromey * target.h (struct target_ops) : Add argument. (target_terminal_init): Add argument. * target.c (debug_to_terminal_init): Add argument. (update_current_target): Update. * inflow.c (terminal_init_inferior): Add 'self' argument. * inferior.h (terminal_init_inferior): Add 'self' argument. * go32-nat.c (go32_terminal_init): Add 'self' argument. * gnu-nat.c (gnu_terminal_init_inferior): Add 'self' argument. Add target_ops argument to to_terminal_inferior 2014-01-08 Tom Tromey * target.h (struct target_ops) : Add argument. * target.c (target_terminal_inferior): Add argument. (update_current_target): Update. * remote.c (remote_terminal_inferior): Add 'self' argument. * linux-nat.c (linux_nat_terminal_inferior): Add 'self' argument. * inflow.c (terminal_inferior): Add 'self' argument. * inferior.h (terminal_inferior): Add 'self' argument. * go32-nat.c (go32_terminal_inferior): Add 'self' argument. (go32_terminal_inferior): Add 'self' argument. Add target_ops argument to to_terminal_ours_for_output 2014-01-08 Tom Tromey * target.h (struct target_ops) : Add argument. (target_terminal_ours_for_output): Add argument. * target.c (debug_to_terminal_ours_for_output): Add argument. (update_current_target): Update. * inflow.c (terminal_ours_for_output): Add 'self' argument. * inferior.h (terminal_ours_for_output): Add 'self' argument. * go32-nat.c (go32_terminal_ours): Add 'self' argument. Add target_ops argument to to_terminal_ours 2014-01-08 Tom Tromey * target.h (struct target_ops) : Add argument. (target_terminal_ours): Add argument. * target.c (debug_to_terminal_ours): Add argument. (update_current_target): Update. * remote.c (remote_terminal_ours): Add 'self' argument. (remote_close): Update. * linux-nat.c (linux_nat_terminal_ours): Add 'self' argument. * inflow.c (terminal_ours): Add 'self' argument. * inferior.h (terminal_ours): Add 'self' argument. * go32-nat.c (go32_terminal_ours): Add 'self' argument. Add target_ops argument to to_terminal_save_ours 2014-01-08 Tom Tromey * target.h (struct target_ops) : Add argument. (target_terminal_save_ours): Add argument. * target.c (debug_to_terminal_save_ours): Add argument. (update_current_target): Update. * inflow.c (terminal_save_ours): Add 'self' argument. * inferior.h (terminal_save_ours): Add 'self' argument. Add target_ops argument to to_terminal_info 2014-01-08 Tom Tromey * target.h (struct target_ops) : Add argument. (target_terminal_info): Add argument. * target.c (debug_to_terminal_info): Add argument. (default_terminal_info): Likewise. * inflow.c (child_terminal_info): Add 'self' argument. * inferior.h (child_terminal_info): Add 'self' argument. * go32-nat.c (go32_terminal_info): Add 'self' argument. Add target_ops argument to to_load 2014-01-08 Tom Tromey * target.h (struct target_ops) : Add argument. * target.c (target_load): Add argument. (debug_to_load): Add argument. (update_current_target): Update. * remote.c (remote_load): Add 'self' argument. * remote-sim.c (gdbsim_load): Add 'self' argument. * remote-mips.c (mips_load): Add 'self' argument. * remote-m32r-sdi.c (m32r_load): Add 'self' argument. * monitor.c (monitor_load): Add 'self' argument. * m32r-rom.c (m32r_load_gen): Add 'self' argument. Add target_ops argument to to_post_startup_inferior 2014-01-08 Tom Tromey * target.h (struct target_ops) : Add argument. (target_post_startup_inferior): Add argument. * target.c (debug_to_post_startup_inferior): Add argument. (update_current_target): Update. * spu-linux-nat.c (spu_child_post_startup_inferior): Add 'self' argument. * linux-nat.c (linux_child_post_startup_inferior): Add 'self' argument. * inf-ptrace.c (inf_ptrace_post_startup_inferior): Add 'self' argument. * inf-child.c (inf_child_post_startup_inferior): Add 'self' argument. * i386-linux-nat.c (i386_linux_child_post_startup_inferior): Add 'self' argument. (super_post_startup_inferior): Likewise. * amd64-linux-nat.c (amd64_linux_child_post_startup_inferior): Add 'self' argument. (super_post_startup_inferior): Likewise. * aarch64-linux-nat.c (aarch64_linux_child_post_startup_inferior): Add 'self' argument. (super_post_startup_inferior): Likewise. Add target_ops argument to to_insert_fork_catchpoint 2014-01-08 Tom Tromey * target.h (struct target_ops) : Add argument. (target_insert_fork_catchpoint): Add argument. * target.c (debug_to_insert_fork_catchpoint): Add argument. (update_current_target): Update. * linux-nat.c (linux_child_insert_fork_catchpoint): Add 'self' argument. Add target_ops argument to to_remove_fork_catchpoint 2014-01-08 Tom Tromey * target.h (struct target_ops) : Add argument. (target_remove_fork_catchpoint): Add argument. * target.c (debug_to_remove_fork_catchpoint): Add argument. (update_current_target): Update. * linux-nat.c (linux_child_remove_fork_catchpoint): Add 'self' argument. --- gdb/ChangeLog | 126 ++++++++++++++++++++++++++++++++++++++++++++++++ gdb/aarch64-linux-nat.c | 8 +-- gdb/amd64-linux-nat.c | 7 +-- gdb/gnu-nat.c | 2 +- gdb/go32-nat.c | 15 +++--- gdb/i386-linux-nat.c | 7 +-- gdb/inf-child.c | 2 +- gdb/inf-ptrace.c | 2 +- gdb/inferior.h | 12 ++--- gdb/inflow.c | 12 ++--- gdb/linux-nat.c | 18 +++---- gdb/m32r-rom.c | 2 +- gdb/monitor.c | 2 +- gdb/remote-m32r-sdi.c | 2 +- gdb/remote-mips.c | 4 +- gdb/remote-sim.c | 4 +- gdb/remote.c | 10 ++-- gdb/spu-linux-nat.c | 2 +- gdb/target.c | 79 +++++++++++++++--------------- gdb/target.h | 36 +++++++------- 20 files changed, 242 insertions(+), 110 deletions(-) diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index a59a6e7..6b3680e 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -825,16 +825,18 @@ aarch64_linux_get_debug_reg_capacity (void) } } -static void (*super_post_startup_inferior) (ptid_t ptid); +static void (*super_post_startup_inferior) (struct target_ops *self, + ptid_t ptid); /* Implement the "to_post_startup_inferior" target_ops method. */ static void -aarch64_linux_child_post_startup_inferior (ptid_t ptid) +aarch64_linux_child_post_startup_inferior (struct target_ops *self, + ptid_t ptid) { aarch64_forget_process (ptid_get_pid (ptid)); aarch64_linux_get_debug_reg_capacity (); - super_post_startup_inferior (ptid); + super_post_startup_inferior (self, ptid); } /* Implement the "to_read_description" target_ops method. */ diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c index b1676ac..237e936 100644 --- a/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c @@ -568,13 +568,14 @@ ps_get_thread_area (const struct ps_prochandle *ph, } -static void (*super_post_startup_inferior) (ptid_t ptid); +static void (*super_post_startup_inferior) (struct target_ops *self, + ptid_t ptid); static void -amd64_linux_child_post_startup_inferior (ptid_t ptid) +amd64_linux_child_post_startup_inferior (struct target_ops *self, ptid_t ptid) { i386_cleanup_dregs (); - super_post_startup_inferior (ptid); + super_post_startup_inferior (self, ptid); } diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index 329d090..c596034 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -2245,7 +2245,7 @@ gnu_detach (struct target_ops *ops, const char *args, int from_tty) } static void -gnu_terminal_init_inferior (void) +gnu_terminal_init_inferior (struct target_ops *self) { gdb_assert (gnu_current_inf); terminal_init_inferior_with_pgrp (gnu_current_inf->pid); diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index ef6ceef..5daeb4d 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -260,9 +260,10 @@ static void go32_mourn_inferior (struct target_ops *ops); static int go32_can_run (void); static struct target_ops go32_ops; -static void go32_terminal_init (void); -static void go32_terminal_inferior (void); -static void go32_terminal_ours (void); +static void go32_terminal_init (struct target_ops *self); +static void go32_terminal_inferior (struct target_ops *self); +static void go32_terminal_ours (struct target_ops *self, + struct target_ops *self); #define r_ofs(x) (offsetof(TSS,x)) @@ -871,14 +872,14 @@ static int inf_terminal_mode; static int terminal_is_ours = 1; static void -go32_terminal_init (void) +go32_terminal_init (struct target_ops *self) { inf_mode_valid = 0; /* Reinitialize, in case they are restarting child. */ terminal_is_ours = 1; } static void -go32_terminal_info (const char *args, int from_tty) +go32_terminal_info (struct target_ops *self, const char *args, int from_tty) { printf_unfiltered ("Inferior's terminal is in %s mode.\n", !inf_mode_valid @@ -908,7 +909,7 @@ go32_terminal_info (const char *args, int from_tty) } static void -go32_terminal_inferior (void) +go32_terminal_inferior (struct target_ops *self) { /* Redirect standard handles as child wants them. */ errno = 0; @@ -929,7 +930,7 @@ go32_terminal_inferior (void) } static void -go32_terminal_ours (void) +go32_terminal_ours (struct target_ops *self, struct target_ops *self) { /* Switch to cooked mode on the gdb terminal and save the inferior terminal mode to be restored when it is resumed. */ diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index c2f4fcc..f886b39e 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -982,13 +982,14 @@ i386_linux_resume (struct target_ops *ops, perror_with_name (("ptrace")); } -static void (*super_post_startup_inferior) (ptid_t ptid); +static void (*super_post_startup_inferior) (struct target_ops *self, + ptid_t ptid); static void -i386_linux_child_post_startup_inferior (ptid_t ptid) +i386_linux_child_post_startup_inferior (struct target_ops *self, ptid_t ptid) { i386_cleanup_dregs (); - super_post_startup_inferior (ptid); + super_post_startup_inferior (self, ptid); } /* Get Linux/x86 target description from running target. */ diff --git a/gdb/inf-child.c b/gdb/inf-child.c index de36417..cde56a2 100644 --- a/gdb/inf-child.c +++ b/gdb/inf-child.c @@ -112,7 +112,7 @@ inf_child_open (char *arg, int from_tty) } static void -inf_child_post_startup_inferior (ptid_t ptid) +inf_child_post_startup_inferior (struct target_ops *self, ptid_t ptid) { /* This version of Unix doesn't require a meaningful "post startup inferior" operation by a debugger. */ diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index 7f6f8bf..e71343a 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -147,7 +147,7 @@ inf_ptrace_create_inferior (struct target_ops *ops, #ifdef PT_GET_PROCESS_STATE static void -inf_ptrace_post_startup_inferior (ptid_t pid) +inf_ptrace_post_startup_inferior (struct target_ops *self, ptid_t pid) { ptrace_event_t pe; diff --git a/gdb/inferior.h b/gdb/inferior.h index d33a01a..248812f 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -125,9 +125,9 @@ extern int disable_randomization; extern void generic_mourn_inferior (void); -extern void terminal_save_ours (void); +extern void terminal_save_ours (struct target_ops *self); -extern void terminal_ours (void); +extern void terminal_ours (struct target_ops *self); extern CORE_ADDR unsigned_pointer_to_address (struct gdbarch *gdbarch, struct type *type, @@ -170,15 +170,15 @@ extern void default_print_registers_info (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, int all); -extern void child_terminal_info (const char *, int); +extern void child_terminal_info (struct target_ops *self, const char *, int); extern void term_info (char *, int); -extern void terminal_ours_for_output (void); +extern void terminal_ours_for_output (struct target_ops *self); -extern void terminal_inferior (void); +extern void terminal_inferior (struct target_ops *self); -extern void terminal_init_inferior (void); +extern void terminal_init_inferior (struct target_ops *self); extern void terminal_init_inferior_with_pgrp (int pgrp); diff --git a/gdb/inflow.c b/gdb/inflow.c index 062bf68..6d3b745 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -245,7 +245,7 @@ terminal_init_inferior_with_pgrp (int pgrp) and gdb must be able to restore it correctly. */ void -terminal_save_ours (void) +terminal_save_ours (struct target_ops *self) { if (gdb_has_a_terminal ()) { @@ -255,7 +255,7 @@ terminal_save_ours (void) } void -terminal_init_inferior (void) +terminal_init_inferior (struct target_ops *self) { #ifdef PROCESS_GROUP_TYPE /* This is for Lynx, and should be cleaned up by having Lynx be a separate @@ -272,7 +272,7 @@ terminal_init_inferior (void) This is preparation for starting or resuming the inferior. */ void -terminal_inferior (void) +terminal_inferior (struct target_ops *self) { struct inferior *inf; struct terminal_info *tinfo; @@ -353,7 +353,7 @@ terminal_inferior (void) should be called to get back to a normal state of affairs. */ void -terminal_ours_for_output (void) +terminal_ours_for_output (struct target_ops *self) { terminal_ours_1 (1); } @@ -363,7 +363,7 @@ terminal_ours_for_output (void) so they can be restored properly later. */ void -terminal_ours (void) +terminal_ours (struct target_ops *self) { terminal_ours_1 (0); } @@ -562,7 +562,7 @@ term_info (char *arg, int from_tty) } void -child_terminal_info (const char *args, int from_tty) +child_terminal_info (struct target_ops *self, const char *args, int from_tty) { struct inferior *inf; struct terminal_info *tinfo; diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 8e0f40b..53c3923 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -341,7 +341,7 @@ linux_child_post_attach (struct target_ops *self, int pid) } static void -linux_child_post_startup_inferior (ptid_t ptid) +linux_child_post_startup_inferior (struct target_ops *self, ptid_t ptid) { linux_init_ptrace (ptid_get_pid (ptid)); } @@ -702,13 +702,13 @@ holding the child stopped. Try \"set detach-on-fork\" or \ static int -linux_child_insert_fork_catchpoint (int pid) +linux_child_insert_fork_catchpoint (struct target_ops *self, int pid) { return !linux_supports_tracefork (); } static int -linux_child_remove_fork_catchpoint (int pid) +linux_child_remove_fork_catchpoint (struct target_ops *self, int pid) { return 0; } @@ -4551,16 +4551,16 @@ static int async_terminal_is_ours = 1; /* target_terminal_inferior implementation. */ static void -linux_nat_terminal_inferior (void) +linux_nat_terminal_inferior (struct target_ops *self) { if (!target_is_async_p ()) { /* Async mode is disabled. */ - terminal_inferior (); + terminal_inferior (self); return; } - terminal_inferior (); + terminal_inferior (self); /* Calls to target_terminal_*() are meant to be idempotent. */ if (!async_terminal_is_ours) @@ -4574,19 +4574,19 @@ linux_nat_terminal_inferior (void) /* target_terminal_ours implementation. */ static void -linux_nat_terminal_ours (void) +linux_nat_terminal_ours (struct target_ops *self) { if (!target_is_async_p ()) { /* Async mode is disabled. */ - terminal_ours (); + terminal_ours (self); return; } /* GDB should never give the terminal to the inferior if the inferior is running in the background (run&, continue&, etc.), but claiming it sure should. */ - terminal_ours (); + terminal_ours (self); if (async_terminal_is_ours) return; diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c index 4423d26..463220f 100644 --- a/gdb/m32r-rom.c +++ b/gdb/m32r-rom.c @@ -196,7 +196,7 @@ m32r_load (char *filename, int from_tty) } static void -m32r_load_gen (char *filename, int from_tty) +m32r_load_gen (struct target_ops *self, char *filename, int from_tty) { generic_load (filename, from_tty); } diff --git a/gdb/monitor.c b/gdb/monitor.c index 4292f47..cf12c1b 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -2196,7 +2196,7 @@ monitor_wait_srec_ack (void) /* monitor_load -- download a file. */ static void -monitor_load (char *args, int from_tty) +monitor_load (struct target_ops *self, char *args, int from_tty) { CORE_ADDR load_offset = 0; char **argv; diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index 58b19f2..c37b6e2 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -1214,7 +1214,7 @@ m32r_remove_breakpoint (struct target_ops *ops, } static void -m32r_load (char *args, int from_tty) +m32r_load (struct target_ops *self, char *args, int from_tty) { struct cleanup *old_chain; asection *section; diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 5c0b8a3..88e9977 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -128,7 +128,7 @@ static void pmon_download (char *buffer, int length); static void pmon_load_fast (char *file); -static void mips_load (char *file, int from_tty); +static void mips_load (struct target_ops *self, char *file, int from_tty); static int mips_make_srec (char *buffer, int type, CORE_ADDR memaddr, unsigned char *myaddr, int len); @@ -3532,7 +3532,7 @@ pmon_load_fast (char *file) /* mips_load -- download a file. */ static void -mips_load (char *file, int from_tty) +mips_load (struct target_ops *self, char *file, int from_tty) { struct regcache *regcache; diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 9f1e5eb..c4b7da1 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -72,7 +72,7 @@ static void gdb_os_error (host_callback *, const char *, ...) static void gdbsim_kill (struct target_ops *); -static void gdbsim_load (char *prog, int fromtty); +static void gdbsim_load (struct target_ops *self, char *prog, int fromtty); static void gdbsim_open (char *args, int from_tty); @@ -561,7 +561,7 @@ gdbsim_kill (struct target_ops *ops) GDB's symbol tables to match. */ static void -gdbsim_load (char *args, int fromtty) +gdbsim_load (struct target_ops *self, char *args, int fromtty) { char **argv; char *prog; diff --git a/gdb/remote.c b/gdb/remote.c index d23502c..547045b 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -226,7 +226,7 @@ static int peek_stop_reply (ptid_t ptid); static void remote_async_inferior_event_handler (gdb_client_data); -static void remote_terminal_ours (void); +static void remote_terminal_ours (struct target_ops *self); static int remote_read_description_p (struct target_ops *target); @@ -3056,7 +3056,7 @@ remote_close (struct target_ops *self) /* Make sure we leave stdin registered in the event loop, and we don't leave the async SIGINT signal handler installed. */ - remote_terminal_ours (); + remote_terminal_ours (self); serial_close (rs->remote_desc); rs->remote_desc = NULL; @@ -5206,7 +5206,7 @@ Give up (and stop debugging it)? "))) is required. */ static void -remote_terminal_inferior (void) +remote_terminal_inferior (struct target_ops *self) { if (!target_async_permitted) /* Nothing to do. */ @@ -5229,7 +5229,7 @@ remote_terminal_inferior (void) } static void -remote_terminal_ours (void) +remote_terminal_ours (struct target_ops *self) { if (!target_async_permitted) /* Nothing to do. */ @@ -11484,7 +11484,7 @@ remote_augmented_libraries_svr4_read (void) /* Implementation of to_load. */ static void -remote_load (char *name, int from_tty) +remote_load (struct target_ops *self, char *name, int from_tty) { generic_load (name, from_tty); } diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c index daa2bc4..1c2c4aa 100644 --- a/gdb/spu-linux-nat.c +++ b/gdb/spu-linux-nat.c @@ -389,7 +389,7 @@ spu_symbol_file_add_from_memory (int inferior_fd) /* Override the post_startup_inferior routine to continue running the inferior until the first spu_run system call. */ static void -spu_child_post_startup_inferior (ptid_t ptid) +spu_child_post_startup_inferior (struct target_ops *self, ptid_t ptid) { int fd; ULONGEST addr; diff --git a/gdb/target.c b/gdb/target.c index 411dbdf..9dcedfd 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -47,7 +47,7 @@ static void target_info (char *, int); -static void default_terminal_info (const char *, int); +static void default_terminal_info (struct target_ops *, const char *, int); static int default_watchpoint_addr_within_range (struct target_ops *, CORE_ADDR, CORE_ADDR, int); @@ -128,17 +128,17 @@ 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); +static void debug_to_terminal_init (struct target_ops *self); -static void debug_to_terminal_inferior (void); +static void debug_to_terminal_inferior (struct target_ops *self); -static void debug_to_terminal_ours_for_output (void); +static void debug_to_terminal_ours_for_output (struct target_ops *self); -static void debug_to_terminal_save_ours (void); +static void debug_to_terminal_save_ours (struct target_ops *self); -static void debug_to_terminal_ours (void); +static void debug_to_terminal_ours (struct target_ops *self); -static void debug_to_load (char *, int); +static void debug_to_load (struct target_ops *self, char *, int); static int debug_to_can_run (void); @@ -458,7 +458,7 @@ void target_load (char *arg, int from_tty) { target_dcache_invalidate (); - (*current_target.to_load) (arg, from_tty); + (*current_target.to_load) (¤t_target, arg, from_tty); } void @@ -496,7 +496,7 @@ target_terminal_inferior (void) /* If GDB is resuming the inferior in the foreground, install inferior's terminal modes. */ - (*current_target.to_terminal_inferior) (); + (*current_target.to_terminal_inferior) (¤t_target); } static int @@ -521,7 +521,7 @@ noprocess (void) } static void -default_terminal_info (const char *args, int from_tty) +default_terminal_info (struct target_ops *self, const char *args, int from_tty) { printf_unfiltered (_("No saved terminal information.\n")); } @@ -765,33 +765,33 @@ update_current_target (void) struct expression *)) return_zero); de_fault (to_terminal_init, - (void (*) (void)) + (void (*) (struct target_ops *)) target_ignore); de_fault (to_terminal_inferior, - (void (*) (void)) + (void (*) (struct target_ops *)) target_ignore); de_fault (to_terminal_ours_for_output, - (void (*) (void)) + (void (*) (struct target_ops *)) target_ignore); de_fault (to_terminal_ours, - (void (*) (void)) + (void (*) (struct target_ops *)) target_ignore); de_fault (to_terminal_save_ours, - (void (*) (void)) + (void (*) (struct target_ops *)) target_ignore); de_fault (to_terminal_info, default_terminal_info); de_fault (to_load, - (void (*) (char *, int)) + (void (*) (struct target_ops *, char *, int)) tcomplain); de_fault (to_post_startup_inferior, - (void (*) (ptid_t)) + (void (*) (struct target_ops *, ptid_t)) target_ignore); de_fault (to_insert_fork_catchpoint, - (int (*) (int)) + (int (*) (struct target_ops *, int)) return_one); de_fault (to_remove_fork_catchpoint, - (int (*) (int)) + (int (*) (struct target_ops *, int)) return_one); de_fault (to_insert_vfork_catchpoint, (int (*) (int)) @@ -4672,77 +4672,78 @@ debug_to_remove_watchpoint (struct target_ops *self, } static void -debug_to_terminal_init (void) +debug_to_terminal_init (struct target_ops *self) { - debug_target.to_terminal_init (); + debug_target.to_terminal_init (&debug_target); fprintf_unfiltered (gdb_stdlog, "target_terminal_init ()\n"); } static void -debug_to_terminal_inferior (void) +debug_to_terminal_inferior (struct target_ops *self) { - debug_target.to_terminal_inferior (); + debug_target.to_terminal_inferior (&debug_target); fprintf_unfiltered (gdb_stdlog, "target_terminal_inferior ()\n"); } static void -debug_to_terminal_ours_for_output (void) +debug_to_terminal_ours_for_output (struct target_ops *self) { - debug_target.to_terminal_ours_for_output (); + debug_target.to_terminal_ours_for_output (&debug_target); fprintf_unfiltered (gdb_stdlog, "target_terminal_ours_for_output ()\n"); } static void -debug_to_terminal_ours (void) +debug_to_terminal_ours (struct target_ops *self) { - debug_target.to_terminal_ours (); + debug_target.to_terminal_ours (&debug_target); fprintf_unfiltered (gdb_stdlog, "target_terminal_ours ()\n"); } static void -debug_to_terminal_save_ours (void) +debug_to_terminal_save_ours (struct target_ops *self) { - debug_target.to_terminal_save_ours (); + debug_target.to_terminal_save_ours (&debug_target); fprintf_unfiltered (gdb_stdlog, "target_terminal_save_ours ()\n"); } static void -debug_to_terminal_info (const char *arg, int from_tty) +debug_to_terminal_info (struct target_ops *self, + const char *arg, int from_tty) { - debug_target.to_terminal_info (arg, from_tty); + debug_target.to_terminal_info (&debug_target, arg, from_tty); fprintf_unfiltered (gdb_stdlog, "target_terminal_info (%s, %d)\n", arg, from_tty); } static void -debug_to_load (char *args, int from_tty) +debug_to_load (struct target_ops *self, char *args, int from_tty) { - debug_target.to_load (args, from_tty); + debug_target.to_load (&debug_target, args, from_tty); fprintf_unfiltered (gdb_stdlog, "target_load (%s, %d)\n", args, from_tty); } static void -debug_to_post_startup_inferior (ptid_t ptid) +debug_to_post_startup_inferior (struct target_ops *self, ptid_t ptid) { - debug_target.to_post_startup_inferior (ptid); + debug_target.to_post_startup_inferior (&debug_target, ptid); fprintf_unfiltered (gdb_stdlog, "target_post_startup_inferior (%d)\n", ptid_get_pid (ptid)); } static int -debug_to_insert_fork_catchpoint (int pid) +debug_to_insert_fork_catchpoint (struct target_ops *self, int pid) { int retval; - retval = debug_target.to_insert_fork_catchpoint (pid); + retval = debug_target.to_insert_fork_catchpoint (&debug_target, pid); fprintf_unfiltered (gdb_stdlog, "target_insert_fork_catchpoint (%d) = %d\n", pid, retval); @@ -4751,11 +4752,11 @@ debug_to_insert_fork_catchpoint (int pid) } static int -debug_to_remove_fork_catchpoint (int pid) +debug_to_remove_fork_catchpoint (struct target_ops *self, int pid) { int retval; - retval = debug_target.to_remove_fork_catchpoint (pid); + retval = debug_target.to_remove_fork_catchpoint (&debug_target, pid); fprintf_unfiltered (gdb_stdlog, "target_remove_fork_catchpoint (%d) = %d\n", pid, retval); diff --git a/gdb/target.h b/gdb/target.h index 4fa3918..15bcbd3 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -473,19 +473,19 @@ struct target_ops struct expression *); int (*to_masked_watch_num_registers) (struct target_ops *, CORE_ADDR, CORE_ADDR); - void (*to_terminal_init) (void); - void (*to_terminal_inferior) (void); - void (*to_terminal_ours_for_output) (void); - void (*to_terminal_ours) (void); - void (*to_terminal_save_ours) (void); - void (*to_terminal_info) (const char *, int); + void (*to_terminal_init) (struct target_ops *); + void (*to_terminal_inferior) (struct target_ops *); + void (*to_terminal_ours_for_output) (struct target_ops *); + void (*to_terminal_ours) (struct target_ops *); + void (*to_terminal_save_ours) (struct target_ops *); + void (*to_terminal_info) (struct target_ops *, const char *, int); void (*to_kill) (struct target_ops *); - void (*to_load) (char *, int); + void (*to_load) (struct target_ops *, char *, int); void (*to_create_inferior) (struct target_ops *, char *, char *, char **, int); - void (*to_post_startup_inferior) (ptid_t); - int (*to_insert_fork_catchpoint) (int); - int (*to_remove_fork_catchpoint) (int); + void (*to_post_startup_inferior) (struct target_ops *, ptid_t); + int (*to_insert_fork_catchpoint) (struct target_ops *, int); + int (*to_remove_fork_catchpoint) (struct target_ops *, int); int (*to_insert_vfork_catchpoint) (int); int (*to_remove_vfork_catchpoint) (int); int (*to_follow_fork) (struct target_ops *, int, int); @@ -1187,7 +1187,7 @@ extern int target_remove_breakpoint (struct gdbarch *gdbarch, before we actually run the inferior. */ #define target_terminal_init() \ - (*current_target.to_terminal_init) () + (*current_target.to_terminal_init) (¤t_target) /* Put the inferior's terminal settings into effect. This is preparation for starting or resuming the inferior. */ @@ -1203,14 +1203,14 @@ extern void target_terminal_inferior (void); should be called to get back to a normal state of affairs. */ #define target_terminal_ours_for_output() \ - (*current_target.to_terminal_ours_for_output) () + (*current_target.to_terminal_ours_for_output) (¤t_target) /* Put our terminal settings into effect. First record the inferior's terminal settings so they can be restored properly later. */ #define target_terminal_ours() \ - (*current_target.to_terminal_ours) () + (*current_target.to_terminal_ours) (¤t_target) /* Save our terminal settings. This is called from TUI after entering or leaving the curses @@ -1218,13 +1218,13 @@ extern void target_terminal_inferior (void); to take this change into account. */ #define target_terminal_save_ours() \ - (*current_target.to_terminal_save_ours) () + (*current_target.to_terminal_save_ours) (¤t_target) /* Print useful information about our terminal status, if such a thing exists. */ #define target_terminal_info(arg, from_tty) \ - (*current_target.to_terminal_info) (arg, from_tty) + (*current_target.to_terminal_info) (¤t_target, arg, from_tty) /* Kill the inferior process. Make it go away. */ @@ -1263,7 +1263,7 @@ void target_create_inferior (char *exec_file, char *args, Such targets will supply an appropriate definition for this function. */ #define target_post_startup_inferior(ptid) \ - (*current_target.to_post_startup_inferior) (ptid) + (*current_target.to_post_startup_inferior) (¤t_target, ptid) /* On some targets, we can catch an inferior fork or vfork event when it occurs. These functions insert/remove an already-created @@ -1271,10 +1271,10 @@ void target_create_inferior (char *exec_file, char *args, catchpoint type is not supported and -1 for failure. */ #define target_insert_fork_catchpoint(pid) \ - (*current_target.to_insert_fork_catchpoint) (pid) + (*current_target.to_insert_fork_catchpoint) (¤t_target, pid) #define target_remove_fork_catchpoint(pid) \ - (*current_target.to_remove_fork_catchpoint) (pid) + (*current_target.to_remove_fork_catchpoint) (¤t_target, pid) #define target_insert_vfork_catchpoint(pid) \ (*current_target.to_insert_vfork_catchpoint) (pid) -- 1.8.1.4