Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Fix bits/bytes confusion in print_scalar_formatted
@ 2002-09-07 18:08 Fred Fish
  2002-09-09  9:20 ` Kevin Buettner
  0 siblings, 1 reply; 2+ messages in thread
From: Fred Fish @ 2002-09-07 18:08 UTC (permalink / raw)
  To: gdb-patches; +Cc: fnf

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


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

end of thread, other threads:[~2002-09-09 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-07 18:08 [RFA] Fix bits/bytes confusion in print_scalar_formatted Fred Fish
2002-09-09  9:20 ` Kevin Buettner

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