* [patch 1/2] mingw: update gnulib: prepare the sources
@ 2014-12-22 22:12 Jan Kratochvil
2014-12-23 11:54 ` Kai Tietz
0 siblings, 1 reply; 13+ messages in thread
From: Jan Kratochvil @ 2014-12-22 22:12 UTC (permalink / raw)
To: gdb-patches; +Cc: Kai Tietz, Corinna Vinschen
[-- Attachment #1: Type: text/plain, Size: 4545 bytes --]
Hi,
GDB sources currently contain gdb/gnulib/ import from Dec 2012.
To fix a bit unrelated problem
gdb build failure with -Werror
https://sourceware.org/bugzilla/show_bug.cgi?id=17718
gdb/compile/compile.c: In function ‘do_rmdir’:
gdb/compile/compile.c:176:10: error: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Werror=unused-result]
It is being discussed in the long thread:
[patch] compile: rm -rf -> ftw()+rmdir()+unlink() [Re: [patch] compile: Fix MinGW build]
https://sourceware.org/ml/gdb-patches/2014-12/msg00501.html
I need to update gnulib first to prevent a bug in that 2012 gnulib when trying
to import its fts module (unrelated to this patchset) which was:
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I../../../../gdb/gnulib/import -I.. -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -D__USE_MINGW_ACCESS -MT msvc-inval.o -MD -MP -MF .deps/msvc-inval.Tpo -c -o msvc-inval.o ../../../../gdb/gnulib/import/msvc-inval.c
../../../../gdb/gnulib/import/msvc-inval.c:32:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gl_msvc_invalid_parameter_handler'
gl_msvc_invalid_parameter_handler (const wchar_t *expression,
^
../../../../gdb/gnulib/import/msvc-inval.c: In function 'gl_msvc_inval_ensure_handler':
../../../../gdb/gnulib/import/msvc-inval.c:124:39: error: 'gl_msvc_invalid_parameter_handler' undeclared (first use in this function)
_set_invalid_parameter_handler (gl_msvc_invalid_parameter_handler);
^
../../../../gdb/gnulib/import/msvc-inval.c:124:39: note: each undeclared identifier is reported only once for each function it appears in
Makefile:1511: recipe for target 'msvc-inval.o' failed
make[8]: *** [msvc-inval.o] Error 1
Besides that it would be probably good to update gdb/gnulib/ anyway.
------------------------------------------------------------------------------
The whole problem is that the gnulib update (in [patch 2/2]) will cause (only)
for build_win64 many errors like this one:
x86_64-w64-mingw32-gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -D__USE_MINGW_ACCESS -I. -I../../gdb -I../../gdb/common -I../../gdb/config -DLOCALEDIR="\"/usr/x86_64-w64-mingw32/sys-root/mingw/share/locale\"" -DHAVE_CONFIG_H -I../../gdb/../include/opcode -I../../gdb/../opcodes/.. -I../../gdb/../readline/.. -I../bfd -I../../gdb/../bfd -I../../gdb/../include -I../libdecnumber -I../../gdb/../libdecnumber -I./../intl -I../../gdb/gnulib/import -Ibuild-gnulib/import -Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition -Wno-format -Werror -c -o ser-tcp.o -MT ser-tcp.o -MMD -MP -MF .deps/ser-tcp.Tpo ../../gdb/ser-tcp.c
../../gdb/ser-tcp.c: In function 'wait_for_connect':
../../gdb/ser-tcp.c:137:53: error: passing argument 5 of 'select' from incompatible pointer type [-Werror]
n = select (scb->fd + 1, &rset, &wset, &eset, &t);
^
In file included from ../../gdb/serial.h:23:0,
from ../../gdb/ser-tcp.c:21:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/winsock2.h:995:34: note: expected 'PTIMEVAL' but argument is of type 'struct rpl_timeval *'
WINSOCK_API_LINKAGE int WSAAPI select(int nfds,fd_set *readfds,fd_set *writefds,fd_set *exceptfds,const PTIMEVAL timeout);
^
cc1: all warnings being treated as errors
Makefile:1100: recipe for target 'ser-tcp.o' failed
This IIUC comes from this mingw64 change:
[Mingw-w64-public] [patch] Replace struct timeval usage with PTIMEVAL and define TIMEVAL differently on LP64
http://sourceforge.net/p/mingw-w64/mailman/message/29610438/
This is because occasional #include <sys/time.h> will then #include also
MS-Windows headers and provide an incompatible definition of struct timeval.
IIUC one should always #include <sys/time.h> to get all the struct timeval
definitions in the codebase the same.
But #including <sys/time.h> (and thus <windows.h>) is a problem as sourceware
include/coff/ headers have duplicate/conflicting definitions with MS-Windows
headers. So I have #ifndef-out their duplicate/conflicting parts during 64-bit
MS-Windows builds.
I have no idea what is the best way, my only goal was to make it buildable
(not runtime tested as Wine does not work so well for gdb.exe).
Thanks,
Jan
[-- Attachment #2: use.patch --]
[-- Type: text/plain, Size: 63883 bytes --]
bfd/ChangeLog
2014-12-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* coffgen.c (N_TMASK, N_BTSHFT): Redefine them on _WIN64.
* cofflink.c (N_TMASK, N_BTSHFT, N_BTMASK): Redefine them on _WIN64.
* peXXigen.c (max, min): Define them only if they do not yet exist.
(IMAGE_NT_OPTIONAL_HDR_MAGIC): Rename to ...
(IMAGE_NT_OPTIONAL_HDR32_MAGIC): ... here.
gdb/ChangeLog
2014-12-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* ada-exp.y: Rename symbols conflicting with MS-Windows to TOK_*.
* ada-lang.c: Rename ada_inferior_data::exception_info to
ada_exception_info due to its conflict on MS-Windows.
* ada-lex.l: Rename symbols conflicting with MS-Windows to TOK_*.
* c-exp.y: Likewise.
* coff-pe-read.c: Do not define symbols conflicting with MS-Windows on
_WIN64.
* coffread.c: Redefine symbols conflicting with MS-Windows on _WIN64.
* cp-name-parser.y: Rename symbols conflicting with MS-Windows to TOK_*.
* d-exp.y: Likewise.
* defs.h: Include sys/time.h.
* f-exp.y: Rename symbols conflicting with MS-Windows to TOK_*.
* go-exp.y: Likewise.
* jv-exp.y: Likewise.
* m2-exp.y: Likewise.
* p-exp.y: Likewise.
* ser-tcp.c (close): Redefine it on _WIN64.
(wait_for_connect): Use TIMEVAL.
* symfile.c (SIZE): Rename to ...
(OVLY_SIZE): ... here.
gdb/gdbserver/ChangeLog
2014-12-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* remote-utils.c (input_interrupt): Use TIMEVAL.
include/coff/ChangeLog
2014-12-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* ecoff.h: Do not define symbols conflicting with MS-Windows on _WIN64.
* internal.h: Include windows.h on _WIN64. Do not define symbols
conflicting with MS-Windows on _WIN64.
* pe.h: Do not define symbols conflicting with MS-Windows on _WIN64.
--- old/orig/bfd/coffgen.c 2014-12-14 02:48:36.000000000 +0100
+++ ./bfd/coffgen.c 2014-12-22 20:08:32.551511966 +0100
@@ -1530,6 +1530,10 @@ coff_pointerize_aux (bfd *abfd,
BFD_ASSERT (! auxent->is_sym);
/* Otherwise patch up. */
+#ifdef _WIN64
+# undef N_TMASK
+# undef N_BTSHFT
+#endif
#define N_TMASK coff_data (abfd)->local_n_tmask
#define N_BTSHFT coff_data (abfd)->local_n_btshft
--- old/orig/bfd/cofflink.c 2014-12-14 02:48:36.000000000 +0100
+++ ./bfd/cofflink.c 2014-12-22 20:07:22.583498498 +0100
@@ -50,6 +50,11 @@ static bfd_boolean coff_link_add_symbols
variables with the appropriate names, and with values from the
coff_data (abfd) structure. */
+#ifdef _WIN64
+# undef N_TMASK
+# undef N_BTSHFT
+# undef N_BTMASK
+#endif
#define N_TMASK n_tmask
#define N_BTSHFT n_btshft
#define N_BTMASK n_btmask
diff -dup -rup orig/bfd/peXXigen.c origx/bfd/peXXigen.c
--- orig/bfd/peXXigen.c 2014-12-14 02:48:37.000000000 +0100
+++ origx/bfd/peXXigen.c 2014-12-22 21:43:43.346869824 +0100
@@ -2394,8 +2394,12 @@ rsrc_print_resource_entries (FILE *
return regions->section_start + (addr - rva_bias) + size;
}
-#define max(a,b) ((a) > (b) ? (a) : (b))
-#define min(a,b) ((a) < (b) ? (a) : (b))
+#ifndef max
+# define max(a,b) ((a) > (b) ? (a) : (b))
+#endif
+#ifndef min
+# define min(a,b) ((a) < (b) ? (a) : (b))
+#endif
static bfd_byte *
rsrc_print_resource_directory (FILE * file,
@@ -2722,8 +2726,8 @@ _bfd_XX_print_private_bfd_data_common (b
fprintf (file, "\nTime/Date\t\t%s", ctime (&t));
}
-#ifndef IMAGE_NT_OPTIONAL_HDR_MAGIC
-# define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
+#ifndef IMAGE_NT_OPTIONAL_HDR32_MAGIC
+# define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
#endif
#ifndef IMAGE_NT_OPTIONAL_HDR64_MAGIC
# define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
@@ -2734,7 +2738,7 @@ _bfd_XX_print_private_bfd_data_common (b
switch (i->Magic)
{
- case IMAGE_NT_OPTIONAL_HDR_MAGIC:
+ case IMAGE_NT_OPTIONAL_HDR32_MAGIC:
name = "PE32";
break;
case IMAGE_NT_OPTIONAL_HDR64_MAGIC:
--- old/orig/gdb/ada-exp.y 2014-12-14 02:48:38.000000000 +0100
+++ ./gdb/ada-exp.y 2014-12-22 20:26:50.900743191 +0100
@@ -192,8 +192,8 @@ static struct type *type_system_address
%type <lval> aggregate_component_list
%type <tval> var_or_type
-%token <typed_val> INT NULL_PTR CHARLIT
-%token <typed_val_float> FLOAT
+%token <typed_val> TOK_INT NULL_PTR CHARLIT
+%token <typed_val_float> TOK_FLOAT
%token TRUEKEYWORD FALSEKEYWORD
%token COLONCOLON
%token <sval> STRING NAME DOT_ID
@@ -210,7 +210,7 @@ static struct type *type_system_address
%nonassoc ASSIGN
%left _AND_ OR XOR THEN ELSE
-%left '=' NOTEQUAL '<' '>' LEQ GEQ IN DOTDOT
+%left '=' NOTEQUAL '<' '>' LEQ GEQ TOK_IN DOTDOT
%left '@'
%left '+' '-' '&'
%left UNARY
@@ -433,14 +433,14 @@ relation : simple_exp LEQ simple_exp
{ write_exp_elt_opcode (pstate, BINOP_LEQ); }
;
-relation : simple_exp IN simple_exp DOTDOT simple_exp
+relation : simple_exp TOK_IN simple_exp DOTDOT simple_exp
{ write_exp_elt_opcode (pstate, TERNOP_IN_RANGE); }
- | simple_exp IN primary TICK_RANGE tick_arglist
+ | simple_exp TOK_IN primary TICK_RANGE tick_arglist
{ write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS);
write_exp_elt_longcst (pstate, (LONGEST) $5);
write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS);
}
- | simple_exp IN var_or_type %prec TICK_ACCESS
+ | simple_exp TOK_IN var_or_type %prec TICK_ACCESS
{
if ($3 == NULL)
error (_("Right operand of 'in' must be type"));
@@ -448,17 +448,17 @@ relation : simple_exp IN simple_exp DOTD
write_exp_elt_type (pstate, $3);
write_exp_elt_opcode (pstate, UNOP_IN_RANGE);
}
- | simple_exp NOT IN simple_exp DOTDOT simple_exp
+ | simple_exp NOT TOK_IN simple_exp DOTDOT simple_exp
{ write_exp_elt_opcode (pstate, TERNOP_IN_RANGE);
write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT);
}
- | simple_exp NOT IN primary TICK_RANGE tick_arglist
+ | simple_exp NOT TOK_IN primary TICK_RANGE tick_arglist
{ write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS);
write_exp_elt_longcst (pstate, (LONGEST) $6);
write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS);
write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT);
}
- | simple_exp NOT IN var_or_type %prec TICK_ACCESS
+ | simple_exp NOT TOK_IN var_or_type %prec TICK_ACCESS
{
if ($4 == NULL)
error (_("Right operand of 'in' must be type"));
@@ -567,7 +567,7 @@ primary : primary TICK_ACCESS
tick_arglist : %prec '('
{ $$ = 1; }
- | '(' INT ')'
+ | '(' TOK_INT ')'
{ $$ = $2.val; }
;
@@ -591,7 +591,7 @@ opt_type_prefix :
;
-primary : INT
+primary : TOK_INT
{ write_int (pstate, (LONGEST) $1.val, $1.type); }
;
@@ -603,7 +603,7 @@ primary : CHARLIT
}
;
-primary : FLOAT
+primary : TOK_FLOAT
{ write_exp_elt_opcode (pstate, OP_DOUBLE);
write_exp_elt_type (pstate, $1.type);
write_exp_elt_dblcst (pstate, $1.dval);
--- old/orig/gdb/ada-lang.c 2014-12-14 02:48:38.000000000 +0100
+++ ./gdb/ada-lang.c 2014-12-22 20:44:15.484005755 +0100
@@ -382,7 +382,7 @@ struct ada_inferior_data
/* The exception_support_info data. This data is used to determine
how to implement support for Ada exception catchpoints in a given
inferior. */
- const struct exception_support_info *exception_info;
+ const struct exception_support_info *ada_exception_info;
};
/* Our key to this module's inferior data. */
@@ -11530,7 +11530,7 @@ ada_has_this_exception_support (const st
/* Inspect the Ada runtime and determine which exception info structure
should be used to provide support for exception catchpoints.
- This function will always set the per-inferior exception_info,
+ This function will always set the per-inferior ada_exception_info,
or raise an error. */
static void
@@ -11539,20 +11539,20 @@ ada_exception_support_info_sniffer (void
struct ada_inferior_data *data = get_ada_inferior_data (current_inferior ());
/* If the exception info is already known, then no need to recompute it. */
- if (data->exception_info != NULL)
+ if (data->ada_exception_info != NULL)
return;
/* Check the latest (default) exception support info. */
if (ada_has_this_exception_support (&default_exception_support_info))
{
- data->exception_info = &default_exception_support_info;
+ data->ada_exception_info = &default_exception_support_info;
return;
}
/* Try our fallback exception suport info. */
if (ada_has_this_exception_support (&exception_support_info_fallback))
{
- data->exception_info = &exception_support_info_fallback;
+ data->ada_exception_info = &exception_support_info_fallback;
return;
}
@@ -11712,7 +11712,7 @@ ada_unhandled_exception_name_addr_from_r
make_cleanup (xfree, func_name);
if (strcmp (func_name,
- data->exception_info->catch_exception_sym) == 0)
+ data->ada_exception_info->catch_exception_sym) == 0)
break; /* We found the frame we were looking for... */
fi = get_prev_frame (fi);
}
@@ -11745,7 +11745,7 @@ ada_exception_name_addr_1 (enum ada_exce
break;
case ada_catch_exception_unhandled:
- return data->exception_info->unhandled_exception_name_addr ();
+ return data->ada_exception_info->unhandled_exception_name_addr ();
break;
case ada_catch_assert:
@@ -12477,18 +12477,18 @@ ada_exception_sym_name (enum ada_excepti
{
struct ada_inferior_data *data = get_ada_inferior_data (current_inferior ());
- gdb_assert (data->exception_info != NULL);
+ gdb_assert (data->ada_exception_info != NULL);
switch (ex)
{
case ada_catch_exception:
- return (data->exception_info->catch_exception_sym);
+ return (data->ada_exception_info->catch_exception_sym);
break;
case ada_catch_exception_unhandled:
- return (data->exception_info->catch_exception_unhandled_sym);
+ return (data->ada_exception_info->catch_exception_unhandled_sym);
break;
case ada_catch_assert:
- return (data->exception_info->catch_assert_sym);
+ return (data->ada_exception_info->catch_assert_sym);
break;
default:
internal_error (__FILE__, __LINE__,
--- old/orig/gdb/ada-lex.l 2014-12-14 02:48:38.000000000 +0100
+++ ./gdb/ada-lex.l 2014-12-22 20:31:00.939803092 +0100
@@ -182,7 +182,7 @@ thread{WHITE}+{DIG} {
abs { return ABS; }
and { return _AND_; }
else { return ELSE; }
-in { return IN; }
+in { return TOK_IN; }
mod { return MOD; }
new { return NEW; }
not { return NOT; }
@@ -319,7 +319,7 @@ canonicalizeNumeral (char *s1, const cha
/* Interprets the prefix of NUM that consists of digits of the given BASE
as an integer of that BASE, with the string EXP as an exponent.
- Puts value in yylval, and returns INT, if the string is valid. Causes
+ Puts value in yylval, and returns TOK_INT, if the string is valid. Causes
an error if the number is improperly formated. BASE, if NULL, defaults
to "10", and EXP to "1". The EXP does not contain a leading 'e' or 'E'.
*/
@@ -383,13 +383,13 @@ processInt (struct parser_state *par_sta
- (LONGEST_SIGN>>1) - (LONGEST_SIGN>>1);
else
yylval.typed_val.val = (LONGEST) result;
- return INT;
+ return TOK_INT;
}
else
yylval.typed_val.type = type_long_long (par_state);
yylval.typed_val.val = (LONGEST) result;
- return INT;
+ return TOK_INT;
}
static int
@@ -405,7 +405,7 @@ processReal (struct parser_state *par_st
/ TARGET_CHAR_BIT)
yylval.typed_val_float.type = type_long_double (par_state);
- return FLOAT;
+ return TOK_FLOAT;
}
--- old/orig/gdb/c-exp.y 2014-12-14 02:48:38.000000000 +0100
+++ ./gdb/c-exp.y 2014-12-22 20:24:33.564713894 +0100
@@ -195,8 +195,8 @@ static void c_print_token (FILE *file, i
%type <type_stack> ptr_operator_ts abs_decl direct_abs_decl
-%token <typed_val_int> INT
-%token <typed_val_float> FLOAT
+%token <typed_val_int> TOK_INT
+%token <typed_val_float> TFLOAT
%token <typed_val_decfloat> DECFLOAT
/* Both NAME and TYPENAME tokens represent symbols in the input,
@@ -210,7 +210,7 @@ static void c_print_token (FILE *file, i
%token <tsval> STRING
%token <sval> NSSTRING /* ObjC Foundation "NSString" literal */
%token SELECTOR /* ObjC "@selector" pseudo-operator */
-%token <tsval> CHAR
+%token <tsval> TOK_CHAR
%token <ssym> NAME /* BLOCKNAME defined below to give it higher precedence. */
%token <ssym> UNKNOWN_CPP_NAME
%token <voidval> COMPLETE
@@ -236,8 +236,8 @@ static void c_print_token (FILE *file, i
%token OPERATOR
%token STRUCT CLASS UNION ENUM SIZEOF UNSIGNED COLONCOLON
%token TEMPLATE
-%token ERROR
-%token NEW DELETE
+%token TOK_ERROR
+%token NEW TOK_DELETE
%type <sval> operator
%token REINTERPRET_CAST DYNAMIC_CAST STATIC_CAST CONST_CAST
%token ENTRY
@@ -247,7 +247,7 @@ static void c_print_token (FILE *file, i
/* Special type cases, put in to allow the parser to distinguish different
legal basetypes. */
-%token SIGNED_KEYWORD LONG SHORT INT_KEYWORD CONST_KEYWORD VOLATILE_KEYWORD DOUBLE_KEYWORD
+%token SIGNED_KEYWORD TOK_LONG TOK_SHORT INT_KEYWORD CONST_KEYWORD VOLATILE_KEYWORD DOUBLE_KEYWORD
%token <sval> VARIABLE
@@ -727,14 +727,14 @@ exp : exp ASSIGN_MODIFY exp
BINOP_ASSIGN_MODIFY); }
;
-exp : INT
+exp : TOK_INT
{ write_exp_elt_opcode (pstate, OP_LONG);
write_exp_elt_type (pstate, $1.type);
write_exp_elt_longcst (pstate, (LONGEST) ($1.val));
write_exp_elt_opcode (pstate, OP_LONG); }
;
-exp : CHAR
+exp : TOK_CHAR
{
struct stoken_vector vec;
vec.len = 1;
@@ -756,7 +756,7 @@ exp : NAME_OR_INT
;
-exp : FLOAT
+exp : TFLOAT
{ write_exp_elt_opcode (pstate, OP_DOUBLE);
write_exp_elt_type (pstate, $1.type);
write_exp_elt_dblcst (pstate, $1.dval);
@@ -1192,9 +1192,9 @@ array_mod: '[' ']'
{ $$ = -1; }
| OBJC_LBRAC ']'
{ $$ = -1; }
- | '[' INT ']'
+ | '[' TOK_INT ']'
{ $$ = $2.val; }
- | OBJC_LBRAC INT ']'
+ | OBJC_LBRAC TOK_INT ']'
{ $$ = $2.val; }
;
@@ -1222,103 +1222,103 @@ typebase /* Implements (approximately):
{ $$ = lookup_signed_typename (parse_language (pstate),
parse_gdbarch (pstate),
"int"); }
- | LONG
+ | TOK_LONG
{ $$ = lookup_signed_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long"); }
- | SHORT
+ | TOK_SHORT
{ $$ = lookup_signed_typename (parse_language (pstate),
parse_gdbarch (pstate),
"short"); }
- | LONG INT_KEYWORD
+ | TOK_LONG INT_KEYWORD
{ $$ = lookup_signed_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long"); }
- | LONG SIGNED_KEYWORD INT_KEYWORD
+ | TOK_LONG SIGNED_KEYWORD INT_KEYWORD
{ $$ = lookup_signed_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long"); }
- | LONG SIGNED_KEYWORD
+ | TOK_LONG SIGNED_KEYWORD
{ $$ = lookup_signed_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long"); }
- | SIGNED_KEYWORD LONG INT_KEYWORD
+ | SIGNED_KEYWORD TOK_LONG INT_KEYWORD
{ $$ = lookup_signed_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long"); }
- | UNSIGNED LONG INT_KEYWORD
+ | UNSIGNED TOK_LONG INT_KEYWORD
{ $$ = lookup_unsigned_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long"); }
- | LONG UNSIGNED INT_KEYWORD
+ | TOK_LONG UNSIGNED INT_KEYWORD
{ $$ = lookup_unsigned_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long"); }
- | LONG UNSIGNED
+ | TOK_LONG UNSIGNED
{ $$ = lookup_unsigned_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long"); }
- | LONG LONG
+ | TOK_LONG TOK_LONG
{ $$ = lookup_signed_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long long"); }
- | LONG LONG INT_KEYWORD
+ | TOK_LONG TOK_LONG INT_KEYWORD
{ $$ = lookup_signed_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long long"); }
- | LONG LONG SIGNED_KEYWORD INT_KEYWORD
+ | TOK_LONG TOK_LONG SIGNED_KEYWORD INT_KEYWORD
{ $$ = lookup_signed_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long long"); }
- | LONG LONG SIGNED_KEYWORD
+ | TOK_LONG TOK_LONG SIGNED_KEYWORD
{ $$ = lookup_signed_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long long"); }
- | SIGNED_KEYWORD LONG LONG
+ | SIGNED_KEYWORD TOK_LONG TOK_LONG
{ $$ = lookup_signed_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long long"); }
- | SIGNED_KEYWORD LONG LONG INT_KEYWORD
+ | SIGNED_KEYWORD TOK_LONG TOK_LONG INT_KEYWORD
{ $$ = lookup_signed_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long long"); }
- | UNSIGNED LONG LONG
+ | UNSIGNED TOK_LONG TOK_LONG
{ $$ = lookup_unsigned_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long long"); }
- | UNSIGNED LONG LONG INT_KEYWORD
+ | UNSIGNED TOK_LONG TOK_LONG INT_KEYWORD
{ $$ = lookup_unsigned_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long long"); }
- | LONG LONG UNSIGNED
+ | TOK_LONG TOK_LONG UNSIGNED
{ $$ = lookup_unsigned_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long long"); }
- | LONG LONG UNSIGNED INT_KEYWORD
+ | TOK_LONG TOK_LONG UNSIGNED INT_KEYWORD
{ $$ = lookup_unsigned_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long long"); }
- | SHORT INT_KEYWORD
+ | TOK_SHORT INT_KEYWORD
{ $$ = lookup_signed_typename (parse_language (pstate),
parse_gdbarch (pstate),
"short"); }
- | SHORT SIGNED_KEYWORD INT_KEYWORD
+ | TOK_SHORT SIGNED_KEYWORD INT_KEYWORD
{ $$ = lookup_signed_typename (parse_language (pstate),
parse_gdbarch (pstate),
"short"); }
- | SHORT SIGNED_KEYWORD
+ | TOK_SHORT SIGNED_KEYWORD
{ $$ = lookup_signed_typename (parse_language (pstate),
parse_gdbarch (pstate),
"short"); }
- | UNSIGNED SHORT INT_KEYWORD
+ | UNSIGNED TOK_SHORT INT_KEYWORD
{ $$ = lookup_unsigned_typename (parse_language (pstate),
parse_gdbarch (pstate),
"short"); }
- | SHORT UNSIGNED
+ | TOK_SHORT UNSIGNED
{ $$ = lookup_unsigned_typename (parse_language (pstate),
parse_gdbarch (pstate),
"short"); }
- | SHORT UNSIGNED INT_KEYWORD
+ | TOK_SHORT UNSIGNED INT_KEYWORD
{ $$ = lookup_unsigned_typename (parse_language (pstate),
parse_gdbarch (pstate),
"short"); }
@@ -1328,7 +1328,7 @@ typebase /* Implements (approximately):
"double",
(struct block *) NULL,
0); }
- | LONG DOUBLE_KEYWORD
+ | TOK_LONG DOUBLE_KEYWORD
{ $$ = lookup_typename (parse_language (pstate),
parse_gdbarch (pstate),
"long double",
@@ -1428,7 +1428,7 @@ typename: TYPENAME
parse_gdbarch (pstate),
"int");
}
- | LONG
+ | TOK_LONG
{
$$.stoken.ptr = "long";
$$.stoken.length = 4;
@@ -1436,7 +1436,7 @@ typename: TYPENAME
parse_gdbarch (pstate),
"long");
}
- | SHORT
+ | TOK_SHORT
{
$$.stoken.ptr = "short";
$$.stoken.length = 5;
@@ -1503,15 +1503,15 @@ const_or_volatile_noopt: const_and_vol
operator: OPERATOR NEW
{ $$ = operator_stoken (" new"); }
- | OPERATOR DELETE
+ | OPERATOR TOK_DELETE
{ $$ = operator_stoken (" delete"); }
| OPERATOR NEW '[' ']'
{ $$ = operator_stoken (" new[]"); }
- | OPERATOR DELETE '[' ']'
+ | OPERATOR TOK_DELETE '[' ']'
{ $$ = operator_stoken (" delete[]"); }
| OPERATOR NEW OBJC_LBRAC ']'
{ $$ = operator_stoken (" new[]"); }
- | OPERATOR DELETE OBJC_LBRAC ']'
+ | OPERATOR TOK_DELETE OBJC_LBRAC ']'
{ $$ = operator_stoken (" delete[]"); }
| OPERATOR '+'
{ $$ = operator_stoken ("+"); }
@@ -1819,8 +1819,8 @@ parse_number (struct parser_state *par_s
if (! parse_c_float (parse_gdbarch (par_state), p, len,
&putithere->typed_val_float.dval,
&putithere->typed_val_float.type))
- return ERROR;
- return FLOAT;
+ return TOK_ERROR;
+ return TFLOAT;
}
/* Handle base-switching prefixes 0x, 0t, 0d, 0 */
@@ -1874,7 +1874,7 @@ parse_number (struct parser_state *par_s
if (c >= '0' && c <= '9')
{
if (found_suffix)
- return ERROR;
+ return TOK_ERROR;
n += i = c - '0';
}
else
@@ -1882,7 +1882,7 @@ parse_number (struct parser_state *par_s
if (base > 10 && c >= 'a' && c <= 'f')
{
if (found_suffix)
- return ERROR;
+ return TOK_ERROR;
n += i = c - 'a' + 10;
}
else if (c == 'l')
@@ -1896,10 +1896,10 @@ parse_number (struct parser_state *par_s
found_suffix = 1;
}
else
- return ERROR; /* Char not a digit */
+ return TOK_ERROR; /* Char not a digit */
}
if (i >= base)
- return ERROR; /* Invalid digit in this base */
+ return TOK_ERROR; /* Invalid digit in this base */
/* Portably test for overflow (only works for nonzero values, so make
a second check for zero). FIXME: Can't we just make n and prevn
@@ -1982,7 +1982,7 @@ parse_number (struct parser_state *par_s
putithere->typed_val_int.type = signed_type;
}
- return INT;
+ return TOK_INT;
}
/* Temporary obstack used for holding strings. */
@@ -2157,7 +2157,7 @@ c_parse_escape (const char **ptr, struct
character may be wide or unicode. *OUTPTR is set to just after the
end of the literal in the input string. The resulting token is
stored in VALUE. This returns a token value, either STRING or
- CHAR, depending on what was parsed. *HOST_CHARS is set to the
+ TOK_CHAR, depending on what was parsed. *HOST_CHARS is set to the
number of host characters in the literal. */
static int
parse_string_or_char (const char *tokptr, const char **outptr,
@@ -2252,7 +2252,7 @@ parse_string_or_char (const char *tokptr
*outptr = tokptr;
- return quote == '"' ? (is_objc ? NSSTRING : STRING) : CHAR;
+ return quote == '"' ? (is_objc ? NSSTRING : STRING) : TOK_CHAR;
}
/* This is used to associate some attributes with a token. */
@@ -2326,14 +2326,14 @@ static const struct token ident_tokens[]
{"false", FALSEKEYWORD, OP_NULL, FLAG_CXX},
{"class", CLASS, OP_NULL, FLAG_CXX},
{"union", UNION, OP_NULL, 0},
- {"short", SHORT, OP_NULL, 0},
+ {"short", TOK_SHORT, OP_NULL, 0},
{"const", CONST_KEYWORD, OP_NULL, 0},
{"enum", ENUM, OP_NULL, 0},
- {"long", LONG, OP_NULL, 0},
+ {"long", TOK_LONG, OP_NULL, 0},
{"true", TRUEKEYWORD, OP_NULL, FLAG_CXX},
{"int", INT_KEYWORD, OP_NULL, 0},
{"new", NEW, OP_NULL, FLAG_CXX},
- {"delete", DELETE, OP_NULL, FLAG_CXX},
+ {"delete", TOK_DELETE, OP_NULL, FLAG_CXX},
{"operator", OPERATOR, OP_NULL, FLAG_CXX},
{"and", ANDAND, BINOP_END, FLAG_CXX},
@@ -2637,7 +2637,7 @@ lex_one_token (struct parser_state *par_
}
toktype = parse_number (par_state, tokstart, p - tokstart,
got_dot|got_e, &yylval);
- if (toktype == ERROR)
+ if (toktype == TOK_ERROR)
{
char *err_copy = (char *) alloca (p - tokstart + 1);
@@ -2713,7 +2713,7 @@ lex_one_token (struct parser_state *par_
int host_len;
int result = parse_string_or_char (tokstart, &lexptr, &yylval.tsval,
&host_len);
- if (result == CHAR)
+ if (result == TOK_CHAR)
{
if (host_len == 0)
error (_("Empty character constant."));
@@ -2972,7 +2972,7 @@ classify_name (struct parser_state *par_
YYSTYPE newlval; /* Its value is ignored. */
int hextype = parse_number (par_state, copy, yylval.sval.length,
0, &newlval);
- if (hextype == INT)
+ if (hextype == TOK_INT)
{
yylval.ssym.sym = sym;
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
@@ -3009,7 +3009,7 @@ classify_inner_name (struct parser_state
type = check_typedef (context);
if (!type_aggregate_p (type))
- return ERROR;
+ return TOK_ERROR;
copy = copy_name (yylval.ssym.stoken);
yylval.ssym.sym = cp_lookup_nested_symbol (type, copy, block);
@@ -3027,7 +3027,7 @@ classify_inner_name (struct parser_state
return TYPENAME;
}
- return ERROR;
+ return TOK_ERROR;
}
switch (SYMBOL_CLASS (yylval.ssym.sym))
@@ -3046,7 +3046,7 @@ classify_inner_name (struct parser_state
return TYPENAME;
}
}
- return ERROR;
+ return TOK_ERROR;
case LOC_TYPEDEF:
yylval.tsym.type = SYMBOL_TYPE (yylval.ssym.sym);;
@@ -3273,13 +3273,13 @@ c_print_token (FILE *file, int type, YYS
{
switch (type)
{
- case INT:
+ case TOK_INT:
fprintf (file, "typed_val_int<%s, %s>",
TYPE_SAFE_NAME (value.typed_val_int.type),
pulongest (value.typed_val_int.val));
break;
- case CHAR:
+ case TOK_CHAR:
case STRING:
{
char *copy = alloca (value.tsval.length + 1);
--- old/orig/gdb/coff-pe-read.c 2014-12-14 02:48:38.000000000 +0100
+++ ./gdb/coff-pe-read.c 2014-12-22 20:41:57.160970473 +0100
@@ -57,9 +57,11 @@ struct read_pe_section_data
char *section_name; /* Recorded section name. */
};
+#ifndef _WIN64
#define IMAGE_SCN_CNT_CODE 0x20
#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x40
#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x80
+#endif
#define PE_SECTION_INDEX_TEXT 0
#define PE_SECTION_INDEX_DATA 1
#define PE_SECTION_INDEX_BSS 2
--- old/orig/gdb/coffread.c 2014-12-14 02:48:38.000000000 +0100
+++ ./gdb/coffread.c 2014-12-22 20:41:36.096965101 +0100
@@ -106,6 +106,12 @@ static unsigned local_n_btshft;
static unsigned local_n_tmask;
static unsigned local_n_tshift;
+#ifdef _WIN64
+# undef N_BTMASK
+# undef N_BTSHFT
+# undef N_TMASK
+# undef N_TSHIFT
+#endif
#define N_BTMASK local_n_btmask
#define N_BTSHFT local_n_btshft
#define N_TMASK local_n_tmask
--- old/orig/gdb/cp-name-parser.y 2014-12-14 02:48:38.000000000 +0100
+++ ./gdb/cp-name-parser.y 2014-12-22 20:26:04.620733318 +0100
@@ -302,22 +302,22 @@ make_name (const char *name, int len)
%type <lval> int_part int_seq
-%token <comp> INT
-%token <comp> FLOAT
+%token <comp> TOK_INT
+%token <comp> TOK_FLOAT
%token <comp> NAME
%type <comp> name
%token STRUCT CLASS UNION ENUM SIZEOF UNSIGNED COLONCOLON
%token TEMPLATE
-%token ERROR
-%token NEW DELETE OPERATOR
+%token TOK_ERROR
+%token NEW TOK_DELETE OPERATOR
%token STATIC_CAST REINTERPRET_CAST DYNAMIC_CAST
/* Special type cases, put in to allow the parser to distinguish different
legal basetypes. */
-%token SIGNED_KEYWORD LONG SHORT INT_KEYWORD CONST_KEYWORD VOLATILE_KEYWORD DOUBLE_KEYWORD BOOL
-%token ELLIPSIS RESTRICT VOID FLOAT_KEYWORD CHAR WCHAR_T
+%token SIGNED_KEYWORD TOK_LONG TOK_SHORT INT_KEYWORD CONST_KEYWORD VOLATILE_KEYWORD DOUBLE_KEYWORD TOK_BOOL
+%token ELLIPSIS RESTRICT TOK_VOID FLOAT_KEYWORD TOK_CHAR WCHAR_T
%token <opname> ASSIGN_MODIFY
@@ -335,16 +335,16 @@ make_name (const char *name, int len)
associate greedily. */
%nonassoc NAME
-/* Give NEW and DELETE lower precedence than ']', because we can not
+/* Give NEW and TOK_DELETE lower precedence than ']', because we can not
have an array of type operator new. This causes NEW '[' to be
parsed as operator new[]. */
-%nonassoc NEW DELETE
+%nonassoc NEW TOK_DELETE
-/* Give VOID higher precedence than NAME. Then we can use %prec NAME
- to prefer (VOID) to (function_args). */
-%nonassoc VOID
+/* Give TOK_VOID higher precedence than NAME. Then we can use %prec NAME
+ to prefer (TOK_VOID) to (function_args). */
+%nonassoc TOK_VOID
-/* Give VOID lower precedence than ')' for similar reasons. */
+/* Give TOK_VOID lower precedence than ')' for similar reasons. */
%nonassoc ')'
%left ','
@@ -445,7 +445,7 @@ operator : OPERATOR NEW
It would abort on unrecognized string otherwise. */
$$ = make_operator ("new", 3);
}
- | OPERATOR DELETE
+ | OPERATOR TOK_DELETE
{
/* Match the whitespacing of cplus_demangle_operators.
It would abort on unrecognized string otherwise. */
@@ -457,7 +457,7 @@ operator : OPERATOR NEW
It would abort on unrecognized string otherwise. */
$$ = make_operator ("new[]", 3);
}
- | OPERATOR DELETE '[' ']'
+ | OPERATOR TOK_DELETE '[' ']'
{
/* Match the whitespacing of cplus_demangle_operators.
It would abort on unrecognized string otherwise. */
@@ -692,7 +692,7 @@ function_arglist: '(' function_args ')'
{ $$.comp = fill_comp (DEMANGLE_COMPONENT_FUNCTION_TYPE, NULL, $2.comp);
$$.last = &d_left ($$.comp);
$$.comp = d_qualify ($$.comp, $4, 1); }
- | '(' VOID ')' qualifiers_opt
+ | '(' TOK_VOID ')' qualifiers_opt
{ $$.comp = fill_comp (DEMANGLE_COMPONENT_FUNCTION_TYPE, NULL, NULL);
$$.last = &d_left ($$.comp);
$$.comp = d_qualify ($$.comp, $4, 1); }
@@ -730,11 +730,11 @@ int_part : INT_KEYWORD
{ $$ = INT_SIGNED; }
| UNSIGNED
{ $$ = INT_UNSIGNED; }
- | CHAR
+ | TOK_CHAR
{ $$ = INT_CHAR; }
- | LONG
+ | TOK_LONG
{ $$ = INT_LONG; }
- | SHORT
+ | TOK_SHORT
{ $$ = INT_SHORT; }
;
@@ -749,13 +749,13 @@ builtin_type : int_seq
{ $$ = make_builtin_type ("float"); }
| DOUBLE_KEYWORD
{ $$ = make_builtin_type ("double"); }
- | LONG DOUBLE_KEYWORD
+ | TOK_LONG DOUBLE_KEYWORD
{ $$ = make_builtin_type ("long double"); }
- | BOOL
+ | TOK_BOOL
{ $$ = make_builtin_type ("bool"); }
| WCHAR_T
{ $$ = make_builtin_type ("wchar_t"); }
- | VOID
+ | TOK_VOID
{ $$ = make_builtin_type ("void"); }
;
@@ -791,7 +791,7 @@ array_indicator : '[' ']'
{ $$ = make_empty (DEMANGLE_COMPONENT_ARRAY_TYPE);
d_left ($$) = NULL;
}
- | '[' INT ']'
+ | '[' TOK_INT ']'
{ $$ = make_empty (DEMANGLE_COMPONENT_ARRAY_TYPE);
d_left ($$) = $2;
}
@@ -1185,11 +1185,11 @@ exp : exp '?' exp ':' exp %prec '?'
}
;
-exp : INT
+exp : TOK_INT
;
/* Not generally allowed. */
-exp : FLOAT
+exp : TOK_FLOAT
;
exp : SIZEOF '(' type ')' %prec UNARY
@@ -1396,12 +1396,12 @@ parse_number (const char *p, int len, in
else if (ISDIGIT (c) || c == '.')
type = make_builtin_type ("double");
else
- return ERROR;
+ return TOK_ERROR;
name = make_name (p, len);
yylval.comp = fill_comp (literal_type, type, name);
- return FLOAT;
+ return TOK_FLOAT;
}
/* This treats 0x1 and 1 as different literals. We also do not
@@ -1450,7 +1450,7 @@ parse_number (const char *p, int len, in
name = make_name (p, len);
yylval.comp = fill_comp (literal_type, type, name);
- return INT;
+ return TOK_INT;
}
static char backslashable[] = "abefnrtv";
@@ -1608,14 +1608,14 @@ yylex (void)
else if (c == '\'')
{
yyerror (_("empty character constant"));
- return ERROR;
+ return TOK_ERROR;
}
c = *lexptr++;
if (c != '\'')
{
yyerror (_("invalid character constant"));
- return ERROR;
+ return TOK_ERROR;
}
/* FIXME: We should refer to a canonical form of the character,
@@ -1626,7 +1626,7 @@ yylex (void)
make_builtin_type ("char"),
make_name (tokstart, lexptr - tokstart));
- return INT;
+ return TOK_INT;
case '(':
if (strncmp (tokstart, "(anonymous namespace)", 21) == 0)
@@ -1732,14 +1732,14 @@ yylex (void)
break;
}
toktype = parse_number (tokstart, p - tokstart, got_dot|got_e);
- if (toktype == ERROR)
+ if (toktype == TOK_ERROR)
{
char *err_copy = (char *) alloca (p - tokstart + 1);
memcpy (err_copy, tokstart, p - tokstart);
err_copy[p - tokstart] = 0;
yyerror (_("invalid number"));
- return ERROR;
+ return TOK_ERROR;
}
lexptr = p;
return toktype;
@@ -1815,14 +1815,14 @@ yylex (void)
case '"':
/* These can't occur in C++ names. */
yyerror (_("unexpected string literal"));
- return ERROR;
+ return TOK_ERROR;
}
if (!(c == '_' || c == '$' || ISALPHA (c)))
{
/* We must have come across a bad character (e.g. ';'). */
yyerror (_("invalid character"));
- return ERROR;
+ return TOK_ERROR;
}
/* It's a name. See how long it is. */
@@ -1905,7 +1905,7 @@ yylex (void)
HANDLE_SPECIAL ("vtable for ", DEMANGLE_COMPONENT_VTABLE);
if (strncmp (tokstart, "delete", 6) == 0)
- return DELETE;
+ return TOK_DELETE;
if (strncmp (tokstart, "struct", 6) == 0)
return STRUCT;
if (strncmp (tokstart, "signed", 6) == 0)
@@ -1926,21 +1926,21 @@ yylex (void)
if (strncmp (tokstart, "float", 5) == 0)
return FLOAT_KEYWORD;
if (strncmp (tokstart, "short", 5) == 0)
- return SHORT;
+ return TOK_SHORT;
if (strncmp (tokstart, "const", 5) == 0)
return CONST_KEYWORD;
break;
case 4:
if (strncmp (tokstart, "void", 4) == 0)
- return VOID;
+ return TOK_VOID;
if (strncmp (tokstart, "bool", 4) == 0)
- return BOOL;
+ return TOK_BOOL;
if (strncmp (tokstart, "char", 4) == 0)
- return CHAR;
+ return TOK_CHAR;
if (strncmp (tokstart, "enum", 4) == 0)
return ENUM;
if (strncmp (tokstart, "long", 4) == 0)
- return LONG;
+ return TOK_LONG;
if (strncmp (tokstart, "true", 4) == 0)
return TRUEKEYWORD;
break;
--- old/orig/gdb/d-exp.y 2014-12-14 02:48:38.000000000 +0100
+++ ./gdb/d-exp.y 2014-12-22 20:32:43.627829285 +0100
@@ -184,7 +184,7 @@ static void push_expression_name (struct
%type <ival> ArrayLiteral
%token ENTRY
-%token ERROR
+%token TOK_ERROR
/* Keywords that have a constant value. */
%token TRUE_KEYWORD FALSE_KEYWORD NULL_KEYWORD
@@ -688,7 +688,7 @@ parse_number (struct parser_state *ps, c
len = strlen (s);
if (! parse_float (s, len, &putithere->typed_val_float.dval, &suffix))
- return ERROR;
+ return TOK_ERROR;
suffix_len = s + len - suffix;
@@ -716,7 +716,7 @@ parse_number (struct parser_state *ps, c
= parse_d_type (ps)->builtin_idouble;
}
else
- return ERROR;
+ return TOK_ERROR;
}
else if (suffix_len == 2)
{
@@ -732,10 +732,10 @@ parse_number (struct parser_state *ps, c
= parse_d_type (ps)->builtin_ireal;
}
else
- return ERROR;
+ return TOK_ERROR;
}
else
- return ERROR;
+ return TOK_ERROR;
return FLOAT_LITERAL;
}
@@ -781,7 +781,7 @@ parse_number (struct parser_state *ps, c
if (c >= '0' && c <= '9')
{
if (found_suffix)
- return ERROR;
+ return TOK_ERROR;
n += i = c - '0';
}
else
@@ -789,7 +789,7 @@ parse_number (struct parser_state *ps, c
if (base > 10 && c >= 'a' && c <= 'f')
{
if (found_suffix)
- return ERROR;
+ return TOK_ERROR;
n += i = c - 'a' + 10;
}
else if (c == 'l' && long_p == 0)
@@ -803,10 +803,10 @@ parse_number (struct parser_state *ps, c
found_suffix = 1;
}
else
- return ERROR; /* Char not a digit */
+ return TOK_ERROR; /* Char not a digit */
}
if (i >= base)
- return ERROR; /* Invalid digit in this base. */
+ return TOK_ERROR; /* Invalid digit in this base. */
/* Portably test for integer overflow. */
if (c != 'l' && c != 'u')
{
@@ -1448,7 +1448,7 @@ yylex (void)
toktype = parse_number (pstate, tokstart, p - tokstart,
got_dot|got_e, &yylval);
- if (toktype == ERROR)
+ if (toktype == TOK_ERROR)
{
char *err_copy = (char *) alloca (p - tokstart + 1);
--- old/orig/gdb/defs.h 2014-12-14 02:48:38.000000000 +0100
+++ ./gdb/defs.h 2014-12-22 20:39:33.882933928 +0100
@@ -27,6 +27,10 @@
#include "common-defs.h"
+// gnulib sys/time.h will include MinGW headers which provide
+// alternative binary incompatible definition of struct timeval.
+#include <sys/time.h>
+
#include <sys/types.h>
#include <limits.h>
#include <stdint.h>
--- gdb-7.8.50.20141222/gdb/f-exp.y-orig 2014-12-22 02:48:39.000000000 +0100
+++ gdb-7.8.50.20141222/gdb/f-exp.y 2014-12-22 22:03:01.005129083 +0100
@@ -175,8 +175,8 @@ static int parse_number (struct parser_s
%type <voidval> func_mod direct_abs_decl abs_decl
%type <tval> ptype
-%token <typed_val> INT
-%token <dval> FLOAT
+%token <typed_val> TOK_INT
+%token <dval> TOK_FLOAT
/* Both NAME and TYPENAME tokens represent symbols in the input,
and both convey their data as strings.
@@ -201,7 +201,7 @@ static int parse_number (struct parser_s
%token <ssym> NAME_OR_INT
%token SIZEOF
-%token ERROR
+%token TOK_ERROR
/* Special type cases, put in to allow the parser to distinguish different
legal basetypes. */
@@ -449,7 +449,7 @@ exp : exp ASSIGN_MODIFY exp
write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); }
;
-exp : INT
+exp : TOK_INT
{ write_exp_elt_opcode (pstate, OP_LONG);
write_exp_elt_type (pstate, $1.type);
write_exp_elt_longcst (pstate, (LONGEST) ($1.val));
@@ -467,7 +467,7 @@ exp : NAME_OR_INT
write_exp_elt_opcode (pstate, OP_LONG); }
;
-exp : FLOAT
+exp : TOK_FLOAT
{ write_exp_elt_opcode (pstate, OP_DOUBLE);
write_exp_elt_type (pstate,
parse_f_type (pstate)
@@ -713,7 +713,7 @@ parse_number (struct parser_state *par_s
*tmp2 = 'e';
putithere->dval = atof (tmp);
free (tmp);
- return FLOAT;
+ return TOK_FLOAT;
}
/* Handle base-switching prefixes 0x, 0t, 0d, 0 */
@@ -764,9 +764,9 @@ parse_number (struct parser_state *par_s
else if (c >= 'a' && c <= 'f')
i = c - 'a' + 10;
else
- return ERROR; /* Char not a digit */
+ return TOK_ERROR; /* Char not a digit */
if (i >= base)
- return ERROR; /* Invalid digit in this base */
+ return TOK_ERROR; /* Invalid digit in this base */
n *= base;
n += i;
}
@@ -825,7 +825,7 @@ parse_number (struct parser_state *par_s
else
putithere->typed_val.type = signed_type;
- return INT;
+ return TOK_INT;
}
struct token
@@ -1117,7 +1117,7 @@ yylex (void)
toktype = parse_number (pstate, tokstart, p - tokstart,
got_dot|got_e|got_d,
&yylval);
- if (toktype == ERROR)
+ if (toktype == TOK_ERROR)
{
char *err_copy = (char *) alloca (p - tokstart + 1);
@@ -1244,7 +1244,7 @@ yylex (void)
{
YYSTYPE newlval; /* Its value is ignored. */
hextype = parse_number (pstate, tokstart, namelen, 0, &newlval);
- if (hextype == INT)
+ if (hextype == TOK_INT)
{
yylval.ssym.sym = sym;
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
--- old/orig/gdb/gdbserver/remote-utils.c 2014-12-14 02:48:38.000000000 +0100
+++ ./gdb/gdbserver/remote-utils.c 2014-12-22 20:45:36.881026517 +0100
@@ -727,7 +727,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. */
--- old/orig/gdb/go-exp.y 2014-12-14 02:48:38.000000000 +0100
+++ ./gdb/go-exp.y 2014-12-22 20:33:34.698842311 +0100
@@ -172,8 +172,8 @@ static int parse_go_float (struct gdbarc
%type <lval> rcurly
%type <tval> type
-%token <typed_val_int> INT
-%token <typed_val_float> FLOAT
+%token <typed_val_int> TOK_INT
+%token <typed_val_float> TOK_FLOAT
/* Both NAME and TYPENAME tokens represent symbols in the input,
and both convey their data as strings.
@@ -185,7 +185,7 @@ static int parse_go_float (struct gdbarc
%token <tsval> RAW_STRING
%token <tsval> STRING
-%token <tsval> CHAR
+%token <tsval> TOK_CHAR
%token <ssym> NAME
%token <tsym> TYPENAME /* Not TYPE_NAME cus already taken. */
%token <voidval> COMPLETE
@@ -208,7 +208,7 @@ static int parse_go_float (struct gdbarc
%token CONST_KEYWORD
%token DOTDOTDOT
%token ENTRY
-%token ERROR
+%token TOK_ERROR
/* Special type cases. */
%token BYTE_KEYWORD /* An alias of uint8. */
@@ -455,14 +455,14 @@ exp : exp ASSIGN_MODIFY exp
write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); }
;
-exp : INT
+exp : TOK_INT
{ write_exp_elt_opcode (pstate, OP_LONG);
write_exp_elt_type (pstate, $1.type);
write_exp_elt_longcst (pstate, (LONGEST)($1.val));
write_exp_elt_opcode (pstate, OP_LONG); }
;
-exp : CHAR
+exp : TOK_CHAR
{
struct stoken_vector vec;
vec.len = 1;
@@ -484,7 +484,7 @@ exp : NAME_OR_INT
;
-exp : FLOAT
+exp : TOK_FLOAT
{ write_exp_elt_opcode (pstate, OP_DOUBLE);
write_exp_elt_type (pstate, $1.type);
write_exp_elt_dblcst (pstate, $1.dval);
@@ -743,8 +743,8 @@ parse_number (struct parser_state *par_s
if (! parse_go_float (parse_gdbarch (par_state), p, len,
&putithere->typed_val_float.dval,
&putithere->typed_val_float.type))
- return ERROR;
- return FLOAT;
+ return TOK_ERROR;
+ return TOK_FLOAT;
}
/* Handle base-switching prefixes 0x, 0t, 0d, 0. */
@@ -798,7 +798,7 @@ parse_number (struct parser_state *par_s
if (c >= '0' && c <= '9')
{
if (found_suffix)
- return ERROR;
+ return TOK_ERROR;
n += i = c - '0';
}
else
@@ -806,7 +806,7 @@ parse_number (struct parser_state *par_s
if (base > 10 && c >= 'a' && c <= 'f')
{
if (found_suffix)
- return ERROR;
+ return TOK_ERROR;
n += i = c - 'a' + 10;
}
else if (c == 'l')
@@ -820,10 +820,10 @@ parse_number (struct parser_state *par_s
found_suffix = 1;
}
else
- return ERROR; /* Char not a digit */
+ return TOK_ERROR; /* Char not a digit */
}
if (i >= base)
- return ERROR; /* Invalid digit in this base. */
+ return TOK_ERROR; /* Invalid digit in this base. */
/* Portably test for overflow (only works for nonzero values, so make
a second check for zero). FIXME: Can't we just make n and prevn
@@ -906,7 +906,7 @@ parse_number (struct parser_state *par_s
putithere->typed_val_int.type = signed_type;
}
- return INT;
+ return TOK_INT;
}
/* Temporary obstack used for holding strings. */
@@ -917,7 +917,7 @@ static int tempbuf_init;
character may be wide or unicode. *OUTPTR is set to just after the
end of the literal in the input string. The resulting token is
stored in VALUE. This returns a token value, either STRING or
- CHAR, depending on what was parsed. *HOST_CHARS is set to the
+ TOK_CHAR, depending on what was parsed. *HOST_CHARS is set to the
number of host characters in the literal. */
static int
@@ -983,7 +983,7 @@ parse_string_or_char (const char *tokptr
*outptr = tokptr;
- return quote == '\'' ? CHAR : STRING;
+ return quote == '\'' ? TOK_CHAR : STRING;
}
struct token
@@ -1190,7 +1190,7 @@ lex_one_token (struct parser_state *par_
}
toktype = parse_number (par_state, tokstart, p - tokstart,
got_dot|got_e, &yylval);
- if (toktype == ERROR)
+ if (toktype == TOK_ERROR)
{
char *err_copy = (char *) alloca (p - tokstart + 1);
@@ -1245,7 +1245,7 @@ lex_one_token (struct parser_state *par_
int host_len;
int result = parse_string_or_char (tokstart, &lexptr, &yylval.tsval,
&host_len);
- if (result == CHAR)
+ if (result == TOK_CHAR)
{
if (host_len == 0)
error (_("Empty character constant."));
@@ -1515,7 +1515,7 @@ classify_name (struct parser_state *par_
YYSTYPE newlval; /* Its value is ignored. */
int hextype = parse_number (par_state, copy, yylval.sval.length,
0, &newlval);
- if (hextype == INT)
+ if (hextype == TOK_INT)
{
yylval.ssym.sym = NULL;
yylval.ssym.is_a_field_of_this = 0;
--- old/orig/gdb/jv-exp.y 2014-12-14 02:48:38.000000000 +0100
+++ ./gdb/jv-exp.y 2014-12-22 20:32:26.083824810 +0100
@@ -183,11 +183,11 @@ static int parse_number (struct parser_s
%token <sval> NAME_OR_INT
-%token ERROR
+%token TOK_ERROR
/* Special type cases, put in to allow the parser to distinguish different
legal basetypes. */
-%token LONG SHORT BYTE INT CHAR BOOLEAN DOUBLE FLOAT
+%token TOK_LONG TOK_SHORT TOK_BYTE TOK_INT TOK_CHAR TOK_BOOLEAN TOK_DOUBLE TOK_FLOAT
%token VARIABLE
@@ -278,7 +278,7 @@ Type:
PrimitiveType:
NumericType
-| BOOLEAN
+| TOK_BOOLEAN
{ $$ = parse_java_type (pstate)->builtin_boolean; }
;
@@ -288,22 +288,22 @@ NumericType:
;
IntegralType:
- BYTE
+ TOK_BYTE
{ $$ = parse_java_type (pstate)->builtin_byte; }
-| SHORT
+| TOK_SHORT
{ $$ = parse_java_type (pstate)->builtin_short; }
-| INT
+| TOK_INT
{ $$ = parse_java_type (pstate)->builtin_int; }
-| LONG
+| TOK_LONG
{ $$ = parse_java_type (pstate)->builtin_long; }
-| CHAR
+| TOK_CHAR
{ $$ = parse_java_type (pstate)->builtin_char; }
;
FloatingPointType:
- FLOAT
+ TOK_FLOAT
{ $$ = parse_java_type (pstate)->builtin_float; }
-| DOUBLE
+| TOK_DOUBLE
{ $$ = parse_java_type (pstate)->builtin_double; }
;
@@ -734,7 +734,7 @@ parse_number (struct parser_state *par_s
int suffix_len;
if (! parse_float (p, len, &putithere->typed_val_float.dval, &suffix))
- return ERROR;
+ return TOK_ERROR;
suffix_len = p + len - suffix;
@@ -751,10 +751,10 @@ parse_number (struct parser_state *par_s
putithere->typed_val_float.type =
parse_type (par_state)->builtin_double;
else
- return ERROR;
+ return TOK_ERROR;
}
else
- return ERROR;
+ return TOK_ERROR;
return FLOATING_POINT_LITERAL;
}
@@ -815,9 +815,9 @@ parse_number (struct parser_state *par_s
else if (c >= 'a' && c <= 'z')
c -= 'a' - 10;
else
- return ERROR; /* Char not a digit */
+ return TOK_ERROR; /* Char not a digit */
if (c >= base)
- return ERROR;
+ return TOK_ERROR;
if (n > limit_div_base
|| (n *= base) > limit - c)
error (_("Numeric constant too large"));
@@ -1030,7 +1030,7 @@ yylex (void)
}
toktype = parse_number (pstate, tokstart, p - tokstart,
got_dot|got_e, &yylval);
- if (toktype == ERROR)
+ if (toktype == TOK_ERROR)
{
char *err_copy = (char *) alloca (p - tokstart + 1);
@@ -1159,15 +1159,15 @@ yylex (void)
{
case 7:
if (strncmp (tokstart, "boolean", 7) == 0)
- return BOOLEAN;
+ return TOK_BOOLEAN;
break;
case 6:
if (strncmp (tokstart, "double", 6) == 0)
- return DOUBLE;
+ return TOK_DOUBLE;
break;
case 5:
if (strncmp (tokstart, "short", 5) == 0)
- return SHORT;
+ return TOK_SHORT;
if (strncmp (tokstart, "false", 5) == 0)
{
yylval.lval = 0;
@@ -1176,15 +1176,15 @@ yylex (void)
if (strncmp (tokstart, "super", 5) == 0)
return SUPER;
if (strncmp (tokstart, "float", 5) == 0)
- return FLOAT;
+ return TOK_FLOAT;
break;
case 4:
if (strncmp (tokstart, "long", 4) == 0)
- return LONG;
+ return TOK_LONG;
if (strncmp (tokstart, "byte", 4) == 0)
- return BYTE;
+ return TOK_BYTE;
if (strncmp (tokstart, "char", 4) == 0)
- return CHAR;
+ return TOK_CHAR;
if (strncmp (tokstart, "true", 4) == 0)
{
yylval.lval = 1;
@@ -1193,7 +1193,7 @@ yylex (void)
break;
case 3:
if (strncmp (tokstart, "int", 3) == 0)
- return INT;
+ return TOK_INT;
if (strncmp (tokstart, "new", 3) == 0)
return NEW;
break;
--- old/orig/gdb/m2-exp.y 2014-12-14 02:48:38.000000000 +0100
+++ ./gdb/m2-exp.y 2014-12-22 20:36:46.442891219 +0100
@@ -156,9 +156,9 @@ static int number_sign = 1;
%type <bval> block
%type <sym> fblock
-%token <lval> INT HEX ERROR
-%token <ulval> UINT M2_TRUE M2_FALSE CHAR
-%token <dval> FLOAT
+%token <lval> TOK_INT HEX TOK_ERROR
+%token <ulval> TOK_UINT M2_TRUE M2_FALSE TOK_CHAR
+%token <dval> TOK_FLOAT
/* Both NAME and TYPENAME tokens represent symbols in the input,
and both convey their data as strings.
@@ -173,7 +173,7 @@ static int number_sign = 1;
%token <sval> NAME BLOCKNAME IDENT VARNAME
%token <sval> TYPENAME
-%token SIZE CAP ORD HIGH ABS MIN_FUNC MAX_FUNC FLOAT_FUNC VAL CHR ODD TRUNC
+%token TOK_SIZE CAP ORD HIGH ABS MIN_FUNC MAX_FUNC FLOAT_FUNC VAL CHR ODD TRUNC
%token TSIZE
%token INC DEC INCL EXCL
@@ -186,7 +186,7 @@ static int number_sign = 1;
%left ','
%left ABOVE_COMMA
%nonassoc ASSIGN
-%left '<' '>' LEQ GEQ '=' NOTEQUAL '#' IN
+%left '<' '>' LEQ GEQ '=' NOTEQUAL '#' TOK_IN
%left OROR
%left LOGICAL_AND '&'
%left '@'
@@ -293,7 +293,7 @@ exp : TSIZE '(' exp ')'
{ write_exp_elt_opcode (pstate, UNOP_SIZEOF); }
;
-exp : SIZE exp %prec UNARY
+exp : TOK_SIZE exp %prec UNARY
{ write_exp_elt_opcode (pstate, UNOP_SIZEOF); }
;
@@ -329,7 +329,7 @@ exp : exp DOT NAME
exp : set
;
-exp : exp IN set
+exp : exp TOK_IN set
{ error (_("Sets are not implemented."));}
;
@@ -499,7 +499,7 @@ exp : M2_FALSE
write_exp_elt_opcode (pstate, OP_BOOL); }
;
-exp : INT
+exp : TOK_INT
{ write_exp_elt_opcode (pstate, OP_LONG);
write_exp_elt_type (pstate,
parse_m2_type (pstate)->builtin_int);
@@ -507,7 +507,7 @@ exp : INT
write_exp_elt_opcode (pstate, OP_LONG); }
;
-exp : UINT
+exp : TOK_UINT
{
write_exp_elt_opcode (pstate, OP_LONG);
write_exp_elt_type (pstate,
@@ -518,7 +518,7 @@ exp : UINT
}
;
-exp : CHAR
+exp : TOK_CHAR
{ write_exp_elt_opcode (pstate, OP_LONG);
write_exp_elt_type (pstate,
parse_m2_type (pstate)
@@ -528,7 +528,7 @@ exp : CHAR
;
-exp : FLOAT
+exp : TOK_FLOAT
{ write_exp_elt_opcode (pstate, OP_DOUBLE);
write_exp_elt_type (pstate,
parse_m2_type (pstate)
@@ -540,7 +540,7 @@ exp : FLOAT
exp : variable
;
-exp : SIZE '(' type ')' %prec UNARY
+exp : TOK_SIZE '(' type ')' %prec UNARY
{ write_exp_elt_opcode (pstate, OP_LONG);
write_exp_elt_type (pstate,
parse_type (pstate)->builtin_int);
@@ -709,7 +709,7 @@ parse_number (int olen)
/* It's a float since it contains a point. */
yylval.dval = atof (p);
lexptr += len;
- return FLOAT;
+ return TOK_FLOAT;
}
if (p[c] == '.' && base != 10)
error (_("Floating point numbers must be base 10."));
@@ -730,11 +730,11 @@ parse_number (int olen)
if (base == 16 && c >= 'A' && c <= 'F')
i = c - 'A' + 10;
else
- return ERROR;
+ return TOK_ERROR;
}
n+=i;
if(i >= base)
- return ERROR;
+ return TOK_ERROR;
if(!unsigned_p && number_sign == 1 && (prevn >= n))
unsigned_p=1; /* Try something unsigned */
/* Don't do the range check if n==i and i==0, since that special
@@ -755,19 +755,19 @@ parse_number (int olen)
if (ischar)
{
yylval.ulval = n;
- return CHAR;
+ return TOK_CHAR;
}
else if ( unsigned_p && number_sign == 1)
{
yylval.ulval = n;
- return UINT;
+ return TOK_UINT;
}
else if((unsigned_p && (n<0))) {
range_error (_("Overflow on numeric constant -- number too large."));
/* But, this can return if range_check == range_warn. */
}
yylval.lval = n;
- return INT;
+ return TOK_INT;
}
@@ -797,7 +797,7 @@ struct keyword {
static struct keyword keytab[] =
{
{"OR" , OROR },
- {"IN", IN },/* Note space after IN */
+ {"IN", TOK_IN },/* Note space after TOK_IN */
{"AND", LOGICAL_AND},
{"ABS", ABS },
{"CHR", CHR },
@@ -815,10 +815,10 @@ static struct keyword keytab[] =
{"EXCL", EXCL },
{"HIGH", HIGH },
{"INCL", INCL },
- {"SIZE", SIZE },
+ {"SIZE", TOK_SIZE },
{"FLOAT", FLOAT_FUNC },
{"TRUNC", TRUNC },
- {"TSIZE", SIZE },
+ {"TSIZE", TOK_SIZE },
};
@@ -933,7 +933,7 @@ yylex (void)
if(namelen == 2) /* Single character */
{
yylval.ulval = tokstart[1];
- return CHAR;
+ return TOK_CHAR;
}
else
return STRING;
@@ -966,7 +966,7 @@ yylex (void)
break;
}
toktype = parse_number (p - tokstart);
- if (toktype == ERROR)
+ if (toktype == TOK_ERROR)
{
char *err_copy = (char *) alloca (p - tokstart + 1);
--- old/orig/gdb/p-exp.y 2014-12-14 02:48:38.000000000 +0100
+++ ./gdb/p-exp.y 2014-12-22 20:35:33.514872617 +0100
@@ -181,8 +181,8 @@ static int search_field;
/* Fancy type parsing. */
%type <tval> ptype
-%token <typed_val_int> INT
-%token <typed_val_float> FLOAT
+%token <typed_val_int> TOK_INT
+%token <typed_val_float> TOK_FLOAT
/* Both NAME and TYPENAME tokens represent symbols in the input,
and both convey their data as strings.
@@ -208,7 +208,7 @@ static int search_field;
%token <ssym> NAME_OR_INT
%token STRUCT CLASS SIZEOF COLONCOLON
-%token ERROR
+%token TOK_ERROR
/* Special type cases, put in to allow the parser to distinguish different
legal basetypes. */
@@ -217,7 +217,7 @@ static int search_field;
/* Object pascal */
-%token THIS
+%token TOK_THIS
%token <lval> TRUEKEYWORD FALSEKEYWORD
%left ','
@@ -543,7 +543,7 @@ exp : FALSEKEYWORD
write_exp_elt_opcode (pstate, OP_BOOL); }
;
-exp : INT
+exp : TOK_INT
{ write_exp_elt_opcode (pstate, OP_LONG);
write_exp_elt_type (pstate, $1.type);
current_type = $1.type;
@@ -565,7 +565,7 @@ exp : NAME_OR_INT
;
-exp : FLOAT
+exp : TOK_FLOAT
{ write_exp_elt_opcode (pstate, OP_DOUBLE);
write_exp_elt_type (pstate, $1.type);
current_type = $1.type;
@@ -638,7 +638,7 @@ exp : STRING
;
/* Object pascal */
-exp : THIS
+exp : TOK_THIS
{
struct value * this_val;
struct type * this_type;
@@ -913,8 +913,8 @@ parse_number (struct parser_state *par_s
if (! parse_c_float (parse_gdbarch (par_state), p, len,
&putithere->typed_val_float.dval,
&putithere->typed_val_float.type))
- return ERROR;
- return FLOAT;
+ return TOK_ERROR;
+ return TOK_FLOAT;
}
/* Handle base-switching prefixes 0x, 0t, 0d, 0. */
@@ -958,7 +958,7 @@ parse_number (struct parser_state *par_s
if (c >= '0' && c <= '9')
{
if (found_suffix)
- return ERROR;
+ return TOK_ERROR;
n += i = c - '0';
}
else
@@ -966,7 +966,7 @@ parse_number (struct parser_state *par_s
if (base > 10 && c >= 'a' && c <= 'f')
{
if (found_suffix)
- return ERROR;
+ return TOK_ERROR;
n += i = c - 'a' + 10;
}
else if (c == 'l')
@@ -980,10 +980,10 @@ parse_number (struct parser_state *par_s
found_suffix = 1;
}
else
- return ERROR; /* Char not a digit */
+ return TOK_ERROR; /* Char not a digit */
}
if (i >= base)
- return ERROR; /* Invalid digit in this base. */
+ return TOK_ERROR; /* Invalid digit in this base. */
/* Portably test for overflow (only works for nonzero values, so make
a second check for zero). FIXME: Can't we just make n and prevn
@@ -1066,7 +1066,7 @@ parse_number (struct parser_state *par_s
putithere->typed_val_int.type = signed_type;
}
- return INT;
+ return TOK_INT;
}
@@ -1240,7 +1240,7 @@ yylex (void)
}
error (_("Invalid character constant."));
}
- return INT;
+ return TOK_INT;
case '(':
paren_depth++;
@@ -1322,7 +1322,7 @@ yylex (void)
}
toktype = parse_number (pstate, tokstart,
p - tokstart, got_dot | got_e, &yylval);
- if (toktype == ERROR)
+ if (toktype == TOK_ERROR)
{
char *err_copy = (char *) alloca (p - tokstart + 1);
@@ -1511,7 +1511,7 @@ yylex (void)
VAR_DOMAIN, NULL))
{
free (uptokstart);
- return THIS;
+ return TOK_THIS;
}
}
break;
@@ -1727,7 +1727,7 @@ yylex (void)
{
YYSTYPE newlval; /* Its value is ignored. */
hextype = parse_number (pstate, tokstart, namelen, 0, &newlval);
- if (hextype == INT)
+ if (hextype == TOK_INT)
{
yylval.ssym.sym = sym;
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
--- old/orig/gdb/ser-tcp.c 2014-12-14 02:48:39.000000000 +0100
+++ ./gdb/ser-tcp.c 2014-12-22 19:27:27.393845431 +0100
@@ -42,6 +42,8 @@
#ifndef ETIMEDOUT
#define ETIMEDOUT WSAETIMEDOUT
#endif
+/* gnulib/ may define 'close'. */
+#undef close
#define close(fd) closesocket (fd)
#define ioctl ioctlsocket
#else
@@ -120,11 +122,15 @@ wait_for_connect (struct serial *scb, un
if (scb)
{
fd_set rset, wset, eset;
+ TIMEVAL t_mingw;
FD_ZERO (&rset);
FD_SET (scb->fd, &rset);
wset = rset;
eset = rset;
+
+ t_mingw.tv_sec = t.tv_sec;
+ t_mingw.tv_usec = t.tv_usec;
/* POSIX systems return connection success or failure by signalling
wset. Windows systems return success in wset and failure in
@@ -134,7 +140,7 @@ wait_for_connect (struct serial *scb, un
the serial structure has not yet been initialized - the
MinGW select wrapper will not know that this FD refers
to a socket. */
- n = select (scb->fd + 1, &rset, &wset, &eset, &t);
+ n = select (scb->fd + 1, &rset, &wset, &eset, &t_mingw);
}
else
/* Use gdb_select here, since we have no file descriptors, and on
--- old/orig/gdb/symfile.c 2014-12-14 02:48:39.000000000 +0100
+++ ./gdb/symfile.c 2014-12-22 20:36:24.115885524 +0100
@@ -3541,12 +3541,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, OVLY_SIZE, 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, OVLY_SIZE, MAPPED_TO_LMA}, /# one entry per overlay region #/
{..., ..., ...},
}
These functions will attempt to update GDB's mappedness state in the
@@ -3564,7 +3564,7 @@ static unsigned cache_novlys = 0;
static CORE_ADDR cache_ovly_table_base = 0;
enum ovly_index
{
- VMA, SIZE, LMA, MAPPED
+ VMA, OVLY_SIZE, LMA, MAPPED
};
/* Throw away the cached copy of _ovly_table. */
@@ -3664,14 +3664,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][OVLY_SIZE] == 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][OVLY_SIZE] == size */ )
{
osect->ovly_mapped = cache_ovly_table[i][MAPPED];
return 1;
@@ -3737,7 +3737,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][OVLY_SIZE] == 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. */
--- old/orig/include/coff/ecoff.h 2014-12-14 02:48:39.000000000 +0100
+++ ./include/coff/ecoff.h 2014-12-22 20:01:14.471204731 +0100
@@ -148,10 +148,12 @@
/* gcc also uses mips-tfile to output COFF debugging information.
These are the values it uses when outputting the .type directive.
These should also be in a shared include file. */
+#ifndef _WIN64
#define N_BTMASK (017)
#define N_TMASK (060)
#define N_BTSHFT (4)
#define N_TSHIFT (2)
+#endif
/********************** AUX **********************/
--- old/orig/include/coff/internal.h 2014-12-14 02:48:39.000000000 +0100
+++ ./include/coff/internal.h 2014-12-22 20:01:48.439246332 +0100
@@ -21,6 +21,10 @@
#ifndef GNU_COFF_INTERNAL_H
#define GNU_COFF_INTERNAL_H 1
+#ifdef _WIN64
+# include <windows.h>
+#endif
+
/* First, make "signed char" work, even on old compilers. */
#ifndef signed
#ifndef __STDC__
@@ -109,11 +113,13 @@ struct internal_filehdr
#define F_GO32STUB (0x4000)
/* Extra structure which is used in the optional header. */
+#ifndef _WIN64
typedef struct _IMAGE_DATA_DIRECTORY
{
bfd_vma VirtualAddress;
long Size;
} IMAGE_DATA_DIRECTORY;
+#endif
#define PE_EXPORT_TABLE 0
#define PE_IMPORT_TABLE 1
#define PE_RESOURCE_TABLE 2
@@ -533,6 +539,7 @@ struct internal_syment
#define BTYPE(x) ((x) & N_BTMASK)
#define DTYPE(x) (((x) & N_TMASK) >> N_BTSHFT)
+#ifndef _WIN64
#define ISPTR(x) \
(((unsigned long) (x) & N_TMASK) == ((unsigned long) DT_PTR << N_BTSHFT))
#define ISFCN(x) \
@@ -543,6 +550,7 @@ struct internal_syment
((x) == C_STRTAG || (x) == C_UNTAG || (x) == C_ENTAG)
#define DECREF(x) \
((((x) >> N_TSHIFT) & ~ N_BTMASK) | ((x) & N_BTMASK))
+#endif
union internal_auxent
{
--- old/orig/include/coff/pe.h 2014-12-14 02:48:39.000000000 +0100
+++ ./include/coff/pe.h 2014-12-22 20:11:01.742540716 +0100
@@ -86,6 +90,7 @@
#define IMAGE_SCN_ALIGN_POWER_CONST(val) \
(((val) + 1) << IMAGE_SCN_ALIGN_POWER_BIT_POS)
+#ifndef _WIN64
#define IMAGE_SCN_ALIGN_1BYTES IMAGE_SCN_ALIGN_POWER_CONST (0)
#define IMAGE_SCN_ALIGN_2BYTES IMAGE_SCN_ALIGN_POWER_CONST (1)
#define IMAGE_SCN_ALIGN_4BYTES IMAGE_SCN_ALIGN_POWER_CONST (2)
@@ -101,6 +106,7 @@
#define IMAGE_SCN_ALIGN_2048BYTES IMAGE_SCN_ALIGN_POWER_CONST (11)
#define IMAGE_SCN_ALIGN_4096BYTES IMAGE_SCN_ALIGN_POWER_CONST (12)
#define IMAGE_SCN_ALIGN_8192BYTES IMAGE_SCN_ALIGN_POWER_CONST (13)
+#endif
/* Encode alignment power into IMAGE_SCN_ALIGN bits of s_flags. */
#define COFF_ENCODE_ALIGNMENT(SECTION, ALIGNMENT_POWER) \
@@ -113,14 +119,17 @@
/* COMDAT selection codes. */
+#ifndef _WIN64
#define IMAGE_COMDAT_SELECT_NODUPLICATES (1) /* Warn if duplicates. */
#define IMAGE_COMDAT_SELECT_ANY (2) /* No warning. */
#define IMAGE_COMDAT_SELECT_SAME_SIZE (3) /* Warn if different size. */
#define IMAGE_COMDAT_SELECT_EXACT_MATCH (4) /* Warn if different. */
#define IMAGE_COMDAT_SELECT_ASSOCIATIVE (5) /* Base on other section. */
+#endif
/* Machine numbers. */
+#ifndef _WIN64
#define IMAGE_FILE_MACHINE_UNKNOWN 0x0000
#define IMAGE_FILE_MACHINE_ALPHA 0x0184
#define IMAGE_FILE_MACHINE_ALPHA64 0x0284
@@ -134,7 +143,9 @@
#define IMAGE_FILE_MACHINE_I386 0x014c
#define IMAGE_FILE_MACHINE_IA64 0x0200
#define IMAGE_FILE_MACHINE_M32R 0x9041
+#endif
#define IMAGE_FILE_MACHINE_M68K 0x0268
+#ifndef _WIN64
#define IMAGE_FILE_MACHINE_MIPS16 0x0266
#define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
#define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
@@ -152,6 +163,7 @@
#define IMAGE_FILE_MACHINE_TRICORE 0x0520
#define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
#define IMAGE_FILE_MACHINE_AMD64 0x8664
+#endif
#define IMAGE_SUBSYSTEM_UNKNOWN 0
#define IMAGE_SUBSYSTEM_NATIVE 1
@@ -501,11 +513,15 @@ struct external_pex64_unwind_code
#define PEX64_UNWCODE_INFO(VAL) (((VAL) >> 4) & 0xf)
/* The unwind info. */
+#ifndef _WIN64
#define UNW_FLAG_NHANDLER 0
#define UNW_FLAG_EHANDLER 1
#define UNW_FLAG_UHANDLER 2
+#endif
#define UNW_FLAG_FHANDLER 3
+#ifndef _WIN64
#define UNW_FLAG_CHAININFO 4
+#endif
#define UNW_FLAG_MASK 0x1f
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch 1/2] mingw: update gnulib: prepare the sources
2014-12-22 22:12 [patch 1/2] mingw: update gnulib: prepare the sources Jan Kratochvil
@ 2014-12-23 11:54 ` Kai Tietz
2014-12-24 22:20 ` Jan Kratochvil
0 siblings, 1 reply; 13+ messages in thread
From: Kai Tietz @ 2014-12-23 11:54 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches, Corinna Vinschen, Nicholas Clifton
Hi,
----- Ursprüngliche Mail -----
...
> 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.
> x86_64-w64-mingw32-gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
> -fexceptions --param=ssp-buffer-size=4 -D__USE_MINGW_ACCESS -I.
> -I../../gdb -I../../gdb/common -I../../gdb/config
> -DLOCALEDIR="\"/usr/x86_64-w64-mingw32/sys-root/mingw/share/locale\""
> -DHAVE_CONFIG_H -I../../gdb/../include/opcode -I../../gdb/../opcodes/..
> -I../../gdb/../readline/.. -I../bfd -I../../gdb/../bfd
> -I../../gdb/../include -I../libdecnumber -I../../gdb/../libdecnumber
> -I./../intl -I../../gdb/gnulib/import -Ibuild-gnulib/import -Wall
> -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused
> -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts
> -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body
> -Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition
> -Wno-format -Werror -c -o ser-tcp.o -MT ser-tcp.o -MMD -MP -MF
> .deps/ser-tcp.Tpo ../../gdb/ser-tcp.c
> ../../gdb/ser-tcp.c: In function 'wait_for_connect':
> ../../gdb/ser-tcp.c:137:53: error: passing argument 5 of 'select' from
> incompatible pointer type [-Werror]
> n = select (scb->fd + 1, &rset, &wset, &eset, &t);
> ^
> In file included from ../../gdb/serial.h:23:0,
> from ../../gdb/ser-tcp.c:21:
> /usr/x86_64-w64-mingw32/sys-root/mingw/include/winsock2.h:995:34: note:
> expected 'PTIMEVAL' but argument is of type 'struct rpl_timeval *'
> WINSOCK_API_LINKAGE int WSAAPI select(int nfds,fd_set *readfds,fd_set
> *writefds,fd_set *exceptfds,const PTIMEVAL timeout);
> ^
> cc1: all warnings being treated as errors
> Makefile:1100: recipe for target 'ser-tcp.o' failed
>
> This IIUC comes from this mingw64 change:
> [Mingw-w64-public] [patch] Replace struct timeval usage with PTIMEVAL and
> define TIMEVAL differently on LP64
> http://sourceforge.net/p/mingw-w64/mailman/message/29610438/
>
> This is because occasional #include <sys/time.h> will then #include also
> MS-Windows headers and provide an incompatible definition of struct timeval.
> IIUC one should always #include <sys/time.h> to get all the struct timeval
> definitions in the codebase the same.
>
> But #including <sys/time.h> (and thus <windows.h>) is a problem as sourceware
> include/coff/ headers have duplicate/conflicting definitions with MS-Windows
> headers. So I have #ifndef-out their duplicate/conflicting parts during
> 64-bit
> MS-Windows builds.
>
> I have no idea what is the best way, my only goal was to make it buildable
> (not runtime tested as Wine does not work so well for gdb.exe).
Well, IMO the real issue here is to include windows.h instead of sys/time.h. Also a lot of changes done in second patch are strongly related to this include.
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.
Kai
>
> Thanks,
> Jan
>
>
> [Textdatei:use.patch]
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch 1/2] mingw: update gnulib: prepare the sources
2014-12-23 11:54 ` Kai Tietz
@ 2014-12-24 22:20 ` Jan Kratochvil
2015-03-23 16:51 ` Pedro Alves
0 siblings, 1 reply; 13+ messages in thread
From: Jan Kratochvil @ 2014-12-24 22:20 UTC (permalink / raw)
To: Kai Tietz; +Cc: gdb-patches, Corinna Vinschen, Nicholas Clifton
[-- Attachment #1: Type: text/plain, Size: 1707 bytes --]
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
[-- Attachment #2: gnulib-upgrade-fixup.patch --]
[-- Type: text/plain, Size: 11384 bytes --]
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);
+\f
+#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);
-\f
+
/* Parsing utilites. */
extern int parse_pid_to_attach (const char *args);
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch 1/2] mingw: update gnulib: prepare the sources
2014-12-24 22:20 ` Jan Kratochvil
@ 2015-03-23 16:51 ` Pedro Alves
2015-03-23 17:08 ` Jan Kratochvil
2015-03-23 19:17 ` Corinna Vinschen
0 siblings, 2 replies; 13+ messages in thread
From: Pedro Alves @ 2015-03-23 16:51 UTC (permalink / raw)
To: Jan Kratochvil, Kai Tietz; +Cc: gdb-patches, Corinna Vinschen, Nicholas Clifton
Hi guys,
We really need to move forward with importing a newer gnulib,
for several reasons...
On 12/24/2014 10:20 PM, Jan Kratochvil wrote:
> 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.
I don't think this is correct, however.
> --- ./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 */
>
For example, further down the file we have:
static int ATTRIBUTE_PRINTF (1, 0)
defaulted_query (const char *ctlstr, const char defchar, va_list args)
{
...
struct timeval prompt_started, prompt_ended, prompt_delta;
...
/* Add time spend in this routine to prompt_for_continue_wait_time. */
gettimeofday (&prompt_ended, NULL);
timeval_sub (&prompt_delta, &prompt_ended, &prompt_started);
timeval_add (&prompt_for_continue_wait_time,
&prompt_for_continue_wait_time, &prompt_delta);
and with this change above:
> -#include <signal.h>
> +/* For struct timeval for timeval-utils.h. */
> +#include <sys/time.h>
> #include "timeval-utils.h"
timeval_sub and timeval_add in "timeval-utils.h" will be prototyped
as if taking gnulib's "struct timeval" replacement, but, those functions
expect to be passed the native "struct timeval", as gnulib's sys/time.h
isn't used when libiberty itself is built.
The only thing gnulib's gettimeofday does is type-convert
the native struct timeval to the replaced type, like this:
int
gettimeofday (struct timeval *restrict tv, void *restrict tz)
{
#undef gettimeofday
...
# if defined timeval /* 'struct timeval' overridden by gnulib? */
# undef timeval
struct timeval otv;
int result = gettimeofday (&otv, (struct timezone *) tz);
if (result == 0)
{
tv->tv_sec = otv.tv_sec;
tv->tv_usec = otv.tv_usec;
}
...
that is, other than POSIX compliance, gnulib's struct timeval
replacement doesn't really give us "real" 64-bit-aware gettimeofday.
So, how about this simpler approach below? Just make sure we
continue using the native struct timeval, as today.
From 5b35653dbdd66fc91b6222e2b9147fe2f89e0d86 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Mon, 23 Mar 2015 15:20:09 +0000
Subject: [PATCH] Prepare for gnulib update
After the last gnulib import (Dec 2012), gnulib upstream started
replacing mingw's 'struct timeval' with a version with 64-bit time_t,
for POSIX compliance:
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.
See:
https://lists.gnu.org/archive/html/bug-gnulib/2012-01/msg00372.html
However, that results in conflicts with native Winsock2's 'select':
select()'s argument
http://sourceforge.net/p/mingw-w64/mailman/message/29610438/
... and libiberty's timeval-utils.h timeval_add/timeval_sub, at the
least.
We don't really need the POSIX compliance, so this patch prepares us
to simply not use gnulib's 'struct timeval' replacement once a more
recent gnulib is imported, thus preserving the current behavior, by
adding a sys/time.h wrapper header that undefs gnulib's replacements,
and including that everywhere instead.
The SIZE -> OSIZE change is necessary because newer gnulib's
sys/time.h also includes windows.h/winsock2.h, which defines a
conflicting SIZE symbol.
Cross build-tested mingw-w64 32-bit and 64-bit.
Regtested on x86_64 Fedora 20.
gdb/ChangeLog:
2015-03-23 Pedro Alves <palves@redhat.com>
* Makefile.in (HFILES_NO_SRCDIR): Add common/gdb_sys_time.h.
* common/gdb_sys_time.h: New file.
* dsrec.c: Include gdb_sys_time.h instead of sys/time.h.
* event-loop.c: Likewise.
* gdb_select.h: Likewise.
* gdb_usleep.c: Likewise.
* m32r-rom.c: Likewise.
* maint.c: Likewise.
* mi/mi-main.c: Likewise.
* mi/mi-parse.h: Likewise.
* remote-fileio.c: Likewise.
* remote-m32r-sdi.c: Likewise.
* remote.c: Likewise.
* ser-base.c: Likewise.
* ser-pipe.c: Likewise.
* ser-tcp.c: Likewise.
* ser-unix.c: Likewise.
* symfile.c: Likewise.
* symfile.c: Likewise. Rename OSIZE to SIZE throughout.
* target-memory.c: Include gdb_sys_time.h instead of sys/time.h.
* utils.c: Likewise.
gdb/gdbserver/ChangeLog:
2015-03-23 Pedro Alves <palves@redhat.com>
* debug.c: Include gdb_sys_time.h instead of sys/time.h.
* gdbserver/event-loop.c: Likewise.
* gdbserver/remote-utils.c: Likewise.
* gdbserver/tracepoint.c: Likewise.
---
gdb/Makefile.in | 2 +-
gdb/common/gdb_sys_time.h | 38 ++++++++++++++++++++++++++++++++++++++
gdb/dsrec.c | 2 +-
gdb/event-loop.c | 2 +-
gdb/gdb_select.h | 2 +-
gdb/gdb_usleep.c | 3 +--
gdb/gdbserver/debug.c | 2 +-
gdb/gdbserver/event-loop.c | 2 +-
gdb/gdbserver/remote-utils.c | 2 +-
gdb/gdbserver/tracepoint.c | 2 +-
gdb/m32r-rom.c | 2 +-
gdb/maint.c | 2 +-
gdb/mi/mi-main.c | 2 +-
gdb/mi/mi-parse.h | 2 +-
gdb/remote-fileio.c | 2 +-
gdb/remote-m32r-sdi.c | 2 +-
gdb/remote.c | 2 +-
gdb/ser-base.c | 2 +-
gdb/ser-pipe.c | 2 +-
gdb/ser-tcp.c | 2 +-
gdb/ser-unix.c | 2 +-
gdb/symfile.c | 14 +++++++-------
gdb/target-memory.c | 2 +-
gdb/utils.c | 2 +-
24 files changed, 67 insertions(+), 30 deletions(-)
create mode 100644 gdb/common/gdb_sys_time.h
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index dbace2d..afff3c6 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -968,7 +968,7 @@ i386-linux-nat.h common/common-defs.h common/errors.h common/common-types.h \
common/common-debug.h common/cleanups.h common/gdb_setjmp.h \
common/common-exceptions.h target/target.h common/symbol.h \
common/common-regcache.h fbsd-tdep.h nat/linux-personality.h \
-common/common-remote-fileio.h
+common/common-remote-fileio.h common/gdb_sys_time.h
# Header files that already have srcdir in them, or which are in objdir.
diff --git a/gdb/common/gdb_sys_time.h b/gdb/common/gdb_sys_time.h
new file mode 100644
index 0000000..0f764f8
--- /dev/null
+++ b/gdb/common/gdb_sys_time.h
@@ -0,0 +1,38 @@
+/* Copyright (C) 2015 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_SYS_TIME_H
+#define GDB_SYS_TIME_H
+
+#include <sys/time.h>
+
+/* On MinGW-w64, gnulib's sys/time.h replaces 'struct timeval' and
+ gettimeofday with versions that support 64-bit time_t, for POSIX
+ compliance. However, the gettimeofday replacement does not ever
+ return time_t values larger than 31-bit, as it simply returns the
+ system's gettimeofday's (signed) 32-bit result as (signed) 64-bit.
+ Because we don't really need the POSIX compliance, and it ends up
+ causing conflicts with other libraries we use that don't use gnulib
+ and thus work with the native struct timeval, such as Winsock2's
+ native 'select' and libiberty, simply undefine away gnulib's
+ replacements. */
+#if GNULIB_defined_struct_timeval
+# undef timeval
+# undef gettimeofday
+#endif
+
+#endif /* #ifndef GDB_SYS_TIME_H */
diff --git a/gdb/dsrec.c b/gdb/dsrec.c
index 82cc968..c4e5352 100644
--- a/gdb/dsrec.c
+++ b/gdb/dsrec.c
@@ -19,7 +19,7 @@
#include "defs.h"
#include "serial.h"
#include "srec.h"
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#include <time.h>
#include "gdb_bfd.h"
diff --git a/gdb/event-loop.c b/gdb/event-loop.c
index 79e41fd..7c97fc4 100644
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -31,7 +31,7 @@
#endif
#include <sys/types.h>
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#include "gdb_select.h"
#include "observer.h"
diff --git a/gdb/gdb_select.h b/gdb/gdb_select.h
index b608f2a..9748a13 100644
--- a/gdb/gdb_select.h
+++ b/gdb/gdb_select.h
@@ -23,7 +23,7 @@
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#else
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#endif
#ifdef USE_WIN32API
diff --git a/gdb/gdb_usleep.c b/gdb/gdb_usleep.c
index 22ee6a0..67e4396 100644
--- a/gdb/gdb_usleep.c
+++ b/gdb/gdb_usleep.c
@@ -18,8 +18,7 @@
#include "defs.h"
#include "gdb_usleep.h"
#include "gdb_select.h"
-
-#include <sys/time.h>
+#include "gdb_sys_time.h"
int
gdb_usleep (int usec)
diff --git a/gdb/gdbserver/debug.c b/gdb/gdbserver/debug.c
index 1a1e333..5bbd381 100644
--- a/gdb/gdbserver/debug.c
+++ b/gdb/gdbserver/debug.c
@@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "server.h"
-#include <sys/time.h>
+#include "gdb_sys_time.h"
/* Enable miscellaneous debugging output. The name is historical - it
was originally used to debug LinuxThreads support. */
diff --git a/gdb/gdbserver/event-loop.c b/gdb/gdbserver/event-loop.c
index 08a503f..b171644 100644
--- a/gdb/gdbserver/event-loop.c
+++ b/gdb/gdbserver/event-loop.c
@@ -22,7 +22,7 @@
#include "queue.h"
#include <sys/types.h>
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#ifdef USE_WIN32API
#include <windows.h>
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 1de86be..bc3c3d0 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -51,7 +51,7 @@
#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#include <unistd.h>
#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 1acee8c..48c5710 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -25,7 +25,7 @@
#include <ctype.h>
#include <fcntl.h>
#include <unistd.h>
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#include <inttypes.h>
#include <stdint.h>
diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c
index a2ac537..d639aa5 100644
--- a/gdb/m32r-rom.c
+++ b/gdb/m32r-rom.c
@@ -31,7 +31,7 @@
#include "command.h"
#include "gdbcmd.h"
#include "symfile.h" /* for generic load */
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#include <time.h> /* for time_t */
#include "objfiles.h" /* for ALL_OBJFILES etc. */
#include "inferior.h"
diff --git a/gdb/maint.c b/gdb/maint.c
index 1adea2f..5d7fca5 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -24,7 +24,7 @@
#include "arch-utils.h"
#include <ctype.h>
#include <signal.h>
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#include <time.h>
#include "command.h"
#include "gdbcmd.h"
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index acbdb55..85ec281 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -55,7 +55,7 @@
#include "gdbcmd.h"
#include <ctype.h>
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#if defined HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
diff --git a/gdb/mi/mi-parse.h b/gdb/mi/mi-parse.h
index 4c10f92..5900a6f 100644
--- a/gdb/mi/mi-parse.h
+++ b/gdb/mi/mi-parse.h
@@ -20,7 +20,7 @@
#ifndef MI_PARSE_H
#define MI_PARSE_H
-#include <sys/time.h>
+#include "gdb_sys_time.h"
/* MI parser */
diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c
index 3882321..6af3c4b 100644
--- a/gdb/remote-fileio.c
+++ b/gdb/remote-fileio.c
@@ -31,7 +31,7 @@
#include "filestuff.h"
#include <fcntl.h>
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#ifdef __CYGWIN__
#include <sys/cygwin.h> /* For cygwin_conv_path. */
#endif
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index 01cb5b6..811d069 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -36,7 +36,7 @@
#include <netinet/in.h>
#endif
#include <sys/types.h>
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#include <time.h>
#include "gdb_bfd.h"
#include "cli/cli-utils.h"
diff --git a/gdb/remote.c b/gdb/remote.c
index dfa68b3..4c79d49 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -45,7 +45,7 @@
#include "filestuff.h"
#include "rsp-low.h"
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#include "event-loop.h"
#include "event-top.h"
diff --git a/gdb/ser-base.c b/gdb/ser-base.c
index 87817c4..48ee98d 100644
--- a/gdb/ser-base.c
+++ b/gdb/ser-base.c
@@ -23,7 +23,7 @@
#include "event-loop.h"
#include "gdb_select.h"
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#ifdef USE_WIN32API
#include <winsock2.h>
#endif
diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c
index bf5e4d4..bf8418b 100644
--- a/gdb/ser-pipe.c
+++ b/gdb/ser-pipe.c
@@ -27,7 +27,7 @@
#include <sys/types.h>
#include <sys/socket.h>
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#include <fcntl.h>
#include "filestuff.h"
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index 9c3dcf4..df7bb11 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -35,7 +35,7 @@
#include <sys/ioctl.h> /* For FIONBIO. */
#endif
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#ifdef USE_WIN32API
#include <winsock2.h>
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c
index 4125797..6182aba 100644
--- a/gdb/ser-unix.c
+++ b/gdb/ser-unix.c
@@ -26,7 +26,7 @@
#include <sys/types.h>
#include "terminal.h"
#include <sys/socket.h>
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#include "gdb_select.h"
#include "gdbcmd.h"
diff --git a/gdb/symfile.c b/gdb/symfile.c
index ba099d3..e4eca2b 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -62,7 +62,7 @@
#include <sys/stat.h>
#include <ctype.h>
#include <time.h>
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#include "psymtab.h"
@@ -3544,12 +3544,12 @@ overlay_command (char *args, int from_tty)
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
@@ -3567,7 +3567,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. */
@@ -3667,14 +3667,14 @@ simple_overlay_update_1 (struct obj_section *osect)
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;
@@ -3740,7 +3740,7 @@ simple_overlay_update (struct obj_section *osect)
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. */
diff --git a/gdb/target-memory.c b/gdb/target-memory.c
index 5e5b1d7..177deb6 100644
--- a/gdb/target-memory.c
+++ b/gdb/target-memory.c
@@ -23,7 +23,7 @@
#include "target.h"
#include "memory-map.h"
-#include <sys/time.h>
+#include "gdb_sys_time.h"
static int
compare_block_starting_address (const void *a, const void *b)
diff --git a/gdb/utils.c b/gdb/utils.c
index 7172bba..439e343 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -62,7 +62,7 @@
#include "readline/readline.h"
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#include <time.h>
#include "gdb_usleep.h"
--
1.9.3
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch 1/2] mingw: update gnulib: prepare the sources
2015-03-23 16:51 ` Pedro Alves
@ 2015-03-23 17:08 ` Jan Kratochvil
2015-03-23 17:25 ` Pedro Alves
2015-03-23 19:17 ` Corinna Vinschen
1 sibling, 1 reply; 13+ messages in thread
From: Jan Kratochvil @ 2015-03-23 17:08 UTC (permalink / raw)
To: Pedro Alves; +Cc: Kai Tietz, gdb-patches, Corinna Vinschen, Nicholas Clifton
On Mon, 23 Mar 2015 17:51:44 +0100, Pedro Alves wrote:
> --- /dev/null
> +++ b/gdb/common/gdb_sys_time.h
> @@ -0,0 +1,38 @@
[...]
> +#ifndef GDB_SYS_TIME_H
> +#define GDB_SYS_TIME_H
> +
> +#include <sys/time.h>
> +
> +/* On MinGW-w64, gnulib's sys/time.h replaces 'struct timeval' and
> + gettimeofday with versions that support 64-bit time_t, for POSIX
> + compliance. However, the gettimeofday replacement does not ever
> + return time_t values larger than 31-bit, as it simply returns the
> + system's gettimeofday's (signed) 32-bit result as (signed) 64-bit.
> + Because we don't really need the POSIX compliance, and it ends up
> + causing conflicts with other libraries we use that don't use gnulib
> + and thus work with the native struct timeval, such as Winsock2's
> + native 'select' and libiberty, simply undefine away gnulib's
> + replacements. */
> +#if GNULIB_defined_struct_timeval
> +# undef timeval
> +# undef gettimeofday
> +#endif
> +
> +#endif /* #ifndef GDB_SYS_TIME_H */
With this header file used for GDB's sources aren't gnulib's .c files compiled
with incompatible ABI?
Jan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch 1/2] mingw: update gnulib: prepare the sources
2015-03-23 17:08 ` Jan Kratochvil
@ 2015-03-23 17:25 ` Pedro Alves
2015-03-23 17:32 ` Jan Kratochvil
2015-03-23 17:37 ` Eli Zaretskii
0 siblings, 2 replies; 13+ messages in thread
From: Pedro Alves @ 2015-03-23 17:25 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Kai Tietz, gdb-patches, Corinna Vinschen, Nicholas Clifton
On 03/23/2015 05:08 PM, Jan Kratochvil wrote:
> On Mon, 23 Mar 2015 17:51:44 +0100, Pedro Alves wrote:
>> --- /dev/null
>> +++ b/gdb/common/gdb_sys_time.h
>> @@ -0,0 +1,38 @@
> [...]
>> +#ifndef GDB_SYS_TIME_H
>> +#define GDB_SYS_TIME_H
>> +
>> +#include <sys/time.h>
>> +
>> +/* On MinGW-w64, gnulib's sys/time.h replaces 'struct timeval' and
>> + gettimeofday with versions that support 64-bit time_t, for POSIX
>> + compliance. However, the gettimeofday replacement does not ever
>> + return time_t values larger than 31-bit, as it simply returns the
>> + system's gettimeofday's (signed) 32-bit result as (signed) 64-bit.
>> + Because we don't really need the POSIX compliance, and it ends up
>> + causing conflicts with other libraries we use that don't use gnulib
>> + and thus work with the native struct timeval, such as Winsock2's
>> + native 'select' and libiberty, simply undefine away gnulib's
>> + replacements. */
>> +#if GNULIB_defined_struct_timeval
>> +# undef timeval
>> +# undef gettimeofday
>> +#endif
>> +
>> +#endif /* #ifndef GDB_SYS_TIME_H */
>
> With this header file used for GDB's sources aren't gnulib's .c files compiled
> with incompatible ABI?
Other than rpl_gettimeofday (the gettimeofday replacement):
gettimeofday.o:0000005a T _rpl_gettimeofday
AFAICS, there's no other use of "struct timeval" or gettimeofday in gnulib's
sources.
So although rpl_gettimeofday is built expecting rpl_timeval as
parameter, given the #undef above, gdb never calls it:
$ x86_64-w64-mingw32-nm -A *.o build-gnulib/import/*.o | grep gettimeofday
event-loop.o: U gettimeofday
maint.o: U gettimeofday
mi-main.o: U gettimeofday
remote-fileio.o: U gettimeofday
remote-fileio.o:0000000000001b4b t remote_fileio_func_gettimeofday
symfile.o: U gettimeofday
utils.o: U gettimeofday
build-gnulib/import/gettimeofday.o:0000000000000000 b .bss
build-gnulib/import/gettimeofday.o:0000000000000000 d .data
build-gnulib/import/gettimeofday.o:0000000000000000 N .debug_abbrev
build-gnulib/import/gettimeofday.o:0000000000000000 N .debug_aranges
build-gnulib/import/gettimeofday.o:0000000000000000 N .debug_frame
build-gnulib/import/gettimeofday.o:0000000000000000 N .debug_info
build-gnulib/import/gettimeofday.o:0000000000000000 N .debug_line
build-gnulib/import/gettimeofday.o:0000000000000000 N .debug_macro
build-gnulib/import/gettimeofday.o: U gettimeofday
build-gnulib/import/gettimeofday.o: U gmtime
build-gnulib/import/gettimeofday.o: U localtime
build-gnulib/import/gettimeofday.o:0000000000000000 d localtime_buffer_addr
build-gnulib/import/gettimeofday.o:0000000000000000 p .pdata
build-gnulib/import/gettimeofday.o:0000000000000000 r .rdata$zzz
build-gnulib/import/gettimeofday.o:0000000000000082 T rpl_gettimeofday
build-gnulib/import/gettimeofday.o:0000000000000041 T rpl_gmtime
build-gnulib/import/gettimeofday.o:0000000000000000 T rpl_localtime
build-gnulib/import/gettimeofday.o:0000000000000000 t .text
build-gnulib/import/gettimeofday.o:0000000000000000 b tm_zero_buffer
build-gnulib/import/gettimeofday.o:0000000000000000 r .xdata
Do you think we still have a problem?
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch 1/2] mingw: update gnulib: prepare the sources
2015-03-23 17:25 ` Pedro Alves
@ 2015-03-23 17:32 ` Jan Kratochvil
2015-03-23 17:37 ` Eli Zaretskii
1 sibling, 0 replies; 13+ messages in thread
From: Jan Kratochvil @ 2015-03-23 17:32 UTC (permalink / raw)
To: Pedro Alves; +Cc: Kai Tietz, gdb-patches, Corinna Vinschen, Nicholas Clifton
On Mon, 23 Mar 2015 18:25:15 +0100, Pedro Alves wrote:
> Do you think we still have a problem?
I find it a bit fragile against future gnulib/ updates/additions but OK, it
should be working now.
Thanks,
Jan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch 1/2] mingw: update gnulib: prepare the sources
2015-03-23 17:25 ` Pedro Alves
2015-03-23 17:32 ` Jan Kratochvil
@ 2015-03-23 17:37 ` Eli Zaretskii
2015-03-23 17:57 ` Pedro Alves
1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2015-03-23 17:37 UTC (permalink / raw)
To: Pedro Alves; +Cc: jan.kratochvil, ktietz, gdb-patches, vinschen, nickc
> Date: Mon, 23 Mar 2015 17:25:15 +0000
> From: Pedro Alves <palves@redhat.com>
> CC: Kai Tietz <ktietz@redhat.com>, gdb-patches@sourceware.org, Corinna Vinschen <vinschen@redhat.com>, Nicholas Clifton <nickc@redhat.com>
>
> > With this header file used for GDB's sources aren't gnulib's .c files compiled
> > with incompatible ABI?
>
> Other than rpl_gettimeofday (the gettimeofday replacement):
>
> gettimeofday.o:0000005a T _rpl_gettimeofday
>
> AFAICS, there's no other use of "struct timeval" or gettimeofday in gnulib's
> sources.
We should watch out for Gnulib's 'select' and friends, if we ever want
to import that. Also 'utimens'.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch 1/2] mingw: update gnulib: prepare the sources
2015-03-23 17:37 ` Eli Zaretskii
@ 2015-03-23 17:57 ` Pedro Alves
2015-08-24 18:09 ` Pedro Alves
0 siblings, 1 reply; 13+ messages in thread
From: Pedro Alves @ 2015-03-23 17:57 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: jan.kratochvil, ktietz, gdb-patches, vinschen, nickc
On 03/23/2015 05:36 PM, Eli Zaretskii wrote:
>> Date: Mon, 23 Mar 2015 17:25:15 +0000
>> From: Pedro Alves <palves@redhat.com>
>> CC: Kai Tietz <ktietz@redhat.com>, gdb-patches@sourceware.org, Corinna Vinschen <vinschen@redhat.com>, Nicholas Clifton <nickc@redhat.com>
>>
>>> With this header file used for GDB's sources aren't gnulib's .c files compiled
>>> with incompatible ABI?
>>
>> Other than rpl_gettimeofday (the gettimeofday replacement):
>>
>> gettimeofday.o:0000005a T _rpl_gettimeofday
>>
>> AFAICS, there's no other use of "struct timeval" or gettimeofday in gnulib's
>> sources.
>
> We should watch out for Gnulib's 'select' and friends, if we ever want
> to import that. Also 'utimens'.
Agreed.
I think it's good to first go with this simple approach to unblock a
gnulib import, and then we can always do some more invasive fix on
top, with no rush.
However, it'd be good if someone could make sure that gdb
still actually works on Windows before pushing to master.
I've pushed a gnulib import to current gnulib git to the
users/palves/gnulib-update branch (on sourceware.org).
Can anyone give it a try on Windows? All I can easily
test is building..
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch 1/2] mingw: update gnulib: prepare the sources
2015-03-23 16:51 ` Pedro Alves
2015-03-23 17:08 ` Jan Kratochvil
@ 2015-03-23 19:17 ` Corinna Vinschen
2015-03-23 19:28 ` Pedro Alves
1 sibling, 1 reply; 13+ messages in thread
From: Corinna Vinschen @ 2015-03-23 19:17 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 578 bytes --]
On Mar 23 16:51, Pedro Alves wrote:
> Hi guys,
>
> We really need to move forward with importing a newer gnulib,
> for several reasons...
I'm not quite sure why I'm CCed on this thread, but please keep in mind
that Cygwin tries hard to be a POSIX platform. Please, don't mix Windows
headers and Windows calls in, unless you really, *really* need them.
Especially don't mix in winsock headers and the definitions of timeval,
they collide with the POSIX definitions in the newlib headers.
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch 1/2] mingw: update gnulib: prepare the sources
2015-03-23 19:17 ` Corinna Vinschen
@ 2015-03-23 19:28 ` Pedro Alves
2015-03-23 19:47 ` Corinna Vinschen
0 siblings, 1 reply; 13+ messages in thread
From: Pedro Alves @ 2015-03-23 19:28 UTC (permalink / raw)
To: gdb-patches
On 03/23/2015 07:17 PM, Corinna Vinschen wrote:
> On Mar 23 16:51, Pedro Alves wrote:
>> Hi guys,
>>
>> We really need to move forward with importing a newer gnulib,
>> for several reasons...
>
> I'm not quite sure why I'm CCed on this thread,
Dunno, I just hit reply to all.
> but please keep in mind
> that Cygwin tries hard to be a POSIX platform. Please, don't mix Windows
> headers and Windows calls in, unless you really, *really* need them.
>
> Especially don't mix in winsock headers and the definitions of timeval,
> they collide with the POSIX definitions in the newlib headers.
Yep, don't worry, that's not being proposed. Even Jan's original patch
limited the windows.h inclusion to mingw. If a gnulib header ends up
pulling windows.h on Cygwin, that'd be a gnulib bug. I think the chances
of that happening without the gnulib folks noticing are quite low
though.
But the best way to make sure is to test the users/palves/gnulib-update branch. :-)
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch 1/2] mingw: update gnulib: prepare the sources
2015-03-23 19:28 ` Pedro Alves
@ 2015-03-23 19:47 ` Corinna Vinschen
0 siblings, 0 replies; 13+ messages in thread
From: Corinna Vinschen @ 2015-03-23 19:47 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1350 bytes --]
On Mar 23 19:28, Pedro Alves wrote:
> On 03/23/2015 07:17 PM, Corinna Vinschen wrote:
> > On Mar 23 16:51, Pedro Alves wrote:
> >> Hi guys,
> >>
> >> We really need to move forward with importing a newer gnulib,
> >> for several reasons...
> >
> > I'm not quite sure why I'm CCed on this thread,
>
> Dunno, I just hit reply to all.
>
> > but please keep in mind
> > that Cygwin tries hard to be a POSIX platform. Please, don't mix Windows
> > headers and Windows calls in, unless you really, *really* need them.
> >
> > Especially don't mix in winsock headers and the definitions of timeval,
> > they collide with the POSIX definitions in the newlib headers.
>
> Yep, don't worry, that's not being proposed. Even Jan's original patch
> limited the windows.h inclusion to mingw. If a gnulib header ends up
> pulling windows.h on Cygwin, that'd be a gnulib bug. I think the chances
> of that happening without the gnulib folks noticing are quite low
> though.
Right. Apart from a few minor glitches in the past, Cygwin is usually
quite well supported by gnulib.
> But the best way to make sure is to test the
> users/palves/gnulib-update branch. :-)
Sigh. I add it to my TODO list... if i can find the end of the list
at all :}
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch 1/2] mingw: update gnulib: prepare the sources
2015-03-23 17:57 ` Pedro Alves
@ 2015-08-24 18:09 ` Pedro Alves
0 siblings, 0 replies; 13+ messages in thread
From: Pedro Alves @ 2015-08-24 18:09 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: jan.kratochvil, ktietz, gdb-patches, vinschen, nickc
On 03/23/2015 05:57 PM, Pedro Alves wrote:
> I think it's good to first go with this simple approach to unblock a
> gnulib import, and then we can always do some more invasive fix on
> top, with no rush.
>
> However, it'd be good if someone could make sure that gdb
> still actually works on Windows before pushing to master.
>
> I've pushed a gnulib import to current gnulib git to the
> users/palves/gnulib-update branch (on sourceware.org).
>
> Can anyone give it a try on Windows? All I can easily
> test is building..
3/4 of a year passed since this process started, and this is
meanwhile blocking even more things. I've now pushed it to master,
after another round of build-testing against mingw-w64.
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2015-08-24 18:09 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-22 22:12 [patch 1/2] mingw: update gnulib: prepare the sources Jan Kratochvil
2014-12-23 11:54 ` Kai Tietz
2014-12-24 22:20 ` Jan Kratochvil
2015-03-23 16:51 ` Pedro Alves
2015-03-23 17:08 ` Jan Kratochvil
2015-03-23 17:25 ` Pedro Alves
2015-03-23 17:32 ` Jan Kratochvil
2015-03-23 17:37 ` Eli Zaretskii
2015-03-23 17:57 ` Pedro Alves
2015-08-24 18:09 ` Pedro Alves
2015-03-23 19:17 ` Corinna Vinschen
2015-03-23 19:28 ` Pedro Alves
2015-03-23 19:47 ` Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox