public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "palves at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/15161] symfile.c:struct load_section_data::load_offset is "unsigned long" but should be wider.
Date: Tue, 19 Feb 2013 21:20:00 -0000	[thread overview]
Message-ID: <bug-15161-4717-hvOBqvseQo@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-15161-4717@http.sourceware.org/bugzilla/>

http://sourceware.org/bugzilla/show_bug.cgi?id=15161

--- Comment #8 from Pedro Alves <palves at redhat dot com> 2013-02-19 21:20:08 UTC ---
Alright, I almost committed a patch for that, but I noticed that
the "final" local seen on the patch is an "int", and following that
local's usage we see lots of 32-bit assumption.  So I'll just leave
the code as is.

commit 023172580ad3b79cec08ee48fa422ba4cbbcfaa5
Author: Pedro Alves <palves@redhat.com>
Date:   Tue Feb 19 20:59:31 2013 +0000

    Another bit of gdb/15161 - remote-mips.c

    This printf truncates vma's to 32-bit.  I don't know if this is used or
reacheable
    with MIPS64 at all, but as long as I noticed it, better make it follow
    gdb's conventions.

    Actually, the existing code looks weirdly buggy.  "0x%4x" results in
printing things like

     "filename<tab>: 0x   1 .. 0x   2  "

    It must be that "0x%04x" was meant, so we'd get instead:

     "filename<tab>: 0x0001 .. 0x0002  "

    phex does that.

    Tested by building with --enable-targets=all.

    2013-02-19  Pedro Alves  <palves@redhat.com>

        * remote-mips.c (pmon_load_fast): Use phex with target's address
        width instead of "0x%4x" format for printing addresses.

diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index e20a740..8457890 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -3373,6 +3373,7 @@ pmon_load_fast (char *file)
   int final = 0;
   int finished = 0;
   struct cleanup *cleanup;
+  int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;

   buffer = (char *) xmalloc (MAXRECSIZE + 1);
   binbuf = (unsigned char *) xmalloc (BINCHUNK);
@@ -3413,9 +3414,10 @@ pmon_load_fast (char *file)
     bintotal += bfd_get_section_size (s);
     final = (s->vma + bfd_get_section_size (s));

-    printf_filtered ("%s\t: 0x%4x .. 0x%4x  ", s->name,
-             (unsigned int) s->vma,
-             (unsigned int) (s->vma + bfd_get_section_size (s)));
+    printf_filtered ("%s\t: 0x%s .. 0x%s  ", s->name,
+             phex (s->vma, addr_size),
+             phex (s->vma + bfd_get_section_size (s), addr_size));
+
     gdb_flush (gdb_stdout);

     /* Output the starting address.  */

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


  parent reply	other threads:[~2013-02-19 21:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-19 15:22 [Bug gdb/15161] New: " palves at redhat dot com
2013-02-19 16:19 ` [Bug gdb/15161] " palves at redhat dot com
2013-02-19 18:32 ` cvs-commit at gcc dot gnu.org
2013-02-19 19:27 ` cvs-commit at gcc dot gnu.org
2013-02-19 20:53 ` cvs-commit at gcc dot gnu.org
2013-02-19 20:57 ` palves at redhat dot com
2013-02-19 20:59 ` palves at redhat dot com
2013-02-19 21:11 ` palves at redhat dot com
2013-02-19 21:20 ` palves at redhat dot com [this message]
2013-02-19 21:21 ` palves at redhat dot com

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=bug-15161-4717-hvOBqvseQo@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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).