public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [Windows] fix format string for 64 bit var in gdbserver
@ 2010-07-16 20:10 Ozkan Sezer
  2010-07-17  9:40 ` Mike Frysinger
  0 siblings, 1 reply; 13+ messages in thread
From: Ozkan Sezer @ 2010-07-16 20:10 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

[-- Attachment #1: Type: text/plain, Size: 813 bytes --]

Hi!

For windows targets, (x86_64-w64-mingw32, i686-w64-mingw32)
gcc complains:

../../../gdb-cvs/gdb/gdbserver/server.c: In function 'handle_query':
../../../gdb-cvs/gdb/gdbserver/server.c:1542: warning: unknown
conversion type character 'l' in format
../../../gdb-cvs/gdb/gdbserver/server.c:1542: warning: too many
arguments for format
../../../gdb-cvs/gdb/gdbserver/server.c:1566: warning: unknown
conversion type character 'l' in format
../../../gdb-cvs/gdb/gdbserver/server.c:1566: warning: too many
arguments for format

This is due to the fact that MS printf doesn't support %lld, it uses
its own %I64d which gcc already knows about. The attached patch
changes that. OK for apply?

gdb/gdbserver/

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

--
Ozkan

[-- Attachment #2: g2.diff --]
[-- Type: application/octet-stream, Size: 957 bytes --]

gdb/gdbserver/

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

Index: gdb/gdbserver/server.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/server.c,v
retrieving revision 1.125
diff -u -p -r1.125 server.c
--- gdb/gdbserver/server.c	7 Jul 2010 16:14:04 -0000	1.125
+++ gdb/gdbserver/server.c	16 Jul 2010 20:05:51 -0000
@@ -1539,7 +1539,11 @@ handle_query (char *own_buf, int packet_
 
       if (err == 0)
 	{
+#ifdef _WIN32
+	  sprintf (own_buf, "%I64d", address);
+#else
 	  sprintf (own_buf, "%llx", address);
+#endif
 	  return;
 	}
       else if (err > 0)
@@ -1563,7 +1567,11 @@ handle_query (char *own_buf, int packet_
       n = (*the_target->get_tib_address) (ptid, &tlb);
       if (n == 1)
 	{
+#ifdef _WIN32
+	  sprintf (own_buf, "%I64d", tlb);
+#else
 	  sprintf (own_buf, "%llx", tlb);
+#endif
 	  return;
 	}
       else if (n == 0)

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-07-20 18:20 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-16 20:10 [PATCH] [Windows] fix format string for 64 bit var in gdbserver Ozkan Sezer
2010-07-17  9:40 ` Mike Frysinger
2010-07-17  9:42   ` Ozkan Sezer
2010-07-17  9:53     ` Ozkan Sezer
2010-07-17 18:50       ` Mike Frysinger
2010-07-17 18:59         ` Ozkan Sezer
2010-07-17 19:19           ` Mike Frysinger
2010-07-17 19:23             ` Ozkan Sezer
2010-07-17 21:01           ` Andreas Schwab
2010-07-17 21:05             ` Ozkan Sezer
2010-07-20 18:20               ` Ozkan Sezer
2010-07-17 12:29   ` Mark Kettenis
2010-07-17 18:49     ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).