From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7483 invoked by alias); 14 May 2009 11:34:36 -0000 Received: (qmail 7473 invoked by uid 22791); 14 May 2009 11:34:35 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mtagate7.de.ibm.com (HELO mtagate7.de.ibm.com) (195.212.29.156) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 14 May 2009 11:34:29 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate7.de.ibm.com (8.14.3/8.13.8) with ESMTP id n4EBYQCk571412 for ; Thu, 14 May 2009 11:34:26 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n4EBYQSF4403388 for ; Thu, 14 May 2009 13:34:26 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n4EBYQCM032383 for ; Thu, 14 May 2009 13:34:26 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id n4EBYOaS032369; Thu, 14 May 2009 13:34:24 +0200 Message-Id: <200905141134.n4EBYOaS032369@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Thu, 14 May 2009 13:34:24 +0200 Subject: [rfc] Minor cleanup to pascal_val_print To: gdb-patches@sourceware.org, muller@ics.u-strasbg.fr Date: Thu, 14 May 2009 11:34:00 -0000 From: "Ulrich Weigand" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-05/txt/msg00294.txt.bz2 Hello, p-valprint.c uses "extract_unsigned_integer" to extract the value of a reference in order to print it, explicitly using gdbarch_ptr_bit as length. The corresponding location in the val_print routine of all other languages (except Ada) simply uses extract_typed_address to get at that value. The patch below changes pascal_val_print to do the same thing, getting rid of a current_gdbarch instance in the process. Pierre, is there any reason why this would be wrong for Pascal? Bye, Ulrich ChangeLog: * p-valprint.c (pascal_val_print): Use extract_typed_address to extract reference value. Index: gdb-head/gdb/p-valprint.c =================================================================== --- gdb-head.orig/gdb/p-valprint.c +++ gdb-head/gdb/p-valprint.c @@ -251,11 +251,10 @@ pascal_val_print (struct type *type, con elttype = check_typedef (TYPE_TARGET_TYPE (type)); if (options->addressprint) { + CORE_ADDR addr + = extract_typed_address (valaddr + embedded_offset, type); fprintf_filtered (stream, "@"); - /* Extract the address, assume that it is unsigned. */ - fputs_filtered (paddress ( - extract_unsigned_integer (valaddr + embedded_offset, - gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT)), stream); + fputs_filtered (paddress (addr), stream); if (options->deref_ref) fputs_filtered (": ", stream); } -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com