From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20667 invoked by alias); 6 Feb 2009 00:27:09 -0000 Received: (qmail 20651 invoked by uid 22791); 6 Feb 2009 00:27:06 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BARRACUDA_BRBL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from nf-out-0910.google.com (HELO nf-out-0910.google.com) (64.233.182.187) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 Feb 2009 00:27:00 +0000 Received: by nf-out-0910.google.com with SMTP id h3so129093nfh.48 for ; Thu, 05 Feb 2009 16:26:57 -0800 (PST) Received: by 10.67.10.18 with SMTP id n18mr5248380ugi.45.1233880016925; Thu, 05 Feb 2009 16:26:56 -0800 (PST) Received: from pedro-laptop-dell (bl7-247-209.dsl.telepac.pt [85.240.247.209]) by mx.google.com with ESMTPS id y6sm5734554uge.30.2009.02.05.16.26.55 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 05 Feb 2009 16:26:56 -0800 (PST) Received: by pedro-laptop-dell (Postfix, from userid 1000) id CC011EAEE0; Fri, 6 Feb 2009 00:27:04 +0000 (WET) To: gdb-patches@sourceware.org Subject: Re-add a few `set debug target' callbacks. Message-Id: <20090206002704.CC011EAEE0@pedro-laptop-dell> Date: Fri, 06 Feb 2009 00:27:00 -0000 From: Pedro Alves X-IsSubscribed: yes 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 X-SW-Source: 2009-02/txt/msg00143.txt.bz2 These methods are no longer inherited, but instead do the beneath lookup themselves, so their corresponding debug_target callbacks are now never reached. Checked in. 2009-02-06 Pedro Alves * target.c (target_create_inferior, target_detach) (target_mourn_inferior, target_attach, target_close): Do target debug output. (debug_to_attach, debug_to_detach, debug_to_create_inferior) (debug_to_mourn_inferior, debug_to_close): Delete. (setup_target_debug): Adjust. --- gdb/target.c | 77 +++++++++++++---------------------------------------------- 1 file changed, 18 insertions(+), 59 deletions(-) Index: src/gdb/target.c =================================================================== --- src.orig/gdb/target.c 2009-02-05 23:54:19.000000000 +0000 +++ src/gdb/target.c 2009-02-06 00:14:04.000000000 +0000 @@ -97,12 +97,6 @@ static struct target_ops debug_target; static void debug_to_open (char *, int); -static void debug_to_close (int); - -static void debug_to_attach (struct target_ops *ops, char *, int); - -static void debug_to_detach (struct target_ops *ops, char *, int); - static void debug_to_resume (ptid_t, int, enum target_signal); static ptid_t debug_to_wait (ptid_t, struct target_waitstatus *); @@ -156,8 +150,6 @@ static void debug_to_load (char *, int); static int debug_to_lookup_symbol (char *, CORE_ADDR *); -static void debug_to_mourn_inferior (struct target_ops *); - static int debug_to_can_run (void); static void debug_to_notice_signals (ptid_t); @@ -281,8 +273,9 @@ target_load (char *arg, int from_tty) (*current_target.to_load) (arg, from_tty); } -void target_create_inferior (char *exec_file, char *args, - char **env, int from_tty) +void +target_create_inferior (char *exec_file, char *args, + char **env, int from_tty) { struct target_ops *t; for (t = current_target.beneath; t != NULL; t = t->beneath) @@ -290,6 +283,10 @@ void target_create_inferior (char *exec_ if (t->to_create_inferior != NULL) { t->to_create_inferior (t, exec_file, args, env, from_tty); + if (targetdebug) + fprintf_unfiltered (gdb_stdlog, + "target_create_inferior (%s, %s, xxx, %d)\n", + exec_file, args, from_tty); return; } } @@ -1811,6 +1808,9 @@ target_detach (char *args, int from_tty) if (t->to_detach != NULL) { t->to_detach (t, args, from_tty); + if (targetdebug) + fprintf_unfiltered (gdb_stdlog, "target_detach (%s, %d)\n", + args, from_tty); return; } } @@ -1883,6 +1883,8 @@ target_mourn_inferior (void) if (t->to_mourn_inferior != NULL) { t->to_mourn_inferior (t); + if (targetdebug) + fprintf_unfiltered (gdb_stdlog, "target_mourn_inferior ()\n"); return; } } @@ -2519,13 +2521,6 @@ debug_to_open (char *args, int from_tty) fprintf_unfiltered (gdb_stdlog, "target_open (%s, %d)\n", args, from_tty); } -static void -debug_to_close (int quitting) -{ - target_close (&debug_target, quitting); - fprintf_unfiltered (gdb_stdlog, "target_close (%d)\n", quitting); -} - void target_close (struct target_ops *targ, int quitting) { @@ -2533,6 +2528,9 @@ target_close (struct target_ops *targ, i targ->to_xclose (targ, quitting); else if (targ->to_close != NULL) targ->to_close (quitting); + + if (targetdebug) + fprintf_unfiltered (gdb_stdlog, "target_close (%d)\n", quitting); } void @@ -2544,6 +2542,9 @@ target_attach (char *args, int from_tty) if (t->to_attach != NULL) { t->to_attach (t, args, from_tty); + if (targetdebug) + fprintf_unfiltered (gdb_stdlog, "target_attach (%s, %d)\n", + args, from_tty); return; } } @@ -2552,16 +2553,6 @@ target_attach (char *args, int from_tty) "could not find a target to attach"); } - -static void -debug_to_attach (struct target_ops *ops, char *args, int from_tty) -{ - debug_target.to_attach (&debug_target, args, from_tty); - - fprintf_unfiltered (gdb_stdlog, "target_attach (%s, %d)\n", args, from_tty); -} - - static void debug_to_post_attach (int pid) { @@ -2571,14 +2562,6 @@ debug_to_post_attach (int pid) } static void -debug_to_detach (struct target_ops *ops, char *args, int from_tty) -{ - debug_target.to_detach (&debug_target, args, from_tty); - - fprintf_unfiltered (gdb_stdlog, "target_detach (%s, %d)\n", args, from_tty); -} - -static void debug_to_resume (ptid_t ptid, int step, enum target_signal siggnal) { debug_target.to_resume (ptid, step, siggnal); @@ -2989,17 +2972,6 @@ debug_to_lookup_symbol (char *name, CORE } static void -debug_to_create_inferior (struct target_ops *ops, - char *exec_file, char *args, char **env, - int from_tty) -{ - debug_target.to_create_inferior (ops, exec_file, args, env, from_tty); - - fprintf_unfiltered (gdb_stdlog, "target_create_inferior (%s, %s, xxx, %d)\n", - exec_file, args, from_tty); -} - -static void debug_to_post_startup_inferior (ptid_t ptid) { debug_target.to_post_startup_inferior (ptid); @@ -3096,14 +3068,6 @@ debug_to_has_exited (int pid, int wait_s return has_exited; } -static void -debug_to_mourn_inferior (struct target_ops *ops) -{ - debug_target.to_mourn_inferior (&debug_target); - - fprintf_unfiltered (gdb_stdlog, "target_mourn_inferior ()\n"); -} - static int debug_to_can_run (void) { @@ -3182,10 +3146,7 @@ setup_target_debug (void) memcpy (&debug_target, ¤t_target, sizeof debug_target); current_target.to_open = debug_to_open; - current_target.to_close = debug_to_close; - current_target.to_attach = debug_to_attach; current_target.to_post_attach = debug_to_post_attach; - current_target.to_detach = debug_to_detach; current_target.to_resume = debug_to_resume; current_target.to_wait = debug_to_wait; current_target.to_fetch_registers = debug_to_fetch_registers; @@ -3213,7 +3174,6 @@ setup_target_debug (void) current_target.to_kill = debug_to_kill; current_target.to_load = debug_to_load; current_target.to_lookup_symbol = debug_to_lookup_symbol; - current_target.to_create_inferior = debug_to_create_inferior; current_target.to_post_startup_inferior = debug_to_post_startup_inferior; current_target.to_acknowledge_created_inferior = debug_to_acknowledge_created_inferior; current_target.to_insert_fork_catchpoint = debug_to_insert_fork_catchpoint; @@ -3223,7 +3183,6 @@ setup_target_debug (void) current_target.to_insert_exec_catchpoint = debug_to_insert_exec_catchpoint; current_target.to_remove_exec_catchpoint = debug_to_remove_exec_catchpoint; current_target.to_has_exited = debug_to_has_exited; - current_target.to_mourn_inferior = debug_to_mourn_inferior; current_target.to_can_run = debug_to_can_run; current_target.to_notice_signals = debug_to_notice_signals; current_target.to_thread_alive = debug_to_thread_alive;