This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch 1/2] mingw: update gnulib: prepare the sources
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Kai Tietz <ktietz at redhat dot com>
- Cc: gdb-patches at sourceware dot org, Corinna Vinschen <vinschen at redhat dot com>, Nicholas Clifton <nickc at redhat dot com>
- Date: Wed, 24 Dec 2014 23:20:45 +0100
- Subject: Re: [patch 1/2] mingw: update gnulib: prepare the sources
- Authentication-results: sourceware.org; auth=none
- References: <20141222221229 dot GA30575 at host2 dot jankratochvil dot net> <108241234 dot 1319759 dot 1419335690162 dot JavaMail dot zimbra at redhat dot com>
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.
<sys/time.h> includes <winsock2.h> since:
gnulib:
https://lists.gnu.org/archive/html/bug-gnulib/2012-01/msg00372.html
commit f8e84098084b3b53bc6943a5542af1f607ffd477
Author: Bruno Haible <bruno@clisp.org>
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 <jan.kratochvil@redhat.com>
* 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 <!USE_WIN32API>: 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 <jan.kratochvil@redhat.com>
* remote-utils.c <!USE_WIN32API>: 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 <sys/time.h>
#include <time.h>
#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 <winsock2.h>
+#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 <http://www.gnu.org/licenses/>. */
+
+#ifndef GDB_TIMEVAL_H
+#define GDB_TIMEVAL_H
+
+/* For struct timeval. */
+#include <sys/time.h>
+
+/* 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 <winsock2.h>
+#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 <time.h>
#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 <sys/types.h>
#include <fcntl.h>
@@ -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 <pc.h>
#endif
-#include <signal.h>
+/* For struct timeval for timeval-utils.h. */
+#include <sys/time.h>
#include "timeval-utils.h"
+
+#include <signal.h>
#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);