* [patch] windows-nat.c: Fix offset problem in signal string handling
@ 2013-03-19 16:24 Corinna Vinschen
2013-03-20 2:25 ` Joel Brobecker
0 siblings, 1 reply; 17+ messages in thread
From: Corinna Vinschen @ 2013-03-19 16:24 UTC (permalink / raw)
To: gdb-patches
Hi,
another problem I found when trying the Cygwin signal handling on 64 bit
is that the address string of the context information can't be fetched,
because the pointer `p' points to the space in front of the address
string, but string_to_core_addr doesn't handle leading spaces.
The easiest way to fix this is to change the call to string_to_core_addr(p)
in handle_output_debug_string to `string_to_core_addr (p + 1)'.
Alternatively the call to string_to_core_addr could be replaced with a
call to `strtoull (p, NULL, 0)'. Since this code is only supported on
Cygwin, it's safe to assume that the strtoull function exists.
So I have two variations of the patch, I apply whatever you think is best.
Thanks,
Corinna
Version 1:
* windows-nat.c (handle_output_debug_string): Fix offset in
call to string_to_core_addr.
Index: windows-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/windows-nat.c,v
retrieving revision 1.242
diff -u -p -r1.242 windows-nat.c
--- windows-nat.c 19 Mar 2013 15:06:26 -0000 1.242
+++ windows-nat.c 19 Mar 2013 15:11:55 -0000
@@ -978,7 +978,7 @@ handle_output_debug_string (struct targe
retval = strtoul (p, &p, 0);
if (!retval)
retval = main_thread_id;
- else if ((x = (LPCVOID) string_to_core_addr (p))
+ else if ((x = (LPCVOID) string_to_core_addr (p + 1))
&& ReadProcessMemory (current_process_handle, x,
&saved_context,
__COPY_CONTEXT_SIZE, &n)
Version 2:
* windows-nat.c (handle_output_debug_string): Replace call
to string_to_core_addr with call to strtoull.
Index: windows-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/windows-nat.c,v
retrieving revision 1.242
diff -u -p -r1.242 windows-nat.c
--- windows-nat.c 19 Mar 2013 15:06:26 -0000 1.242
+++ windows-nat.c 19 Mar 2013 15:13:10 -0000
@@ -978,7 +978,7 @@ handle_output_debug_string (struct targe
retval = strtoul (p, &p, 0);
if (!retval)
retval = main_thread_id;
- else if ((x = (LPCVOID) string_to_core_addr (p))
+ else if ((x = (LPCVOID) strtoull (p, NULL, 0))
&& ReadProcessMemory (current_process_handle, x,
&saved_context,
__COPY_CONTEXT_SIZE, &n)
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] windows-nat.c: Fix offset problem in signal string handling
2013-03-19 16:24 [patch] windows-nat.c: Fix offset problem in signal string handling Corinna Vinschen
@ 2013-03-20 2:25 ` Joel Brobecker
2013-03-20 9:36 ` Corinna Vinschen
` (2 more replies)
0 siblings, 3 replies; 17+ messages in thread
From: Joel Brobecker @ 2013-03-20 2:25 UTC (permalink / raw)
To: gdb-patches
> Alternatively the call to string_to_core_addr could be replaced with a
> call to `strtoull (p, NULL, 0)'. Since this code is only supported on
> Cygwin, it's safe to assume that the strtoull function exists.
I would go for that option, mostly because you already use strtol
to parse the beginning of that string...
> Version 2:
>
> * windows-nat.c (handle_output_debug_string): Replace call
> to string_to_core_addr with call to strtoull.
>
> Index: windows-nat.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/windows-nat.c,v
> retrieving revision 1.242
> diff -u -p -r1.242 windows-nat.c
> --- windows-nat.c 19 Mar 2013 15:06:26 -0000 1.242
> +++ windows-nat.c 19 Mar 2013 15:13:10 -0000
> @@ -978,7 +978,7 @@ handle_output_debug_string (struct targe
> retval = strtoul (p, &p, 0);
> if (!retval)
> retval = main_thread_id;
> - else if ((x = (LPCVOID) string_to_core_addr (p))
> + else if ((x = (LPCVOID) strtoull (p, NULL, 0))
> && ReadProcessMemory (current_process_handle, x,
> &saved_context,
> __COPY_CONTEXT_SIZE, &n)
--
Joel
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [patch] windows-nat.c: Fix offset problem in signal string handling
2013-03-20 2:25 ` Joel Brobecker
@ 2013-03-20 9:36 ` Corinna Vinschen
2013-03-27 4:59 ` [RFA] Fix cygwin32 failure introduced by " Pierre Muller
[not found] ` <000101ce2a6b$8c855a60$a5900f20$%muller@ics-cnrs.unistra.fr>
2 siblings, 0 replies; 17+ messages in thread
From: Corinna Vinschen @ 2013-03-20 9:36 UTC (permalink / raw)
To: gdb-patches
On Mar 19 14:25, Joel Brobecker wrote:
> > Alternatively the call to string_to_core_addr could be replaced with a
> > call to `strtoull (p, NULL, 0)'. Since this code is only supported on
> > Cygwin, it's safe to assume that the strtoull function exists.
>
> I would go for that option, mostly because you already use strtol
> to parse the beginning of that string...
>
> > Version 2:
> >
> > * windows-nat.c (handle_output_debug_string): Replace call
> > to string_to_core_addr with call to strtoull.
Thanks, applied.
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
^ permalink raw reply [flat|nested] 17+ messages in thread* [RFA] Fix cygwin32 failure introduced by [patch] windows-nat.c: Fix offset problem in signal string handling
2013-03-20 2:25 ` Joel Brobecker
2013-03-20 9:36 ` Corinna Vinschen
@ 2013-03-27 4:59 ` Pierre Muller
2013-03-27 7:53 ` Joel Brobecker
[not found] ` <000101ce2a6b$8c855a60$a5900f20$%muller@ics-cnrs.unistra.fr>
2 siblings, 1 reply; 17+ messages in thread
From: Pierre Muller @ 2013-03-27 4:59 UTC (permalink / raw)
To: 'Joel Brobecker', gdb-patches; +Cc: 'Corinna Vinschen'
Hi all,
I get a failure for 32bit cygwin native GDB:
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)
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [RFA] Fix cygwin32 failure introduced by [patch] windows-nat.c: Fix offset problem in signal string handling
2013-03-27 4:59 ` [RFA] Fix cygwin32 failure introduced by " Pierre Muller
@ 2013-03-27 7:53 ` Joel Brobecker
2013-03-27 10:47 ` Corinna Vinschen
0 siblings, 1 reply; 17+ messages in thread
From: Joel Brobecker @ 2013-03-27 7:53 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches, 'Corinna Vinschen'
> 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.
This looks about right to me. Let's wait for Corinna to confirm
that it's OK with her too and commit.
> 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)
>
>
--
Joel
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFA] Fix cygwin32 failure introduced by [patch] windows-nat.c: Fix offset problem in signal string handling
2013-03-27 7:53 ` Joel Brobecker
@ 2013-03-27 10:47 ` Corinna Vinschen
2013-03-27 11:13 ` Pierre Muller
0 siblings, 1 reply; 17+ messages in thread
From: Corinna Vinschen @ 2013-03-27 10:47 UTC (permalink / raw)
To: gdb-patches
On Mar 26 16:43, Joel Brobecker wrote:
> > 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.
>
> This looks about right to me. Let's wait for Corinna to confirm
> that it's OK with her too and commit.
Yes, that looks good to me. Thanks for fixing this for 32 bit.
Please apply.
> > 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)
> >
> >
>
> --
> Joel
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
^ permalink raw reply [flat|nested] 17+ messages in thread
* RE: [RFA] Fix cygwin32 failure introduced by [patch] windows-nat.c: Fix offset problem in signal string handling
2013-03-27 10:47 ` Corinna Vinschen
@ 2013-03-27 11:13 ` Pierre Muller
0 siblings, 0 replies; 17+ messages in thread
From: Pierre Muller @ 2013-03-27 11:13 UTC (permalink / raw)
To: gdb-patches
> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Corinna Vinschen
> Envoyé : mercredi 27 mars 2013 09:47
> À : gdb-patches@sourceware.org
> Objet : Re: [RFA] Fix cygwin32 failure introduced by [patch] windows-nat.c:
> Fix offset problem in signal string handling
>
> On Mar 26 16:43, Joel Brobecker wrote:
> > > 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.
> >
> > This looks about right to me. Let's wait for Corinna to confirm
> > that it's OK with her too and commit.
>
> Yes, that looks good to me. Thanks for fixing this for 32 bit.
> Please apply.
Thank you, patch applied to main.
Pierre Muller
^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <000101ce2a6b$8c855a60$a5900f20$%muller@ics-cnrs.unistra.fr>]
* Re: [RFA] Fix cygwin32 failure introduced by [patch] windows-nat.c: Fix offset problem in signal string handling
[not found] ` <000101ce2a6b$8c855a60$a5900f20$%muller@ics-cnrs.unistra.fr>
@ 2013-03-27 10:02 ` Eli Zaretskii
2013-03-27 10:53 ` Corinna Vinschen
` (2 more replies)
0 siblings, 3 replies; 17+ messages in thread
From: Eli Zaretskii @ 2013-03-27 10:02 UTC (permalink / raw)
To: Pierre Muller; +Cc: brobecker, gdb-patches, vinschen
> 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)?
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [RFA] Fix cygwin32 failure introduced by [patch] windows-nat.c: Fix offset problem in signal string handling
2013-03-27 10:02 ` Eli Zaretskii
@ 2013-03-27 10:53 ` Corinna Vinschen
2013-03-27 10:59 ` Pierre Muller
[not found] ` <005501ce2ac8$ae830150$0b8903f0$%muller@ics-cnrs.unistra.fr>
2 siblings, 0 replies; 17+ messages in thread
From: Corinna Vinschen @ 2013-03-27 10:53 UTC (permalink / raw)
To: gdb-patches
On Mar 27 08:48, Eli Zaretskii wrote:
> > From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> > 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)?
x is a pointer, so it's 4 byte on 32 bit and 8 byte on 64 bit. If you
drop the casts, you get the warning in the 32 bit case again.
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
^ permalink raw reply [flat|nested] 17+ messages in thread* RE: [RFA] Fix cygwin32 failure introduced by [patch] windows-nat.c: Fix offset problem in signal string handling
2013-03-27 10:02 ` Eli Zaretskii
2013-03-27 10:53 ` Corinna Vinschen
@ 2013-03-27 10:59 ` Pierre Muller
[not found] ` <005501ce2ac8$ae830150$0b8903f0$%muller@ics-cnrs.unistra.fr>
2 siblings, 0 replies; 17+ messages in thread
From: Pierre Muller @ 2013-03-27 10:59 UTC (permalink / raw)
To: 'Eli Zaretskii'; +Cc: brobecker, gdb-patches, vinschen
Hi Eli,
> > 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)?
Without any cast, I get this warning:
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:16: erreur: assignment makes pointer from
integer without a cast
Makefile:972: recipe for target `windows-nat.o' failed
make: *** [windows-nat.o] Error 1
Thus, I will commit the patch I proposed as Corinna already approved it.
Pierre Muller
^ permalink raw reply [flat|nested] 17+ messages in thread[parent not found: <005501ce2ac8$ae830150$0b8903f0$%muller@ics-cnrs.unistra.fr>]
* Re: [RFA] Fix cygwin32 failure introduced by [patch] windows-nat.c: Fix offset problem in signal string handling
[not found] ` <005501ce2ac8$ae830150$0b8903f0$%muller@ics-cnrs.unistra.fr>
@ 2013-03-27 12:24 ` Eli Zaretskii
2013-03-27 14:39 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 17+ messages in thread
From: Eli Zaretskii @ 2013-03-27 12:24 UTC (permalink / raw)
To: Pierre Muller; +Cc: brobecker, gdb-patches, vinschen
> From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> Cc: <brobecker@adacore.com>, <gdb-patches@sourceware.org>, <vinschen@redhat.com>
> Date: Wed, 27 Mar 2013 09:54:23 +0100
>
> ../../src/gdb/windows-nat.c: In function 'handle_output_debug_string':
> ../../src/gdb/windows-nat.c:993:16: erreur: assignment makes pointer from integer without a cast
Right. But IMO the casts here are dubious to begin with. strtoull
produces a 64-bit value; casting it to a 32-bit uintptr_t might shut
up the compiler, but it doesn't solve the fundamental problem, which
is that a 64-bit value is being stuffed into a 32-bit wide pointer.
A cleaner way would be something like
sscanf (p, "%p", &x);
If that doesn't satisfy the compiler, either, then the following code,
which explicitly resets should be better than the double casts, IMO:
unsigned long xul;
...
xul = strtoull (p, NULL, 0) & ~((DWORD_PTR)0);
x = (LPCVOID) xul;
P.S. Yes, I hate casts, because they tend to conceal subtle bugs.
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [RFA] Fix cygwin32 failure introduced by [patch] windows-nat.c: Fix offset problem in signal string handling
2013-03-27 12:24 ` Eli Zaretskii
@ 2013-03-27 14:39 ` Eli Zaretskii
2013-03-27 14:50 ` Eli Zaretskii
2013-03-27 15:23 ` Corinna Vinschen
2 siblings, 0 replies; 17+ messages in thread
From: Eli Zaretskii @ 2013-03-27 14:39 UTC (permalink / raw)
To: pierre.muller, brobecker, gdb-patches, vinschen
> Date: Wed, 27 Mar 2013 12:46:45 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: brobecker@adacore.com, gdb-patches@sourceware.org, vinschen@redhat.com
>
> If that doesn't satisfy the compiler, either, then the following code,
> which explicitly resets should be better than the double casts, IMO:
^^^^^^
"resets the extra bits" was the intent.
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [RFA] Fix cygwin32 failure introduced by [patch] windows-nat.c: Fix offset problem in signal string handling
2013-03-27 12:24 ` Eli Zaretskii
2013-03-27 14:39 ` Eli Zaretskii
@ 2013-03-27 14:50 ` Eli Zaretskii
2013-03-27 15:23 ` Corinna Vinschen
2 siblings, 0 replies; 17+ messages in thread
From: Eli Zaretskii @ 2013-03-27 14:50 UTC (permalink / raw)
To: pierre.muller, brobecker, gdb-patches, vinschen
> Date: Wed, 27 Mar 2013 12:46:45 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: brobecker@adacore.com, gdb-patches@sourceware.org, vinschen@redhat.com
>
> unsigned long xul;
> ...
> xul = strtoull (p, NULL, 0) & ~((DWORD_PTR)0);
> x = (LPCVOID) xul;
Sorry, one more gotcha: the first line should say this:
DWORD_PTR xul;
(You could also use uintptr_t instead of DWORD_PTR in both places, but
I prefer not to mix Windows data types with standard ones.)
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFA] Fix cygwin32 failure introduced by [patch] windows-nat.c: Fix offset problem in signal string handling
2013-03-27 12:24 ` Eli Zaretskii
2013-03-27 14:39 ` Eli Zaretskii
2013-03-27 14:50 ` Eli Zaretskii
@ 2013-03-27 15:23 ` Corinna Vinschen
2013-03-27 16:06 ` Eli Zaretskii
2 siblings, 1 reply; 17+ messages in thread
From: Corinna Vinschen @ 2013-03-27 15:23 UTC (permalink / raw)
To: gdb-patches
On Mar 27 12:46, Eli Zaretskii wrote:
> > From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> > Cc: <brobecker@adacore.com>, <gdb-patches@sourceware.org>, <vinschen@redhat.com>
> > Date: Wed, 27 Mar 2013 09:54:23 +0100
> >
> > ../../src/gdb/windows-nat.c: In function 'handle_output_debug_string':
> > ../../src/gdb/windows-nat.c:993:16: erreur: assignment makes pointer from integer without a cast
>
> Right. But IMO the casts here are dubious to begin with. strtoull
> produces a 64-bit value; casting it to a 32-bit uintptr_t might shut
This is really no problem. We know what value comes out of Cygwin.
It's a 32 bit pointer value on 32 bit and a 64 bit value on 64 bit,
so the cast is always right.
Please stop CCing me. I'm subscribed on the list and really don't
need the extra mail in my personal inbox. Thank you.
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFA] Fix cygwin32 failure introduced by [patch] windows-nat.c: Fix offset problem in signal string handling
2013-03-27 15:23 ` Corinna Vinschen
@ 2013-03-27 16:06 ` Eli Zaretskii
2013-03-27 16:45 ` Corinna Vinschen
0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2013-03-27 16:06 UTC (permalink / raw)
To: gdb-patches
> Date: Wed, 27 Mar 2013 12:13:01 +0100
> From: Corinna Vinschen <vinschen@redhat.com>
>
> > > ../../src/gdb/windows-nat.c: In function 'handle_output_debug_string':
> > > ../../src/gdb/windows-nat.c:993:16: erreur: assignment makes pointer from integer without a cast
> >
> > Right. But IMO the casts here are dubious to begin with. strtoull
> > produces a 64-bit value; casting it to a 32-bit uintptr_t might shut
>
> This is really no problem. We know what value comes out of Cygwin.
> It's a 32 bit pointer value on 32 bit and a 64 bit value on 64 bit,
> so the cast is always right.
It may be right, but clean it isn't. I guess we will have to
disagree.
> Please stop CCing me.
It's not me, it's the "reply" function of my mailer. If you don't
want to get a copy, please set up your mail headers to cause that.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFA] Fix cygwin32 failure introduced by [patch] windows-nat.c: Fix offset problem in signal string handling
2013-03-27 16:06 ` Eli Zaretskii
@ 2013-03-27 16:45 ` Corinna Vinschen
2013-03-27 16:58 ` Eli Zaretskii
0 siblings, 1 reply; 17+ messages in thread
From: Corinna Vinschen @ 2013-03-27 16:45 UTC (permalink / raw)
To: gdb-patches
On Mar 27 13:22, Eli Zaretskii wrote:
> > Date: Wed, 27 Mar 2013 12:13:01 +0100
> > From: Corinna Vinschen <vinschen@redhat.com>
> >
> > > > ../../src/gdb/windows-nat.c: In function 'handle_output_debug_string':
> > > > ../../src/gdb/windows-nat.c:993:16: erreur: assignment makes pointer from integer without a cast
> > >
> > > Right. But IMO the casts here are dubious to begin with. strtoull
> > > produces a 64-bit value; casting it to a 32-bit uintptr_t might shut
> >
> > This is really no problem. We know what value comes out of Cygwin.
> > It's a 32 bit pointer value on 32 bit and a 64 bit value on 64 bit,
> > so the cast is always right.
>
> It may be right, but clean it isn't. I guess we will have to
> disagree.
>
> > Please stop CCing me.
>
> It's not me, it's the "reply" function of my mailer. If you don't
> want to get a copy, please set up your mail headers to cause that.
I do. I always set a Reply-To. There's also a "Reply to mailing list"
function in some MUAs.
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFA] Fix cygwin32 failure introduced by [patch] windows-nat.c: Fix offset problem in signal string handling
2013-03-27 16:45 ` Corinna Vinschen
@ 2013-03-27 16:58 ` Eli Zaretskii
0 siblings, 0 replies; 17+ messages in thread
From: Eli Zaretskii @ 2013-03-27 16:58 UTC (permalink / raw)
To: gdb-patches
> Date: Wed, 27 Mar 2013 12:27:52 +0100
> From: Corinna Vinschen <vinschen@redhat.com>
>
> > > Please stop CCing me.
> >
> > It's not me, it's the "reply" function of my mailer. If you don't
> > want to get a copy, please set up your mail headers to cause that.
>
> I do. I always set a Reply-To.
And indeed when I reply to you, the response goes only to the list.
The messages that were also copied to you were from Pierre, not from
you. I cannot do anything about that, sorry. There could be an
option in the list server not to send you copies.
> There's also a "Reply to mailing list" function in some MUAs.
Not in mine, sorry.
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2013-03-27 11:52 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-19 16:24 [patch] windows-nat.c: Fix offset problem in signal string handling Corinna Vinschen
2013-03-20 2:25 ` Joel Brobecker
2013-03-20 9:36 ` Corinna Vinschen
2013-03-27 4:59 ` [RFA] Fix cygwin32 failure introduced by " Pierre Muller
2013-03-27 7:53 ` Joel Brobecker
2013-03-27 10:47 ` Corinna Vinschen
2013-03-27 11:13 ` Pierre Muller
[not found] ` <000101ce2a6b$8c855a60$a5900f20$%muller@ics-cnrs.unistra.fr>
2013-03-27 10:02 ` Eli Zaretskii
2013-03-27 10:53 ` Corinna Vinschen
2013-03-27 10:59 ` Pierre Muller
[not found] ` <005501ce2ac8$ae830150$0b8903f0$%muller@ics-cnrs.unistra.fr>
2013-03-27 12:24 ` Eli Zaretskii
2013-03-27 14:39 ` Eli Zaretskii
2013-03-27 14:50 ` Eli Zaretskii
2013-03-27 15:23 ` Corinna Vinschen
2013-03-27 16:06 ` Eli Zaretskii
2013-03-27 16:45 ` Corinna Vinschen
2013-03-27 16:58 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox