From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10689 invoked by alias); 4 Oct 2004 20:01:24 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 10682 invoked from network); 4 Oct 2004 20:01:23 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sourceware.org with SMTP; 4 Oct 2004 20:01:23 -0000 Received: from drow by nevyn.them.org with local (Exim 4.34 #1 (Debian)) id 1CEZ1P-0000xW-5g; Mon, 04 Oct 2004 16:01:23 -0400 Date: Mon, 04 Oct 2004 20:01:00 -0000 From: Daniel Jacobowitz To: cagney@gnu.org, gdb-patches@sources.redhat.com Subject: [rfa] Fix remote debugging Message-ID: <20041004200122.GA30774@nevyn.them.org> Mail-Followup-To: cagney@gnu.org, gdb-patches@sources.redhat.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.5.1+cvs20040105i X-SW-Source: 2004-10/txt/msg00064.txt.bz2 Your recent patch made it mandatory for any target which implements to_xfer_partial to support TARGET_OBJECT_MEMORY, i.e. its to_xfer_memory will be ignored. remote.c doesn't meet this new requirement. I didn't check all the other targets with _partial methods. OK? Tested on i386-pc-linux-gnu using gdbserver. Brings test results from unspeakable back to merely disappointing. -- Daniel Jacobowitz 2004-10-04 Daniel Jacobowitz * remote.c (remote_xfer_partial): Handle TARGET_OBJECT_MEMORY. Index: remote.c =================================================================== RCS file: /cvs/src/src/gdb/remote.c,v retrieving revision 1.148 diff -u -p -r1.148 remote.c --- remote.c 24 Sep 2004 19:51:18 -0000 1.148 +++ remote.c 4 Oct 2004 19:58:44 -0000 @@ -4864,6 +4864,31 @@ remote_xfer_partial (struct target_ops * char *p2 = &buf2[0]; char query_type; + /* Handle memory using remote_xfer_memory. */ + if (object == TARGET_OBJECT_MEMORY) + { + int xfered; + errno = 0; + + if (writebuf != NULL) + { + void *buffer = xmalloc (len); + struct cleanup *cleanup = make_cleanup (xfree, buffer); + memcpy (buffer, writebuf, len); + xfered = remote_xfer_memory (offset, buffer, len, 1, NULL, ops); + do_cleanups (cleanup); + } + else + xfered = remote_xfer_memory (offset, readbuf, len, 0, NULL, ops); + + if (xfered > 0) + return xfered; + else if (xfered == 0 && errno == 0) + return 0; + else + return -1; + } + /* Only handle reads. */ if (writebuf != NULL || readbuf == NULL) return -1;