Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] [7.2] Merge recent win64 breakage fixes from HEAD to 7.2  branch
@ 2010-07-21  9:53 Ozkan Sezer
  2010-07-21 19:01 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Ozkan Sezer @ 2010-07-21  9:53 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey, Pedro Alves, Mike Frysinger

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

Hi!

If there are no objections, I want to apply the attached patch to
the 7.2 branch soon.

-
Merge recent win64 breakage fixes from HEAD to 7.2 branch:

gdb/

	* target.c (debug_to_insert_breakpoint): Instead of casting to unsigned
	long and %ld, use core_addr_to_string() and %s to print CORE_ADDR vars
	and host_address_to_string() and %s for pointers.
	(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): strcpy() the returned string from paddress()
	instead of sprintf().
	* utils.c (paddress): Return phex_nz().

--
Ozkan

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

Index: gdb/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.11973.2.12
diff -u -p -r1.11973.2.12 ChangeLog
--- gdb/ChangeLog	20 Jul 2010 22:22:56 -0000	1.11973.2.12
+++ gdb/ChangeLog	21 Jul 2010 09:45:24 -0000
@@ -1,3 +1,18 @@
+2010-07-21  Ozkan Sezer  <sezeroz@gmail.com>
+
+	* target.c (debug_to_insert_breakpoint): Instead of casting to unsigned
+	long and %ld, use core_addr_to_string() and %s to print CORE_ADDR vars
+	and host_address_to_string() and %s for pointers.
+	(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.
+
 2010-07-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
 	* symfile.c (find_separate_debug_file_by_debuglink): Remove
Index: gdb/target.c
===================================================================
RCS file: /cvs/src/src/gdb/target.c,v
retrieving revision 1.259
diff -u -p -r1.259 target.c
--- gdb/target.c	7 Jul 2010 16:15:17 -0000	1.259
+++ gdb/target.c	21 Jul 2010 09:45:26 -0000
@@ -3270,8 +3270,8 @@ debug_to_insert_breakpoint (struct gdbar
   retval = debug_target.to_insert_breakpoint (gdbarch, bp_tgt);
 
   fprintf_unfiltered (gdb_stdlog,
-		      "target_insert_breakpoint (0x%lx, xxx) = %ld\n",
-		      (unsigned long) bp_tgt->placed_address,
+		      "target_insert_breakpoint (%s, xxx) = %ld\n",
+		      core_addr_to_string (bp_tgt->placed_address),
 		      (unsigned long) retval);
   return retval;
 }
@@ -3285,8 +3285,8 @@ debug_to_remove_breakpoint (struct gdbar
   retval = debug_target.to_remove_breakpoint (gdbarch, bp_tgt);
 
   fprintf_unfiltered (gdb_stdlog,
-		      "target_remove_breakpoint (0x%lx, xxx) = %ld\n",
-		      (unsigned long) bp_tgt->placed_address,
+		      "target_remove_breakpoint (%s, xxx) = %ld\n",
+		      core_addr_to_string (bp_tgt->placed_address),
 		      (unsigned long) retval);
   return retval;
 }
@@ -3315,10 +3315,9 @@ debug_to_region_ok_for_hw_watchpoint (CO
   retval = debug_target.to_region_ok_for_hw_watchpoint (addr, len);
 
   fprintf_unfiltered (gdb_stdlog,
-		      "target_region_ok_for_hw_watchpoint (%ld, %ld) = 0x%lx\n",
-		      (unsigned long) addr,
-		      (unsigned long) len,
-		      (unsigned long) retval);
+		      "target_region_ok_for_hw_watchpoint (%s, %ld) = %s\n",
+		      core_addr_to_string (addr), (unsigned long) len,
+		      core_addr_to_string (retval));
   return retval;
 }
 
@@ -3331,9 +3330,9 @@ debug_to_can_accel_watchpoint_condition 
   retval = debug_target.to_can_accel_watchpoint_condition (addr, len, rw, cond);
 
   fprintf_unfiltered (gdb_stdlog,
-		      "target_can_accel_watchpoint_condition (0x%lx, %d, %d, 0x%lx) = %ld\n",
-		      (unsigned long) addr, len, rw, (unsigned long) cond,
-		      (unsigned long) retval);
+		      "target_can_accel_watchpoint_condition (%s, %d, %d, %s) = %ld\n",
+		      core_addr_to_string (addr), len, rw,
+		      host_address_to_string (cond), (unsigned long) retval);
   return retval;
 }
 
