From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21148 invoked by alias); 19 Feb 2014 20:29:46 -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 21068 invoked by uid 89); 19 Feb 2014 20:29:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 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; Wed, 19 Feb 2014 20:29:44 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1JKTh1T016339 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 19 Feb 2014 15:29:43 -0500 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s1JKTams025004 for ; Wed, 19 Feb 2014 15:29:42 -0500 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 6/7] eliminate target_ops->deprecated_xfer_memory Date: Wed, 19 Feb 2014 20:29:00 -0000 Message-Id: <1392841775-19126-7-git-send-email-palves@redhat.com> In-Reply-To: <1392841775-19126-1-git-send-email-palves@redhat.com> References: <1392841775-19126-1-git-send-email-palves@redhat.com> X-SW-Source: 2014-02/txt/msg00608.txt.bz2 As no target uses it anymore, it can finally go away. After removing the deprecated_xfer_memory handling from default_xfer_partial, we can delete the latter, because the only thing it does is delegate to the target beneath unconditionally, which is what the delegator installed by target-delegates.c will do for us if no to_xfer_partial method is installed. This was the last user of de_fault, so that goes away too. Tested on x86_64 Fedora 17. gdb/ 2014-02-19 Pedro Alves * target.c (complete_target_initialization): Don't install default_xfer_partial as to_xfer_partial hook. (nomemory): Delete. (update_current_target): Don't INHERIT nor de_fault deprecated_xfer_memory. Delete de_fault macro. (default_xfer_partial, deprecated_debug_xfer_memory): Delete. (setup_target_debug): Don't install a deprecated_xfer_memory hook. * target.h (struct target_ops) : Delete field. --- gdb/target.c | 122 ----------------------------------------------------------- gdb/target.h | 26 ------------- 2 files changed, 148 deletions(-) diff --git a/gdb/target.c b/gdb/target.c index 4adc094..752d933 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -75,8 +75,6 @@ static int default_search_memory (struct target_ops *ops, static void tcomplain (void) ATTRIBUTE_NORETURN; -static int nomemory (CORE_ADDR, char *, int, int, struct target_ops *); - static int return_zero (struct target_ops *); static int return_zero_has_execution (struct target_ops *, ptid_t); @@ -87,8 +85,6 @@ static void target_command (char *, int); static struct target_ops *find_default_run_target (char *); -static target_xfer_partial_ftype default_xfer_partial; - static struct gdbarch *default_thread_architecture (struct target_ops *ops, ptid_t ptid); @@ -377,8 +373,6 @@ void complete_target_initialization (struct target_ops *t) { /* Provide default values for all "must have" methods. */ - if (t->to_xfer_partial == NULL) - t->to_xfer_partial = default_xfer_partial; if (t->to_has_all_memory == NULL) t->to_has_all_memory = return_zero; @@ -523,14 +517,6 @@ target_terminal_inferior (void) (*current_target.to_terminal_inferior) (¤t_target); } -static int -nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write, - struct target_ops *t) -{ - errno = EIO; /* Can't read/write this location. */ - return 0; /* No bytes handled. */ -} - static void tcomplain (void) { @@ -610,28 +596,12 @@ update_current_target (void) INHERIT (to_shortname, t); INHERIT (to_longname, t); INHERIT (to_attach_no_wait, t); - INHERIT (deprecated_xfer_memory, t); INHERIT (to_have_steppable_watchpoint, t); INHERIT (to_have_continuable_watchpoint, t); INHERIT (to_has_thread_control, t); } #undef INHERIT - /* Clean up a target struct so it no longer has any zero pointers in - it. Do not add any new de_faults here. Instead, use the - delegation mechanism provided by make-target-delegates. */ - -#define de_fault(field, value) \ - if (!current_target.field) \ - current_target.field = value - - de_fault (deprecated_xfer_memory, - (int (*) (CORE_ADDR, gdb_byte *, int, int, - struct mem_attrib *, struct target_ops *)) - nomemory); - -#undef de_fault - /* Finally, position the target-stack beneath the squashed "current_target". That way code looking for a non-inherited target method can quickly and simply find it. */ @@ -1658,56 +1628,6 @@ show_trust_readonly (struct ui_file *file, int from_tty, value); } -/* More generic transfers. */ - -static enum target_xfer_status -default_xfer_partial (struct target_ops *ops, enum target_object object, - const char *annex, gdb_byte *readbuf, - const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, - ULONGEST *xfered_len) -{ - if (object == TARGET_OBJECT_MEMORY - && ops->deprecated_xfer_memory != NULL) - /* If available, fall back to the target's - "deprecated_xfer_memory" method. */ - { - int xfered = -1; - - errno = 0; - if (writebuf != NULL) - { - void *buffer = xmalloc (len); - struct cleanup *cleanup = make_cleanup (xfree, buffer); - - memcpy (buffer, writebuf, len); - xfered = ops->deprecated_xfer_memory (offset, buffer, len, - 1/*write*/, NULL, ops); - do_cleanups (cleanup); - } - if (readbuf != NULL) - xfered = ops->deprecated_xfer_memory (offset, readbuf, len, - 0/*read*/, NULL, ops); - if (xfered > 0) - { - *xfered_len = (ULONGEST) xfered; - return TARGET_XFER_E_IO; - } - else if (xfered == 0 && errno == 0) - /* "deprecated_xfer_memory" uses 0, cross checked against - ERRNO as one indication of an error. */ - return TARGET_XFER_EOF; - else - return TARGET_XFER_E_IO; - } - else - { - gdb_assert (ops->beneath != NULL); - return ops->beneath->to_xfer_partial (ops->beneath, object, annex, - readbuf, writebuf, offset, len, - xfered_len); - } -} - /* Target vector read/write partial wrapper functions. */ static enum target_xfer_status @@ -3850,47 +3770,6 @@ target_decr_pc_after_break (struct gdbarch *gdbarch) return current_target.to_decr_pc_after_break (¤t_target, gdbarch); } -static int -deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len, - int write, struct mem_attrib *attrib, - struct target_ops *target) -{ - int retval; - - retval = debug_target.deprecated_xfer_memory (memaddr, myaddr, len, write, - attrib, target); - - fprintf_unfiltered (gdb_stdlog, - "target_xfer_memory (%s, xxx, %d, %s, xxx) = %d", - paddress (target_gdbarch (), memaddr), len, - write ? "write" : "read", retval); - - if (retval > 0) - { - int i; - - fputs_unfiltered (", bytes =", gdb_stdlog); - for (i = 0; i < retval; i++) - { - if ((((intptr_t) &(myaddr[i])) & 0xf) == 0) - { - if (targetdebug < 2 && i > 0) - { - fprintf_unfiltered (gdb_stdlog, " ..."); - break; - } - fprintf_unfiltered (gdb_stdlog, "\n"); - } - - fprintf_unfiltered (gdb_stdlog, " %02x", myaddr[i] & 0xff); - } - } - - fputc_unfiltered ('\n', gdb_stdlog); - - return retval; -} - static void debug_to_files_info (struct target_ops *target) { @@ -4319,7 +4198,6 @@ setup_target_debug (void) current_target.to_open = debug_to_open; current_target.to_post_attach = debug_to_post_attach; current_target.to_prepare_to_store = debug_to_prepare_to_store; - current_target.deprecated_xfer_memory = deprecated_debug_xfer_memory; current_target.to_files_info = debug_to_files_info; current_target.to_insert_breakpoint = debug_to_insert_breakpoint; current_target.to_remove_breakpoint = debug_to_remove_breakpoint; diff --git a/gdb/target.h b/gdb/target.h index 2cc3c13..a1fac30 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -423,32 +423,6 @@ struct target_ops void (*to_prepare_to_store) (struct target_ops *, struct regcache *) TARGET_DEFAULT_NORETURN (noprocess ()); - /* Transfer LEN bytes of memory between GDB address MYADDR and - target address MEMADDR. If WRITE, transfer them to the target, else - transfer them from the target. TARGET is the target from which we - get this function. - - Return value, N, is one of the following: - - 0 means that we can't handle this. If errno has been set, it is the - error which prevented us from doing it (FIXME: What about bfd_error?). - - positive (call it N) means that we have transferred N bytes - starting at MEMADDR. We might be able to handle more bytes - beyond this length, but no promises. - - negative (call its absolute value N) means that we cannot - transfer right at MEMADDR, but we could transfer at least - something at MEMADDR + N. - - NOTE: cagney/2004-10-01: This has been entirely superseeded by - to_xfer_partial and inferior inheritance. */ - - int (*deprecated_xfer_memory) (CORE_ADDR memaddr, gdb_byte *myaddr, - int len, int write, - struct mem_attrib *attrib, - struct target_ops *target); - void (*to_files_info) (struct target_ops *) TARGET_DEFAULT_IGNORE (); int (*to_insert_breakpoint) (struct target_ops *, struct gdbarch *, -- 1.7.11.7