Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Fred Fish <fnf@intrinsity.com>
To: gdb-patches@sources.redhat.com
Cc: fnf@intrinsity.com
Subject: [RFA] Fix bits/bytes confusion in print_scalar_formatted
Date: Sat, 07 Sep 2002 18:08:00 -0000	[thread overview]
Message-ID: <200209080108.g8818Ni29790@beeville.vert.intrinsity.com> (raw)

I found this when I noticed a mipsisa32-elf toolchain printing
the address of a variable that was supposed to be at 0x8000XXXX
as 0xffffffff8000XXXX.

-Fred


2002-09-07  Fred Fish  <fnf@intrinsity.com>

	* printcmd.c (print_scalar_formatted): "len" is the number of
	target bytes, NOT the number of target bits.

Index: printcmd.c
===================================================================
RCS file: /mips/newtools/fsf/gdb/gdb/printcmd.c,v
retrieving revision 1.1.1.3
diff -c -p -r1.1.1.3 printcmd.c
*** printcmd.c	2002/07/24 15:00:17	1.1.1.3
--- printcmd.c	2002/09/08 00:07:14
*************** print_scalar_formatted (char *valaddr, s
*** 391,400 ****
      val_long = unpack_long (type, valaddr);
  
    /* If the value is a pointer, and pointers and addresses are not the
!      same, then at this point, the value's length is TARGET_ADDR_BIT, not
!      TYPE_LENGTH (type).  */
    if (TYPE_CODE (type) == TYPE_CODE_PTR)
!     len = TARGET_ADDR_BIT;
  
    /* If we are printing it as unsigned, truncate it in case it is actually
       a negative signed value (e.g. "print/u (short)-1" should print 65535
--- 391,400 ----
      val_long = unpack_long (type, valaddr);
  
    /* If the value is a pointer, and pointers and addresses are not the
!      same, then at this point, the value's length (in target bytes) is
!      TARGET_ADDR_BIT/TARGET_CHAR_BIT, not TYPE_LENGTH (type).  */
    if (TYPE_CODE (type) == TYPE_CODE_PTR)
!     len = TARGET_ADDR_BIT / TARGET_CHAR_BIT;
  
    /* If we are printing it as unsigned, truncate it in case it is actually
       a negative signed value (e.g. "print/u (short)-1" should print 65535


             reply	other threads:[~2002-09-08  1:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-07 18:08 Fred Fish [this message]
2002-09-09  9:20 ` Kevin Buettner

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=200209080108.g8818Ni29790@beeville.vert.intrinsity.com \
    --to=fnf@intrinsity.com \
    --cc=gdb-patches@sources.redhat.com \
    /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