From: Pedro Alves <palves@redhat.com>
To: gdb-patches <gdb-patches@sourceware.org>
Cc: Yue Lu <hacklu.newborn@gmail.com>,
Thomas Schwinge <thomas@codesourcery.com>,
Luis Machado <lgustavo@codesourcery.com>,
bug-hurd@gnu.org
Subject: Re: [PATCH 1/2] Port gdbserver to GNU/Hurd
Date: Fri, 06 Sep 2013 18:53:00 -0000 [thread overview]
Message-ID: <522A2497.7090405@redhat.com> (raw)
In-Reply-To: <5228DBA7.9050408@redhat.com>
Hi!
On 09/05/2013 08:29 PM, Pedro Alves wrote:
>> > +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)
>> > + {
>> > + gnu_debug ("gnu_read_inferior,length=%d, but return %d\n", length, ret);
>> > + return -1;
>> > + }
>> > + return 0;
>> > +}
>> > +
>> > +static int
>> > +gnu_write_memory (CORE_ADDR addr, const 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_write_inferior (task, addr, myaddr, length);
>> > + if (length != ret)
>> > + {
>> > + gnu_debug ("gnu_write_inferior,length=%d, but return %d\n", length,
>> > + ret);
>> > + return -1;
>> > + }
>> > + return 0;
>> > +}
>> > +
> These should reall be wrappers around a common shared function. I have
> a patch that I think helps here. I'll post it in soon.
>
This is what I meant:
https://sourceware.org/ml/gdb-patches/2013-09/msg00253.html
I was thinking you'd wrap gnu_xfer_memory.
But I have to say I don't really understand the real need for
all those:
task_t task = (gnu_current_inf
? (gnu_current_inf->task
? gnu_current_inf->task->port : 0)
: 0);
int res;
if (task == MACH_PORT_NULL)
return 0;
checks in the existing code. I mean, why would we reach here with
an invalid inferior/task/port selected?
It just reads as workaround for some bug to me.
Thanks,
--
Pedro Alves
next prev parent reply other threads:[~2013-09-06 18:53 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAB8fV=jJ64i91VW52ZmdnEDZhd1ZGTAykDqoFyPJanCP=5beqA@mail.gmail.com>
2013-09-03 8:03 ` [PATCH 2/2] " Yue Lu
2013-09-03 9:38 ` [PATCH 1/2] " Thomas Schwinge
2013-09-03 11:11 ` Pedro Alves
2013-09-03 13:09 ` Thomas Schwinge
2013-09-04 1:47 ` Yue Lu
2013-09-04 1:38 ` Yue Lu
2013-09-05 10:54 ` Yue Lu
2013-09-05 19:29 ` Pedro Alves
2013-09-05 19:39 ` Joel Brobecker
2013-09-05 21:38 ` Thomas Schwinge
2013-09-08 13:35 ` Yue Lu
2013-09-09 9:58 ` Thomas Schwinge
2013-09-18 12:12 ` Pedro Alves
2013-09-18 13:48 ` Yue Lu
2013-09-18 14:52 ` [Hurd/gnu-nat.c] Use ptid_t.lwpid to store, thread ids instead of ptid_t.tid. (was: Re: [PATCH 1/2] Port gdbserver to GNU/Hurd) Pedro Alves
2013-09-18 14:57 ` [PATCH 1/2] Port gdbserver to GNU/Hurd Pedro Alves
2013-09-22 12:58 ` Yue Lu
2013-09-06 18:53 ` Pedro Alves [this message]
2013-09-12 3:05 ` Yue Lu
2013-09-18 12:30 ` Pedro Alves
2013-09-18 12:37 ` Pedro Alves
2013-09-19 7:41 ` Yue Lu
2013-09-19 8:30 ` FAIL: gdb.base/nextoverexit.exp: next over exit (the program exited) (was: [PATCH 1/2] Port gdbserver to GNU/Hurd) Thomas Schwinge
2013-09-19 8:44 ` FAIL: gdb.base/nextoverexit.exp: next over exit (the program exited) Pedro Alves
2013-09-09 10:21 ` [PATCH 1/2] Port gdbserver to GNU/Hurd Yue Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=522A2497.7090405@redhat.com \
--to=palves@redhat.com \
--cc=bug-hurd@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=hacklu.newborn@gmail.com \
--cc=lgustavo@codesourcery.com \
--cc=thomas@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox