From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4568 invoked by alias); 27 Aug 2010 15:46:16 -0000 Received: (qmail 4506 invoked by uid 22791); 27 Aug 2010 15:46:13 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-pw0-f41.google.com (HELO mail-pw0-f41.google.com) (209.85.160.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 27 Aug 2010 15:46:04 +0000 Received: by pwj6 with SMTP id 6so1756710pwj.0 for ; Fri, 27 Aug 2010 08:46:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.114.76.9 with SMTP id y9mr690747waa.26.1282923962779; Fri, 27 Aug 2010 08:46:02 -0700 (PDT) Received: by 10.231.141.155 with HTTP; Fri, 27 Aug 2010 08:46:02 -0700 (PDT) In-Reply-To: <201008271634.26160.pedro@codesourcery.com> References: <201008271545.47301.pedro@codesourcery.com> <201008271634.26160.pedro@codesourcery.com> Date: Fri, 27 Aug 2010 15:46:00 -0000 Message-ID: Subject: Re: gdbserver with -Werror, win64 socket type From: Ozkan Sezer To: Pedro Alves Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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 X-SW-Source: 2010-08/txt/msg00466.txt.bz2 On Fri, Aug 27, 2010 at 6:34 PM, Pedro Alves wrote: > On Friday 27 August 2010 16:09:37, Ozkan Sezer wrote: >> Hi Pedro, thanks for looking into this, > > >> > s/gdb/gdbserver, and there is actually no such assumption. =A0The mingw >> >> Not exactly correct, see gdb/serial.h, struct serial where fd is int type >> and is used socket() for assigning its data. > > Note the "s/gdb/gdbserver". > Speaking only for gdbserver, OK. >> ... I get these: >> >> ../../../gdb-cvs/gdb/gdbserver/event-loop.c: In function 'handle_file_ev= ent': >> ../../../gdb-cvs/gdb/gdbserver/event-loop.c:476: error: format '%d' >> expects type 'int', but argument 3 has type 'gdb_fildes_t' >> ../../../gdb-cvs/gdb/gdbserver/event-loop.c: In function 'create_file_ev= ent': >> ../../../gdb-cvs/gdb/gdbserver/event-loop.c:511: error: assignment >> from incompatible pointer type > > Try this version. =A0If this still fails, please use "make -k" so that we > see the most errors as possible in one run. > > -- > Pedro Alves > > --- > =A0gdb/gdbserver/event-loop.c =A0 | =A0 23 ++++++++++++----------- > =A0gdb/gdbserver/remote-utils.c | =A0 =A04 ++-- > =A0gdb/gdbserver/server.h =A0 =A0 =A0 | =A0 11 +++++++++-- > =A0gdb/gdbserver/utils.c =A0 =A0 =A0 =A0| =A0 12 ++++++++++++ > =A04 files changed, 35 insertions(+), 15 deletions(-) > > Index: src/gdb/gdbserver/event-loop.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- src.orig/gdb/gdbserver/event-loop.c 2010-08-27 15:58:56.000000000 +01= 00 > +++ src/gdb/gdbserver/event-loop.c =A0 =A0 =A02010-08-27 16:28:18.0000000= 00 +0100 > @@ -39,7 +39,7 @@ > =A0#endif > > =A0typedef struct gdb_event gdb_event; > -typedef int (event_handler_func) (int); > +typedef int (event_handler_func) (gdb_fildes_t); > > =A0/* Tell create_file_handler what events we are interested in. =A0*/ > > @@ -64,7 +64,7 @@ struct gdb_event > =A0 =A0 event_handler_func *proc; > > =A0 =A0 /* File descriptor that is ready. =A0*/ > - =A0 =A0int fd; > + =A0 =A0gdb_fildes_t fd; > > =A0 =A0 /* Next in list of events or NULL. =A0*/ > =A0 =A0 struct gdb_event *next_event; > @@ -76,7 +76,7 @@ struct gdb_event > =A0typedef struct file_handler > =A0 { > =A0 =A0 /* File descriptor. =A0*/ > - =A0 =A0int fd; > + =A0 =A0gdb_fildes_t fd; > > =A0 =A0 /* Events we want to monitor. =A0*/ > =A0 =A0 int mask; > @@ -202,7 +202,7 @@ process_event (void) > =A0{ > =A0 gdb_event *event_ptr, *prev_ptr; > =A0 event_handler_func *proc; > - =A0int fd; > + =A0gdb_fildes_t fd; > > =A0 /* Look in the event queue to find an event that is ready > =A0 =A0 =A0to be processed. =A0*/ > @@ -332,7 +332,7 @@ process_callback (void) > =A0 =A0occurs for FD. =A0CLIENT_DATA is the argument to pass to PROC. =A0= */ > > =A0static void > -create_file_handler (int fd, int mask, handler_func *proc, > +create_file_handler (gdb_fildes_t fd, int mask, handler_func *proc, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 gdb_client_data client_data) > =A0{ > =A0 file_handler *file_ptr; > @@ -382,7 +382,8 @@ create_file_handler (int fd, int mask, h > =A0/* Wrapper function for create_file_handler. =A0*/ > > =A0void > -add_file_handler (int fd, handler_func *proc, gdb_client_data client_dat= a) > +add_file_handler (gdb_fildes_t fd, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 handler_func *proc, gdb_client_data cli= ent_data) > =A0{ > =A0 create_file_handler (fd, GDB_READABLE | GDB_EXCEPTION, proc, client_d= ata); > =A0} > @@ -391,7 +392,7 @@ add_file_handler (int fd, handler_func * > =A0 =A0i.e. we don't care anymore about events on the FD. =A0*/ > > =A0void > -delete_file_handler (int fd) > +delete_file_handler (gdb_fildes_t fd) > =A0{ > =A0 file_handler *file_ptr, *prev_ptr =3D NULL; > =A0 int i; > @@ -454,7 +455,7 @@ delete_file_handler (int fd) > =A0 =A0event in the front of the event queue. =A0*/ > > =A0static int > -handle_file_event (int event_file_desc) > +handle_file_event (gdb_fildes_t event_file_desc) > =A0{ > =A0 file_handler *file_ptr; > =A0 int mask; > @@ -471,8 +472,8 @@ handle_file_event (int event_file_desc) > > =A0 =A0 =A0 =A0 =A0if (file_ptr->ready_mask & GDB_EXCEPTION) > =A0 =A0 =A0 =A0 =A0 =A0{ > - =A0 =A0 =A0 =A0 =A0 =A0 fprintf (stderr, "Exception condition detected = on fd %d\n", > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0file_ptr->fd); > + =A0 =A0 =A0 =A0 =A0 =A0 fprintf (stderr, "Exception condition detected = on fd %s\n", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0pfildes (file_ptr->fd)); > =A0 =A0 =A0 =A0 =A0 =A0 =A0file_ptr->error =3D 1; > =A0 =A0 =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0 =A0else > @@ -502,7 +503,7 @@ handle_file_event (int event_file_desc) > =A0 =A0associated to FD when it was registered with the event loop. =A0*/ > > =A0static gdb_event * > -create_file_event (int fd) > +create_file_event (gdb_fildes_t fd) > =A0{ > =A0 gdb_event *file_event_ptr; > > Index: src/gdb/gdbserver/remote-utils.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- src.orig/gdb/gdbserver/remote-utils.c =A0 =A0 =A0 2010-08-27 15:58:56= .000000000 +0100 > +++ src/gdb/gdbserver/remote-utils.c =A0 =A02010-08-27 16:21:22.000000000= +0100 > @@ -107,8 +107,8 @@ struct sym_cache > =A0int remote_debug =3D 0; > =A0struct ui_file *gdb_stdlog; > > -static int remote_desc =3D INVALID_DESCRIPTOR; > -static int listen_desc =3D INVALID_DESCRIPTOR; > +static gdb_fildes_t remote_desc =3D INVALID_DESCRIPTOR; > +static gdb_fildes_t listen_desc =3D INVALID_DESCRIPTOR; > > =A0/* FIXME headerize? */ > =A0extern int using_threads; > Index: src/gdb/gdbserver/server.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- src.orig/gdb/gdbserver/server.h =A0 =A0 2010-08-27 15:58:56.000000000= +0100 > +++ src/gdb/gdbserver/server.h =A02010-08-27 16:27:02.000000000 +0100 > @@ -334,13 +334,19 @@ extern int disable_packet_qfThreadInfo; > =A0extern int multi_process; > =A0extern int non_stop; > > +#if USE_WIN32API > +typedef SOCKET gdb_fildes_t; > +#else > +typedef int gdb_fildes_t; > +#endif > + > =A0/* Functions from event-loop.c. =A0*/ > =A0typedef void *gdb_client_data; > =A0typedef int (handler_func) (int, gdb_client_data); > =A0typedef int (callback_handler_func) (gdb_client_data); > > -extern void delete_file_handler (int fd); > -extern void add_file_handler (int fd, handler_func *proc, > +extern void delete_file_handler (gdb_fildes_t fd); > +extern void add_file_handler (gdb_fildes_t fd, handler_func *proc, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0gdb_client_dat= a client_data); > =A0extern int append_callback_event (callback_handler_func *proc, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 gdb_c= lient_data client_data); > @@ -473,6 +479,7 @@ char *paddress (CORE_ADDR addr); > =A0char *pulongest (ULONGEST u); > =A0char *plongest (LONGEST l); > =A0char *phex_nz (ULONGEST l, int sizeof_l); > +char *pfildes (gdb_fildes_t fd); > > =A0#define gdb_assert(expr) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0\ > =A0 ((void) ((expr) ? 0 : =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 \ > Index: src/gdb/gdbserver/utils.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- src.orig/gdb/gdbserver/utils.c =A0 =A0 =A02010-07-21 19:13:37.0000000= 00 +0100 > +++ src/gdb/gdbserver/utils.c =A0 2010-08-27 16:30:51.000000000 +0100 > @@ -370,3 +370,15 @@ paddress (CORE_ADDR addr) > =A0{ > =A0 return phex_nz (addr, sizeof (CORE_ADDR)); > =A0} > + > +/* Convert a file descriptor into a printable string. =A0*/ > + > +char * > +pfildes (gdb_fildes_t fd) > +{ > +#if USE_WIN32API > + =A0return phex_nz (fd, sizeof (gdb_fildes_t)); > +#else > + =A0return plongest (fd); > +#endif > +} > In file included from version.c:1: ../../../gdb-cvs/gdb/gdbserver/server.h:338: error: expected '=3D', ',', ';', 'asm' or '__attribute__' before 'gdb_fildes_t' ../../../gdb-cvs/gdb/gdbserver/server.h:348: error: expected ')' before 'fd' ../../../gdb-cvs/gdb/gdbserver/server.h:349: error: expected ')' before 'fd' ../../../gdb-cvs/gdb/gdbserver/server.h:482: error: expected ')' before 'fd' This can be fixed by inserting an #include before the gdb_fildes_t typedefinition in server.h. After doing this, the build reach= es completion without errors. Of you want, I can send my full build logs, -- Ozkan