@@ -3358,8 +3357,8 @@ debug_to_stopped_data_address (struct ta
   retval = debug_target.to_stopped_data_address (target, addr);
 
   fprintf_unfiltered (gdb_stdlog,
-		      "target_stopped_data_address ([0x%lx]) = %ld\n",
-		      (unsigned long)*addr,
+		      "target_stopped_data_address ([%s]) = %ld\n",
+		      core_addr_to_string (*addr),
 		      (unsigned long)retval);
   return retval;
 }
@@ -3375,9 +3374,9 @@ debug_to_watchpoint_addr_within_range (s
 							 start, length);
 
   fprintf_filtered (gdb_stdlog,
-		    "target_watchpoint_addr_within_range (0x%lx, 0x%lx, %d) = %d\n",
-		    (unsigned long) addr, (unsigned long) start, length,
-		    retval);
+		    "target_watchpoint_addr_within_range (%s, %s, %d) = %d\n",
+		    core_addr_to_string (addr), core_addr_to_string (start),
+		    length, retval);
   return retval;
 }
 
@@ -3390,8 +3389,8 @@ debug_to_insert_hw_breakpoint (struct gd
   retval = debug_target.to_insert_hw_breakpoint (gdbarch, bp_tgt);
 
   fprintf_unfiltered (gdb_stdlog,
-		      "target_insert_hw_breakpoint (0x%lx, xxx) = %ld\n",
-		      (unsigned long) bp_tgt->placed_address,
+		      "target_insert_hw_breakpoint (%s, xxx) = %ld\n",
+		      core_addr_to_string (bp_tgt->placed_address),
 		      (unsigned long) retval);
   return retval;
 }
@@ -3405,8 +3404,8 @@ debug_to_remove_hw_breakpoint (struct gd
   retval = debug_target.to_remove_hw_breakpoint (gdbarch, bp_tgt);
 
   fprintf_unfiltered (gdb_stdlog,
-		      "target_remove_hw_breakpoint (0x%lx, xxx) = %ld\n",
-		      (unsigned long) bp_tgt->placed_address,
+		      "target_remove_hw_breakpoint (%s, xxx) = %ld\n",
+		      core_addr_to_string (bp_tgt->placed_address),
 		      (unsigned long) retval);
   return retval;
 }
@@ -3420,9 +3419,9 @@ debug_to_insert_watchpoint (CORE_ADDR ad
   retval = debug_target.to_insert_watchpoint (addr, len, type, cond);
 
   fprintf_unfiltered (gdb_stdlog,
-		      "target_insert_watchpoint (0x%lx, %d, %d, 0x%ld) = %ld\n",
-		      (unsigned long) addr, len, type, (unsigned long) cond,
-		      (unsigned long) retval);
+		      "target_insert_watchpoint (%s, %d, %d, %s) = %ld\n",
+		      core_addr_to_string (addr), len, type,
+		      host_address_to_string (cond), (unsigned long) retval);
   return retval;
 }
 
@@ -3435,9 +3434,9 @@ debug_to_remove_watchpoint (CORE_ADDR ad
   retval = debug_target.to_remove_watchpoint (addr, len, type, cond);
 
   fprintf_unfiltered (gdb_stdlog,
-		      "target_remove_watchpoint (0x%lx, %d, %d, 0x%ld) = %ld\n",
-		      (unsigned long) addr, len, type, (unsigned long) cond,
-		      (unsigned long) retval);
+		      "target_remove_watchpoint (%s, %d, %d, %s) = %ld\n",
+		      core_addr_to_string (addr), len, type,
+		      host_address_to_string (cond), (unsigned long) retval);
   return retval;
 }
 
