From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15980 invoked by alias); 18 Sep 2013 12:37:28 -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 15968 invoked by uid 89); 18 Sep 2013 12:37:27 -0000 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, 18 Sep 2013 12:37:27 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.2 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com 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 r8ICbMBV006921 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 18 Sep 2013 08:37:22 -0400 Received: from [127.0.0.1] (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 r8ICbKAH021512; Wed, 18 Sep 2013 08:37:20 -0400 Message-ID: <52399E7F.40304@redhat.com> Date: Wed, 18 Sep 2013 12:37:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Yue Lu CC: gdb-patches , Thomas Schwinge , Luis Machado , bug-hurd@gnu.org Subject: Re: [PATCH 1/2] Port gdbserver to GNU/Hurd References: <87txi2i6t6.fsf@kepler.schwinge.homeip.net> <5225C3C6.8090101@redhat.com> <5228DBA7.9050408@redhat.com> <522A2497.7090405@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-09/txt/msg00582.txt.bz2 On 09/12/2013 04:05 AM, Yue Lu wrote: > On Sat, Sep 7, 2013 at 2:53 AM, Pedro Alves wrote: >> This is what I meant: >> https://sourceware.org/ml/gdb-patches/2013-09/msg00253.html >> >> I was thinking you'd wrap gnu_xfer_memory. >> > > I have study your patch, Thanks. Did you try building gdb with it, and does the resulting GDB still work? > but I found there is no to_xfer_partial field > or something similar in gdbserver's structure target_obj, how can I > do? Please give me more hints, thanks. Right, there's no such function in gdbserver today. I mean, instead of: + +static int +gnu_read_memory (CORE_ADDR addr, unsigned char *myaddr, int length) +{ + int ret = 0; + task_t task = (gnu_current_inf + ? (gnu_current_inf->task + ? gnu_current_inf->task->port : 0) : 0); + if (task == MACH_PORT_NULL) + return 0; + ret = gnu_read_inferior (task, addr, myaddr, length); + if (length != ret) + { + debug ("gnu_read_inferior,length=%d, but return %d\n", length, ret); + return -1; + } + return 0; +} you'll have a simpler: static int gnu_read_memory (CORE_ADDR addr, unsigned char *myaddr, int length) { LONGEST res; res = gnu_xfer_memory (...); if (res != length) return -1; return 0; } gnu_xfer_memory already has the task == MACH_PORT_NULL check inside it, so this means there's no need to duplicate it in gnu_read|write_memory. -- Pedro Alves