From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8750 invoked by alias); 15 Aug 2008 12:46:16 -0000 Received: (qmail 8741 invoked by uid 22791); 15 Aug 2008 12:46:15 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 15 Aug 2008 12:45:40 +0000 Received: (qmail 22411 invoked from network); 15 Aug 2008 12:45:39 -0000 Received: from unknown (HELO localhost) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 15 Aug 2008 12:45:39 -0000 From: Vladimir Prus Date: Fri, 15 Aug 2008 12:46:00 -0000 Subject: [RFA] Remove unnecessary target defaults. To: gdb-patches@sources.redhat.com X-TUID: e5becc1f6072b2ad X-Length: 2486 X-UID: 295 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200808151645.31042.vladimir@codesourcery.com> 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: 2008-08/txt/msg00401.txt.bz2 In current GDB, at the bottom of the target stack, we always have dummy target, which defines some target methods, including to_create_inferiour, and to_attach. Those are implemented by calling find_default_attach and find_default_create_inferior, which will call 'error' when nothing is found. On the other hand, update_current_target tries to set a default value for those functions -- but because dummy target is always there, such defaulting is not necessary. This patch removes it. No regressions on x86. OK? - Volodya * target.c (maybe_kill_then_attach) (maybe_kill_then_create_inferior): Remove. (update_current_target): Do not default to_attach, to_create_inferiour, to_is_async_p. --- gdb/target.c | 27 --------------------------- 1 files changed, 0 insertions(+), 27 deletions(-) diff --git a/gdb/target.c b/gdb/target.c index 0dbe49b..050f71b 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -44,8 +44,6 @@ static void target_info (char *, int); -static void maybe_kill_then_attach (char *, int); - static void kill_or_be_killed (int); static void default_terminal_info (char *, int); @@ -358,21 +356,6 @@ kill_or_be_killed (int from_tty) tcomplain (); } -static void -maybe_kill_then_attach (char *args, int from_tty) -{ - kill_or_be_killed (from_tty); - target_attach (args, from_tty); -} - -static void -maybe_kill_then_create_inferior (char *exec, char *args, char **env, - int from_tty) -{ - kill_or_be_killed (0); - target_create_inferior (exec, args, env, from_tty); -} - /* Go through the target stack from top to bottom, copying over zero entries in current_target, then filling in still empty entries. In effect, we are doing class inheritance through the pushed target @@ -500,8 +483,6 @@ update_current_target (void) de_fault (to_close, (void (*) (int)) target_ignore); - de_fault (to_attach, - maybe_kill_then_attach); de_fault (to_post_attach, (void (*) (int)) target_ignore); @@ -584,8 +565,6 @@ update_current_target (void) de_fault (to_lookup_symbol, (int (*) (char *, CORE_ADDR *)) nosymbol); - de_fault (to_create_inferior, - maybe_kill_then_create_inferior); de_fault (to_post_startup_inferior, (void (*) (ptid_t)) target_ignore); @@ -640,12 +619,6 @@ update_current_target (void) de_fault (to_pid_to_exec_file, (char *(*) (int)) return_zero); - de_fault (to_can_async_p, - (int (*) (void)) - return_zero); - de_fault (to_is_async_p, - (int (*) (void)) - return_zero); de_fault (to_async, (void (*) (void (*) (enum inferior_event_type, void*), void*)) tcomplain); -- 1.5.3.5