Index: gdb/gdbserver/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/ChangeLog,v
retrieving revision 1.398
diff -u -p -r1.398 ChangeLog
--- gdb/gdbserver/ChangeLog	7 Jul 2010 16:14:04 -0000	1.398
+++ gdb/gdbserver/ChangeLog	21 Jul 2010 09:45:28 -0000
@@ -1,3 +1,9 @@
+2010-07-21  Ozkan Sezer  <sezeroz@gmail.com>
+
+	* server.c (handle_query): strcpy() the returned string from paddress()
+	instead of sprintf().
+	* utils.c (paddress): Return phex_nz().
+
 2010-07-07  Joel Brobecker  <brobecker@adacore.com>
 
 	* server.c (handle_v_cont): Call mourn_inferior if process
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	21 Jul 2010 09:45:29 -0000
@@ -1539,7 +1539,7 @@ handle_query (char *own_buf, int packet_
 
       if (err == 0)
 	{
-	  sprintf (own_buf, "%llx", address);
+	  strcpy (own_buf, paddress(address));
 	  return;
 	}
       else if (err > 0)
@@ -1563,7 +1563,7 @@ handle_query (char *own_buf, int packet_
       n = (*the_target->get_tib_address) (ptid, &tlb);
       if (n == 1)
 	{
-	  sprintf (own_buf, "%llx", tlb);
+	  strcpy (own_buf, paddress(tlb));
 	  return;
 	}
       else if (n == 0)
Index: gdb/gdbserver/utils.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/utils.c,v
retrieving revision 1.23
diff -u -p -r1.23 utils.c
--- gdb/gdbserver/utils.c	1 Jun 2010 13:20:52 -0000	1.23
+++ gdb/gdbserver/utils.c	21 Jul 2010 09:45:29 -0000
@@ -257,17 +257,6 @@ xsnprintf (char *str, size_t size, const
   return ret;
 }
 
-/* Convert a CORE_ADDR into a HEX string, like %lx.
-   The result is stored in a circular static buffer, NUMCELLS deep.  */
-
-char *
-paddress (CORE_ADDR addr)
-{
-  char *str = get_cell ();
-  xsnprintf (str, CELLSIZE, "%lx", (long) addr);
-  return str;
-}
-
 static char *
 decimal2str (char *sign, ULONGEST addr, int width)
 {
@@ -372,3 +361,12 @@ phex_nz (ULONGEST l, int sizeof_l)
 
   return str;
 }
+
+/* Convert a CORE_ADDR into a HEX string, like %lx.
+   The result is stored in a circular static buffer, NUMCELLS deep.  */
+
+char *
+paddress (CORE_ADDR addr)
+{
+  return phex_nz (addr, sizeof (CORE_ADDR));
+}

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

* Re: [PATCH] [7.2] Merge recent win64 breakage fixes from HEAD to 7.2  branch
  2010-07-21  9:53 [PATCH] [7.2] Merge recent win64 breakage fixes from HEAD to 7.2 branch Ozkan Sezer
@ 2010-07-21 19:01 ` Tom Tromey
  2010-07-21 20:01   ` Ozkan Sezer
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2010-07-21 19:01 UTC (permalink / raw)
  To: Ozkan Sezer; +Cc: gdb-patches, Pedro Alves, Mike Frysinger

>>>>> "Ozkan" == Ozkan Sezer <sezeroz@gmail.com> writes:

Ozkan> If there are no objections, I want to apply the attached patch to
Ozkan> the 7.2 branch soon.

This seems fine to me.

Tom


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

* Re: [PATCH] [7.2] Merge recent win64 breakage fixes from HEAD to 7.2  branch
  2010-07-21 19:01 ` Tom Tromey
@ 2010-07-21 20:01   ` Ozkan Sezer
  0 siblings, 0 replies; 3+ messages in thread
From: Ozkan Sezer @ 2010-07-21 20:01 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches, Pedro Alves, Mike Frysinger

On Wed, Jul 21, 2010 at 10:01 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Ozkan" == Ozkan Sezer <sezeroz@gmail.com> writes:
>
> Ozkan> If there are no objections, I want to apply the attached patch to
> Ozkan> the 7.2 branch soon.
>
> This seems fine to me.
>
> Tom
>

Applied, thanks.

--
Ozkan


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-21  9:53 [PATCH] [7.2] Merge recent win64 breakage fixes from HEAD to 7.2 branch Ozkan Sezer
2010-07-21 19:01 ` Tom Tromey
2010-07-21 20:01   ` Ozkan Sezer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox