This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v4 2/9] add "this" pointers to more target APIs
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 06 Dec 2013 19:06:00 +0000
- Subject: Re: [PATCH v4 2/9] add "this" pointers to more target APIs
- Authentication-results: sourceware.org; auth=none
- References: <1382464769-2465-1-git-send-email-tromey at redhat dot com> <1382464769-2465-3-git-send-email-tromey at redhat dot com> <526E8AF2 dot 7050202 at redhat dot com> <87r4b5cpxd dot fsf at fleche dot redhat dot com> <526E9451 dot 6050103 at redhat dot com> <87mwltcp8v dot fsf at fleche dot redhat dot com> <527D2323 dot 2010708 at redhat dot com> <87ob5uodry dot fsf at fleche dot redhat dot com> <527D5D58 dot 4030707 at redhat dot com> <87siu5kfe1 dot fsf at fleche dot redhat dot com>
On 12/06/2013 06:23 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Tom> I'll remove "is_async". Unless you'd rather I remove "can_async".
>
> Pedro> No, that's fine. "is_async" would be my choice as well.
>
> I looked deeper than the two are still subtly different.
> Specifically, remote.c delegates to serial:
>
> return serial_can_async_p (rs->remote_desc);
> return serial_is_async_p (rs->remote_desc);
>
> And these really do differ:
>
> int
> serial_can_async_p (struct serial *scb)
> {
> return (scb->ops->async != NULL);
> }
>
> int
> serial_is_async_p (struct serial *scb)
> {
> return (scb->ops->async != NULL) && (scb->async_handler != NULL);
> }
>
>
> I find it a bit odd that the upper layers rely on the serial layer to do
> this bookkeeping.
Hmm, indeed. So target_is_async only returns true while
target_async (inferior_event_handler) is active.
Guess we need to go through target_is_async_p calls
and see how to eliminate them. The remote.c ones
seem simply replaceable with checking whether
we're doing a blocking wait, but the others look
more tricky.
(below's untested)
---
gdb/remote.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/remote.c b/gdb/remote.c
index 2ac8c36..a164455 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -6001,7 +6001,7 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options)
int ret;
int is_notif;
- if (!target_is_async_p ())
+ if ((options & TARGET_WNOHANG) == 0)
{
ofunc = signal (SIGINT, sync_remote_interrupt);
/* If the user hit C-c before this packet, or between packets,
@@ -6020,7 +6020,7 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options)
ret = getpkt_or_notif_sane (&rs->buf, &rs->buf_size,
wait_forever_enabled_p, &is_notif);
- if (!target_is_async_p ())
+ if ((options & TARGET_WNOHANG) == 0)
signal (SIGINT, ofunc);
/* GDB gets a notification. Return to core as this event is
--
1.7.11.7