This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA] Fix bits/bytes confusion in print_scalar_formatted
- From: Fred Fish <fnf at intrinsity dot com>
- To: gdb-patches at sources dot redhat dot com
- Cc: fnf at intrinsity dot com
- Date: Sat, 7 Sep 2002 20:08:22 -0500 (CDT)
- Subject: [RFA] Fix bits/bytes confusion in print_scalar_formatted
- Reply-to: fnf at intrinsity dot com
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