Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Stan Shebs <stanshebs@earthlink.net>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix build on sparc (remote.c/tracepoints)
Date: Sun, 27 Nov 2011 17:44:00 -0000	[thread overview]
Message-ID: <20111127174403.GC24943@adacore.com> (raw)
In-Reply-To: <4ED17954.7070602@earthlink.net>

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

> Heh, I sit down from around-the-house tasks thinking to commit my
> fix, and Joel has it in hand already!  There is one tweak I would
> suggest:
> 
> -	  sprintf_vma (addrbuf, loc->address);
> -	  sprintf (rs->buf, "qTP:%x:%s", tp->number_on_target, addrbuf);
> +	  sprintf (rs->buf, "qTP:%x:%s", tp->number_on_target,
> +		   phex_nz (loc->address,
> +			    gdbarch_addr_bit (target_gdbarch) / 8));
> 
> 
> Just use phex_nz (loc->address, 0) here, its builtin sizeof
> calculation should be satisfactory.

Hmm, yes, you're right. Thanks for the review.

This is the patch that I just checked in.

-- 
Joel

[-- Attachment #2: remote.c.diff --]
[-- Type: text/x-diff, Size: 2281 bytes --]

commit d39c89d92ee7ed6afbf9f11398a566836e52bb17
Author: Joel Brobecker <brobecker@adacore.com>
Date:   Sun Nov 27 09:35:17 2011 -0800

    remove use of sprintf_vma in remote_get_tracepoint_status
    
    This function takes a VMA and was forcing us to perform a cast to
    compile without warning on one platform. Except that the cast caused
    a warning on sparc-solaris.  This patch fixes the problem by using
    phex_nz instead.
    
    gdb/ChangeLog:
    
            * remote.c (remote_get_tracepoint_status): Delete addrbuf
            local variable.  Avoid use of sprintf_vma.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6fe2a5c..d6551d6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-27  Joel Brobecker  <brobecker@acacore.com>
+
+	* remote.c (remote_get_tracepoint_status): Delete addrbuf
+	local variable.  Avoid use of sprintf_vma.
+
 2011-11-27  Sanjoy Das  <sdas@igalia.com>
 
 	Fix regression in jit.exp.
diff --git a/gdb/remote.c b/gdb/remote.c
index 8fa5c1a..6e37f69 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -10219,7 +10219,6 @@ remote_get_tracepoint_status (struct breakpoint *bp,
 			      struct uploaded_tp *utp)
 {
   struct remote_state *rs = get_remote_state ();
-  char addrbuf[40];
   char *reply;
   struct bp_location *loc;
   struct tracepoint *tp = (struct tracepoint *) bp;
@@ -10234,8 +10233,8 @@ remote_get_tracepoint_status (struct breakpoint *bp,
 	     any status.  */
 	  if (tp->number_on_target == 0)
 	    continue;
-	  sprintf_vma (addrbuf, loc->address);
-	  sprintf (rs->buf, "qTP:%x:%s", tp->number_on_target, addrbuf);
+	  sprintf (rs->buf, "qTP:%x:%s", tp->number_on_target,
+		   phex_nz (loc->address, 0));
 	  putpkt (rs->buf);
 	  reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
 	  if (reply && *reply)
@@ -10249,8 +10248,7 @@ remote_get_tracepoint_status (struct breakpoint *bp,
     {
       utp->hit_count = 0;
       utp->traceframe_usage = 0;
-      sprintf_vma (addrbuf, (long unsigned int) utp->addr);
-      sprintf (rs->buf, "qTP:%x:%s", utp->number, addrbuf);
+      sprintf (rs->buf, "qTP:%x:%s", utp->number, phex_nz (utp->addr, 0));
       putpkt (rs->buf);
       reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
       if (reply && *reply)

  reply	other threads:[~2011-11-27 17:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-26 19:39 [PATCH] Fix build on sparc David Miller
2011-11-26 20:14 ` [PATCH] Fix build on sparc (remote.c/tracepoints) Joel Brobecker
2011-11-26 20:32   ` David Miller
2011-11-26 20:51   ` Joel Brobecker
2011-11-26 23:42     ` Stan Shebs
2011-11-27 17:44       ` Joel Brobecker [this message]
2011-11-26 20:48 ` [PATCH] Fix build on sparc Jan Kratochvil

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=20111127174403.GC24943@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=stanshebs@earthlink.net \
    /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