public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] Don't use sprintf_vma for CORE_ADDR
Date: Sun, 22 Mar 2020 06:02:57 -0400	[thread overview]
Message-ID: <53807e9f3d83bc0f67b9b9471cc60fb37182e5ab@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 53807e9f3d83bc0f67b9b9471cc60fb37182e5ab ***

commit 53807e9f3d83bc0f67b9b9471cc60fb37182e5ab
Author:     Tom Tromey <tom@tromey.com>
AuthorDate: Thu Mar 12 13:32:15 2020 -0600
Commit:     Tom Tromey <tromey@adacore.com>
CommitDate: Thu Mar 12 13:32:15 2020 -0600

    Don't use sprintf_vma for CORE_ADDR
    
    A few spots in gdb use sprintf_vma to print a CORE_ADDR.  This will
    fail on a 32-bit build once CORE_ADDR is always a 64-bit type.
    
    This patch replaces these calls with phex instead.
    
    gdb/ChangeLog
    2020-03-12  Tom Tromey  <tom@tromey.com>
    
            * remote.c (remote_target::download_tracepoint)
            (remote_target::enable_tracepoint)
            (remote_target::disable_tracepoint): Use phex, not sprintf_vma.
            * breakpoint.c (print_recreate_masked_watchpoint): Use phex, not
            sprintf_vma.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3416b41432..8c4487eef9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2020-03-12  Tom Tromey  <tom@tromey.com>
+
+	* remote.c (remote_target::download_tracepoint)
+	(remote_target::enable_tracepoint)
+	(remote_target::disable_tracepoint): Use phex, not sprintf_vma.
+	* breakpoint.c (print_recreate_masked_watchpoint): Use phex, not
+	sprintf_vma.
+
 2020-03-12  Tom Tromey  <tom@tromey.com>
 
 	* symfile-mem.c: Update CORE_ADDR size assert.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 5a9352c26f..e49025461b 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -10400,7 +10400,6 @@ static void
 print_recreate_masked_watchpoint (struct breakpoint *b, struct ui_file *fp)
 {
   struct watchpoint *w = (struct watchpoint *) b;
-  char tmp[40];
 
   switch (b->type)
     {
@@ -10418,8 +10417,8 @@ print_recreate_masked_watchpoint (struct breakpoint *b, struct ui_file *fp)
 		      _("Invalid hardware watchpoint type."));
     }
 
-  sprintf_vma (tmp, w->hw_wp_mask);
-  fprintf_unfiltered (fp, " %s mask 0x%s", w->exp_string, tmp);
+  fprintf_unfiltered (fp, " %s mask 0x%s", w->exp_string,
+		      phex (w->hw_wp_mask, sizeof (CORE_ADDR)));
   print_recreate_thread (b, fp);
 }
 
diff --git a/gdb/remote.c b/gdb/remote.c
index 9b73faf9a3..0f78b1be1b 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -12835,7 +12835,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
   encode_actions_rsp (loc, &tdp_actions, &stepping_actions);
 
   tpaddr = loc->address;
-  sprintf_vma (addrbuf, tpaddr);
+  strcpy (addrbuf, phex (tpaddr, sizeof (CORE_ADDR)));
   ret = snprintf (buf.data (), buf.size (), "QTDP:%x:%s:%c:%lx:%x",
 		  b->number, addrbuf, /* address */
 		  (b->enable_state == bp_enabled ? 'E' : 'D'),
@@ -13097,11 +13097,10 @@ void
 remote_target::enable_tracepoint (struct bp_location *location)
 {
   struct remote_state *rs = get_remote_state ();
-  char addr_buf[40];
 
-  sprintf_vma (addr_buf, location->address);
   xsnprintf (rs->buf.data (), get_remote_packet_size (), "QTEnable:%x:%s",
-	     location->owner->number, addr_buf);
+	     location->owner->number,
+	     phex (location->address, sizeof (CORE_ADDR)));
   putpkt (rs->buf);
   remote_get_noisy_reply ();
   if (rs->buf[0] == '\0')
@@ -13114,11 +13113,10 @@ void
 remote_target::disable_tracepoint (struct bp_location *location)
 {
   struct remote_state *rs = get_remote_state ();
-  char addr_buf[40];
 
-  sprintf_vma (addr_buf, location->address);
   xsnprintf (rs->buf.data (), get_remote_packet_size (), "QTDisable:%x:%s",
-	     location->owner->number, addr_buf);
+	     location->owner->number,
+	     phex (location->address, sizeof (CORE_ADDR)));
   putpkt (rs->buf);
   remote_get_noisy_reply ();
   if (rs->buf[0] == '\0')


             reply	other threads:[~2020-03-22 10:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-22 10:02 gdb-buildbot [this message]
2020-03-22 10:02 ` Failures on Fedora-i686, branch master gdb-buildbot
2020-03-22 10:18 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2020-03-22 10:50 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2020-03-22 11:14 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2020-03-22 11:37 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2020-03-25  1:47 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot
2020-03-25 14:23 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2020-03-25 15:14 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53807e9f3d83bc0f67b9b9471cc60fb37182e5ab@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).