From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21688 invoked by alias); 8 Sep 2002 01:08:59 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 21539 invoked from network); 8 Sep 2002 01:08:57 -0000 Received: from unknown (HELO mailhost.intrinsity.com) (208.246.32.130) by sources.redhat.com with SMTP; 8 Sep 2002 01:08:57 -0000 Received: from victoria.eng.evsx.com (victoria.eng.evsx.com [192.168.1.29]) by mailhost.intrinsity.com (Postfix) with ESMTP id 18D263F40D for ; Sat, 7 Sep 2002 20:08:57 -0500 (CDT) Received: from beeville.vert.intrinsity.com (beeville.vert.intrinsity.com [192.168.3.48]) by victoria.eng.evsx.com (8.10.1/8.10.1) with ESMTP id g8818u002324; Sat, 7 Sep 2002 20:08:56 -0500 (CDT) From: Fred Fish Received: (from fnf@localhost) by beeville.vert.intrinsity.com (8.11.2/8.11.4) id g8818Ni29790; Sat, 7 Sep 2002 20:08:23 -0500 Message-Id: <200209080108.g8818Ni29790@beeville.vert.intrinsity.com> Subject: [RFA] Fix bits/bytes confusion in print_scalar_formatted To: gdb-patches@sources.redhat.com Date: Sat, 07 Sep 2002 18:08:00 -0000 Cc: fnf@intrinsity.com Reply-To: fnf@intrinsity.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2002-09/txt/msg00109.txt.bz2 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 * 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