This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Implement post_event for Python scripts.
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Phil Muldoon <pmuldoon at redhat dot com>, Tom Tromey <tromey at redhat dot com>
- Date: Wed, 18 Aug 2010 14:45:52 +0100
- Subject: Re: [patch] Implement post_event for Python scripts.
- References: <4C45F0B0.5000903@redhat.com>
On Tuesday 20 July 2010 19:53:36, Phil Muldoon wrote:
> 2010-08-11 Tom Tromey <tromey@redhat.com>
> Phil Muldoon <pmuldoon@redhat.com>
>
> * python/python.c (gdbpy_run_events): New function.
> (gdbpy_post_event): Likewise.
> (gdbpy_initialize_events): Likewise.
> (_initialize_python): Call gdbpy_initialize_events.
It was brought to my attention that this unfortunatly breaks
Windows builds:
cc1: warnings being treated as errors
/scratch/sandra/trunk45/obj/gdb-src-2010.09-999999-arm-none-eabi-i686-mingw32/gdb/python/python.c:
In function 'gdbpy_initialize_events':
/scratch/sandra/trunk45/obj/gdb-src-2010.09-999999-arm-none-eabi-i686-mingw32/gdb/python/python.c:675:
error: implicit declaration of function 'pipe'
This is:
> if (!pipe (gdbpy_event_fds))
> {
> gdbpy_event_list_end = &gdbpy_event_list;
> add_file_handler (gdbpy_event_fds[0], gdbpy_run_events, NULL);
> }
`pipe' doesn't exist on Windows. There's a _pipe function, but it has a
different interface (takes two remote arguments). See
<http://sourceware.org/ml/gdb-patches/2008-10/msg00418.html>
and look for "gdb_pipe".
The expedient way to fix this I guess would be to resurrect gdb_pipe
from that patch, so that we have a consistent way across hosts
to create a pipe.
I do agree that using pipes on common code to wake up the event loop
is tackling at the wrong level (we should have an abstracted way to
do this, using pipes on posix hosts, events on Windows, etc.), but,
I'm happy with a simpler way for now.
I'm also not sure whether ...
> /* We use a file handler, and not an async handler, so that we can
> wake up the main thread even when it is blocked in poll(). */
> static int gdbpy_event_fds[2];
... mingw-htep.c:gdb_select will be smart enough to apply the
proper select for that file descriptor, or if we need to bring
the whole patch in.
What do you think about this?
--
Pedro Alves