bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] Port gdbserver to GNU/Hurd


From: Pedro Alves
Subject: Re: [PATCH 1/2] Port gdbserver to GNU/Hurd
Date: Wed, 18 Sep 2013 13:37:19 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7

On 09/12/2013 04:05 AM, Yue Lu wrote:

> On Sat, Sep 7, 2013 at 2:53 AM, Pedro Alves <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]