This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] fix build failure for win64, revise some format strings


On Fri, Jul 16, 2010 at 6:35 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Ozkan" == Ozkan Sezer <sezeroz@gmail.com> writes:
>
> Ozkan> PING
> Ozkan> Can someone please review this patch? (Win64 fails to build for a week.)
>
> Sorry about that. ?I was hoping someone else would do this ;-)
>
> Thanks for pinging.
>

Thanks for the suggestion, seems like an easier way, indeed.

> I think it would be better to change those places to use
> host_address_to_string. ?E.g., change from:
>
> ?fprintf_unfiltered (gdb_stdlog,
> ? ? ? ? ? ? ? ? ? ? ?"target_insert_breakpoint (0x%lx, xxx) = %ld\n",
> ? ? ? ? ? ? ? ? ? ? ?(unsigned long) bp_tgt->placed_address,
> ? ? ? ? ? ? ? ? ? ? ?(unsigned long) retval);
>
> to
>
> ?fprintf_unfiltered (gdb_stdlog,
> ? ? ? ? ? ? ? ? ? ? ?"target_insert_breakpoint (%s, xxx) = %ld\n",
> ? ? ? ? ? ? ? ? ? ? ?host_address_to_string (bp_tgt->placed_address),
> ? ? ? ? ? ? ? ? ? ? ?(unsigned long) retval);
>
>
> This lets us avoid dealing with the gnulib changes, etc.
>
> Tom
>

I cooked the attached patch. Tested by compiling for win64
(--host=x86_64-w64-mingw32 --disable-nls --disable-multilib),
for i686-linux (--disable-nls --disable-multilib) and for win32
(--host=i686-w64-mingw32 --disable-nls --disable-multilib).

OK for apply?

gdb/

	* target.c (debug_to_insert_breakpoint): For printing pointer-wide
	(address) variables, use host_address_to_string() and %s instead of
	casting to unsigned long and %ld.
	(debug_to_remove_breakpoint): Likewise.
	(debug_to_region_ok_for_hw_watchpoint): Likewise.
	(debug_to_can_accel_watchpoint_condition): Likewise.
	(debug_to_stopped_data_address): Likewise.
	(debug_to_watchpoint_addr_within_range): Likewise.
	(debug_to_insert_hw_breakpoint): Likewise.
	(debug_to_remove_hw_breakpoint): Likewise.
	(debug_to_insert_watchpoint): Likewise.
	(debug_to_remove_watchpoint): Likewise.

gdb/gdbserver/

	* server.c (handle_query): For windows, Use %I64d instead of
	%lld in the sprintf format string.


(Note: debug_to_region_ok_for_hw_watchpoint() specifically
did not use 0x%lx but only %ld for the addr value.  Should I
not care, or should I change my patch to use
host_address_to_string ((void *) addr) + 2
... to skip the "0x" instead?

--
Ozkan

Attachment: g1.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]