This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Fix cygwin32 failure introduced by [patch] windows-nat.c: Fix offset problem in signal string handling
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Pierre Muller <pierre dot muller at ics-cnrs dot unistra dot fr>
- Cc: brobecker at adacore dot com, gdb-patches at sourceware dot org, vinschen at redhat dot com
- Date: Wed, 27 Mar 2013 08:48:42 +0200
- Subject: Re: [RFA] Fix cygwin32 failure introduced by [patch] windows-nat.c: Fix offset problem in signal string handling
- References: <20130319151436 dot GB20727 at calimero dot vinschen dot de> <20130319212554 dot GE4506 at adacore dot com> <000101ce2a6b$8c855a60$a5900f20$%muller at ics-cnrs dot unistra dot fr>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> Cc: "'Corinna Vinschen'" <vinschen@redhat.com>
> Date: Tue, 26 Mar 2013 22:47:43 +0100
>
> make[1]: Leaving directory `/usr/local/src/gdbcvs/build-norm/gdb'
> gcc -gstabs+ -O0 -I. -I../../src/gdb -I../../src/gdb/common
> -I../../src/gdb/config -DLOCALEDIR="\"/usr/local/share/l
> ocale\"" -DHAVE_CONFIG_H -I../../src/gdb/../include/opcode
> -I../../src/gdb/../opcodes/.. -I../../src/gdb/../readline/..
> -I../bfd -I../../src/gdb/../bfd -I../../src/gdb/../include
> -I../libdecnumber -I../../src/gdb/../libdecnumber -I../../
> src/gdb/gnulib/import -Ibuild-gnulib/import -DTUI=1
> -I/usr/include/python2.7 -I/usr/include/python2.7 -Wall -Wdeclara
> tion-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign
> -Wno-unused -Wunused-value -Wunused-function
> -Wno-switch -Wno-char-subscripts -Wmissing-prototypes
> -Wdeclaration-after-statement -Wempty-body -Werror -c -o windows-n
> at.o -MT windows-nat.o -MMD -MP -MF .deps/windows-nat.Tpo
> ../../src/gdb/windows-nat.c
> cc1: warnings being treated as errors
> ../../src/gdb/windows-nat.c: In function 'handle_output_debug_string':
> ../../src/gdb/windows-nat.c:993:18: error: cast to pointer from integer of
> different size
> Makefile:972: recipe for target `windows-nat.o' failed
> make: *** [windows-nat.o] Error 1
> make: Leaving directory `/usr/local/src/gdbcvs/build-norm/gdb'
>
> This failure can be fixed by this simple patch, which should
> not affect the unreleased 64-bit Cygwin, a confirmation
> by Corinna would be nice on this part...
>
>
> ChangeLog entry:
>
> 2013-03-26 Pierre Muller <muller@sourceware.org>
>
> * windows-nat.c (handle_output_debug_string): Avoid typecast
> from integer of different size warning.
>
>
> Index: windows-nat.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/windows-nat.c,v
> retrieving revision 1.245
> diff -u -p -r1.245 windows-nat.c
> --- windows-nat.c 23 Mar 2013 10:48:23 -0000 1.245
> +++ windows-nat.c 26 Mar 2013 21:39:57 -0000
> @@ -990,7 +990,7 @@ handle_output_debug_string (struct targe
> retval = strtoul (p, &p, 0);
> if (!retval)
> retval = main_thread_id;
> - else if ((x = (LPCVOID) strtoull (p, NULL, 0))
> + else if ((x = (LPCVOID) (uintptr_t) strtoull (p, NULL, 0))
> && ReadProcessMemory (current_process_handle, x,
> &saved_context,
> __COPY_CONTEXT_SIZE, &n)
Is the cast to LPCVOID really needed? What if you drop it (and not
add the cast to uintptr_t)?