From patchwork Wed Dec 24 22:20:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 4422 Received: (qmail 9925 invoked by alias); 24 Dec 2014 22:20:57 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 9915 invoked by uid 89); 24 Dec 2014 22:20:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 24 Dec 2014 22:20:54 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sBOMKqNt004861 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 24 Dec 2014 17:20:53 -0500 Received: from host2.jankratochvil.net (ovpn-116-47.ams2.redhat.com [10.36.116.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sBOMKj8G003697 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 24 Dec 2014 17:20:48 -0500 Date: Wed, 24 Dec 2014 23:20:45 +0100 From: Jan Kratochvil To: Kai Tietz Cc: gdb-patches@sourceware.org, Corinna Vinschen , Nicholas Clifton Subject: Re: [patch 1/2] mingw: update gnulib: prepare the sources Message-ID: <20141224222045.GA30482@host2.jankratochvil.net> References: <20141222221229.GA30575@host2.jankratochvil.net> <108241234.1319759.1419335690162.JavaMail.zimbra@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <108241234.1319759.1419335690162.JavaMail.zimbra@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi Kai, On Tue, 23 Dec 2014 12:54:50 +0100, Kai Tietz wrote: > > The whole problem is that the gnulib update (in [patch 2/2]) will cause > > (only) for build_win64 many errors like this one: > Only for win64? This is curious. As headers are shared between 32-bit and > 64-bit, and most part of Win32 API too. Yes, only win64 - because the change making struct timeval incompatible with select()'s argument http://sourceforge.net/p/mingw-w64/mailman/message/29610438/ has there +#ifdef __LP64__ > Well, IMO the real issue here is to include windows.h instead of sys/time.h. The patch is now different so I am not sure if it still applies and what is the reason for it. includes since: gnulib: https://lists.gnu.org/archive/html/bug-gnulib/2012-01/msg00372.html commit f8e84098084b3b53bc6943a5542af1f607ffd477 Author: Bruno Haible Date: Sat Jan 28 18:12:10 2012 +0100 sys_time: Override 'struct timeval' on some native Windows platforms. > Sadly MS decided to pollute namespace with commonly used names in their > platform-headers. So in the past we tried to avoid to include things like > windows.h in bfd and related headers, and to isolate files, which actually > need to include it (eg windows-unicode stuff in binutils/). To include it > now leads to a general architectural change of binutils' bfd (and other > parts). I am not in general oppose to it, but I am wondering if this is > really wanted/needed. Both options are ugly but following the current include/coff/ assumption makes the patch smaller. It builds now (not runtime tested) for mingw64 32-bit and 64-bit. No regressions on {x86_64,x86_64-m32}-fedora21-linux-gnu. Jan gdb/ 2014-12-24 Jan Kratochvil * defs.h (print_transfer_performance): Move it to gdb_timeval.h. * dsrec.c: Include gdb_timeval.h. * event-loop.c (gdb_notifier, gdb_wait_for_event): Use TIMEVAL. * gdb_select.h : Define TIMEVAL. * gdb_timeval.h: New file. * gdb_usleep.c (gdb_usleep): Use TIMEVAL. * m32r-rom.c, maint.c: Include gdb_timeval.h. * mingw-hdep.c (gdb_select): Use TIMEVAL. * remote-m32r-sdi.c: Include gdb_timeval.h. * ser-base.c (ser_base_wait_for): Use TIMEVAL. * ser-tcp.c (wait_for_connect): Use TIMEVAL. * symfile.c: Include gdb_timeval.h. Replace SIZE for OSIZE. * utils.c: Include sys/time.h and gdb_timeval.h. * utils.h (get_prompt_for_continue_wait_time): Move it to gdb_timeval.h. gdb/gdbserver/ 2014-12-24 Jan Kratochvil * remote-utils.c : Define TIMEVAL. (input_interrupt): Use TIMEVAL. --- ./gdb/defs.h 2014-12-24 22:50:07.853460614 +0100 +++ ./gdb/defs.h 2014-12-24 22:34:08.898812292 +0100 @@ -259,20 +259,6 @@ extern void symbol_file_command (char *, /* * Remote targets may wish to use this as their load function. */ extern void generic_load (const char *name, int from_tty); -/* * Report on STREAM the performance of memory transfer operation, - such as 'load'. - @param DATA_COUNT is the number of bytes transferred. - @param WRITE_COUNT is the number of separate write operations, or 0, - if that information is not available. - @param START_TIME is the time at which an operation was started. - @param END_TIME is the time at which an operation ended. */ -struct timeval; -extern void print_transfer_performance (struct ui_file *stream, - unsigned long data_count, - unsigned long write_count, - const struct timeval *start_time, - const struct timeval *end_time); - /* From top.c */ typedef void initialize_file_ftype (void); --- ./gdb/dsrec.c 2014-12-24 22:50:07.885460536 +0100 +++ ./gdb/dsrec.c 2014-12-24 22:44:41.595260709 +0100 @@ -22,6 +22,7 @@ #include #include #include "gdb_bfd.h" +#include "gdb_timeval.h" extern int remote_debug; --- ./gdb/event-loop.c 2014-12-24 22:50:07.893460516 +0100 +++ ./gdb/event-loop.c 2014-12-24 22:34:08.899812290 +0100 @@ -189,7 +189,7 @@ static struct int num_fds; /* Time structure for calls to select(). */ - struct timeval select_timeout; + TIMEVAL select_timeout; /* Flag to tell whether the timeout should be used. */ int timeout_valid; @@ -809,8 +809,8 @@ gdb_wait_for_event (int block) } else { - struct timeval select_timeout; - struct timeval *timeout_p; + TIMEVAL select_timeout; + TIMEVAL *timeout_p; if (block) timeout_p = gdb_notifier.timeout_valid --- ./gdb/gdb_select.h 2014-12-24 22:50:07.911460472 +0100 +++ ./gdb/gdb_select.h 2014-12-24 22:48:50.897649332 +0100 @@ -28,9 +28,11 @@ #ifdef USE_WIN32API #include +#else +typedef struct timeval TIMEVAL; #endif extern int gdb_select (int n, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout); + fd_set *exceptfds, TIMEVAL *timeout); #endif /* !defined(GDB_SELECT_H) */ --- ./gdb/gdb_timeval.h 2014-12-24 22:51:16.010293470 +0100 +++ ./gdb/gdb_timeval.h 2014-12-24 22:34:08.899812290 +0100 @@ -0,0 +1,45 @@ +/* Declarations using struct timeval. + Copyright (C) 2014 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef GDB_TIMEVAL_H +#define GDB_TIMEVAL_H + +/* For struct timeval. */ +#include + +/* From utils.c. */ + +/* Return the time spent in prompt_for_continue. */ +struct timeval get_prompt_for_continue_wait_time (void); + +/* From symfile.c. */ + +/* * Report on STREAM the performance of memory transfer operation, + such as 'load'. + @param DATA_COUNT is the number of bytes transferred. + @param WRITE_COUNT is the number of separate write operations, or 0, + if that information is not available. + @param START_TIME is the time at which an operation was started. + @param END_TIME is the time at which an operation ended. */ +extern void print_transfer_performance (struct ui_file *stream, + unsigned long data_count, + unsigned long write_count, + const struct timeval *start_time, + const struct timeval *end_time); + +#endif /* GDB_TIMEVAL_H */ --- ./gdb/gdb_usleep.c 2014-12-24 22:50:07.911460472 +0100 +++ ./gdb/gdb_usleep.c 2014-12-24 22:34:08.899812290 +0100 @@ -24,7 +24,7 @@ int gdb_usleep (int usec) { - struct timeval delay; + TIMEVAL delay; int retval; delay.tv_sec = usec / 1000000; --- ./gdb/gdbserver/remote-utils.c 2014-12-24 22:50:07.965460340 +0100 +++ ./gdb/gdbserver/remote-utils.c 2014-12-24 22:49:47.705510024 +0100 @@ -59,6 +59,8 @@ #if USE_WIN32API #include +#else +typedef struct timeval TIMEVAL; #endif #if __QNX__ @@ -727,7 +729,7 @@ static void input_interrupt (int unused) { fd_set readset; - struct timeval immediate = { 0, 0 }; + TIMEVAL immediate = { 0, 0 }; /* Protect against spurious interrupts. This has been observed to be a problem under NetBSD 1.4 and 1.5. */ --- ./gdb/m32r-rom.c 2014-12-24 22:50:08.037460163 +0100 +++ ./gdb/m32r-rom.c 2014-12-24 22:44:23.595304849 +0100 @@ -39,6 +39,7 @@ #include "regcache.h" #include "gdb_bfd.h" #include "cli/cli-utils.h" +#include "gdb_timeval.h" /* * All this stuff just to get my host computer's IP address! --- ./gdb/maint.c 2014-12-24 22:50:08.048460136 +0100 +++ ./gdb/maint.c 2014-12-24 22:34:08.900812288 +0100 @@ -41,6 +41,7 @@ #include "top.h" #include "timeval-utils.h" #include "maint.h" +#include "gdb_timeval.h" #include "cli/cli-decode.h" #include "cli/cli-utils.h" --- ./gdb/mingw-hdep.c 2014-12-24 22:50:08.054460121 +0100 +++ ./gdb/mingw-hdep.c 2014-12-24 22:34:08.900812288 +0100 @@ -101,7 +101,7 @@ windows_get_absolute_argv0 (const char * int gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, - struct timeval *timeout) + TIMEVAL *timeout) { static HANDLE never_handle; HANDLE handles[MAXIMUM_WAIT_OBJECTS]; --- ./gdb/remote-m32r-sdi.c 2014-12-24 22:50:08.103460001 +0100 +++ ./gdb/remote-m32r-sdi.c 2014-12-24 22:44:58.091220251 +0100 @@ -40,6 +40,7 @@ #include #include "gdb_bfd.h" #include "cli/cli-utils.h" +#include "gdb_timeval.h" #include "serial.h" --- ./gdb/ser-base.c 2014-12-24 22:50:08.143459903 +0100 +++ ./gdb/ser-base.c 2014-12-24 22:34:08.901812285 +0100 @@ -205,7 +205,7 @@ ser_base_wait_for (struct serial *scb, i while (1) { int numfds; - struct timeval tv; + TIMEVAL tv; fd_set readfds, exceptfds; /* NOTE: Some OS's can scramble the READFDS when the select() --- ./gdb/ser-tcp.c 2014-12-24 22:50:08.144459901 +0100 +++ ./gdb/ser-tcp.c 2014-12-24 22:34:08.901812285 +0100 @@ -85,7 +85,7 @@ static unsigned int tcp_retry_limit = 15 static int wait_for_connect (struct serial *scb, unsigned int *polls) { - struct timeval t; + TIMEVAL t; int n; /* While we wait for the connect to complete, --- ./gdb/symfile.c 2014-12-24 22:50:08.183459805 +0100 +++ ./gdb/symfile.c 2014-12-24 22:34:08.902812283 +0100 @@ -56,6 +56,7 @@ #include "stack.h" #include "gdb_bfd.h" #include "cli/cli-utils.h" +#include "gdb_timeval.h" #include #include @@ -3541,12 +3542,12 @@ overlay_command (char *args, int from_tt In this simple implementation, the target data structures are as follows: unsigned _novlys; /# number of overlay sections #/ unsigned _ovly_table[_novlys][4] = { - {VMA, SIZE, LMA, MAPPED}, /# one entry per overlay section #/ + {VMA, OSIZE, LMA, MAPPED}, /# one entry per overlay section #/ {..., ..., ..., ...}, } unsigned _novly_regions; /# number of overlay regions #/ unsigned _ovly_region_table[_novly_regions][3] = { - {VMA, SIZE, MAPPED_TO_LMA}, /# one entry per overlay region #/ + {VMA, OSIZE, MAPPED_TO_LMA}, /# one entry per overlay region #/ {..., ..., ...}, } These functions will attempt to update GDB's mappedness state in the @@ -3564,7 +3565,7 @@ static unsigned cache_novlys = 0; static CORE_ADDR cache_ovly_table_base = 0; enum ovly_index { - VMA, SIZE, LMA, MAPPED + VMA, OSIZE, LMA, MAPPED }; /* Throw away the cached copy of _ovly_table. */ @@ -3664,14 +3665,14 @@ simple_overlay_update_1 (struct obj_sect for (i = 0; i < cache_novlys; i++) if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect) && cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect) - /* && cache_ovly_table[i][SIZE] == size */ ) + /* && cache_ovly_table[i][OSIZE] == size */ ) { read_target_long_array (cache_ovly_table_base + i * word_size, (unsigned int *) cache_ovly_table[i], 4, word_size, byte_order); if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect) && cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect) - /* && cache_ovly_table[i][SIZE] == size */ ) + /* && cache_ovly_table[i][OSIZE] == size */ ) { osect->ovly_mapped = cache_ovly_table[i][MAPPED]; return 1; @@ -3737,7 +3738,7 @@ simple_overlay_update (struct obj_sectio for (i = 0; i < cache_novlys; i++) if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect) && cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect) - /* && cache_ovly_table[i][SIZE] == size */ ) + /* && cache_ovly_table[i][OSIZE] == size */ ) { /* obj_section matches i'th entry in ovly_table. */ osect->ovly_mapped = cache_ovly_table[i][MAPPED]; break; /* finished with inner for loop: break out. */ --- ./gdb/utils.c 2014-12-24 22:50:08.455459138 +0100 +++ ./gdb/utils.c 2014-12-24 22:34:08.904812278 +0100 @@ -37,8 +37,11 @@ #include #endif -#include +/* For struct timeval for timeval-utils.h. */ +#include #include "timeval-utils.h" + +#include #include "gdbcmd.h" #include "serial.h" #include "bfd.h" @@ -55,6 +58,7 @@ #include "top.h" #include "main.h" #include "solist.h" +#include "gdb_timeval.h" #include "inferior.h" /* for signed_pointer_to_address */ --- ./gdb/utils.h 2014-12-24 22:50:08.455459138 +0100 +++ ./gdb/utils.h 2014-12-24 22:34:08.904812278 +0100 @@ -54,9 +54,7 @@ extern const char *gdb_bfd_errmsg (bfd_e /* Reset the prompt_for_continue clock. */ void reset_prompt_for_continue_wait_time (void); -/* Return the time spent in prompt_for_continue. */ -struct timeval get_prompt_for_continue_wait_time (void); - + /* Parsing utilites. */ extern int parse_pid_to_attach (const char *args);