From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25665 invoked by alias); 20 May 2008 15:25:01 -0000 Received: (qmail 25560 invoked by uid 22791); 20 May 2008 15:24:47 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate2.de.ibm.com (HELO mtagate2.de.ibm.com) (195.212.29.151) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 20 May 2008 15:24:25 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate2.de.ibm.com (8.13.8/8.13.8) with ESMTP id m4KFOMwi120920 for ; Tue, 20 May 2008 15:24:22 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 v8.7) with ESMTP id m4KFOM7E1978510 for ; Tue, 20 May 2008 17:24:22 +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 m4KFOMG0011366 for ; Tue, 20 May 2008 17:24:22 +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 m4KFOMQE011363; Tue, 20 May 2008 17:24:22 +0200 Message-Id: <200805201524.m4KFOMQE011363@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Tue, 20 May 2008 17:24:22 +0200 Subject: Re: [patch]: Add endianess to valprint routines To: deuling@de.ibm.com (Markus Deuling) Date: Tue, 20 May 2008 17:48:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org (GDB Patches) In-Reply-To: <48314BC3.4040207@de.ibm.com> from "Markus Deuling" at May 19, 2008 11:43:31 AM X-Mailer: ELM [version 2.5 PL2] 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: 2008-05/txt/msg00596.txt.bz2 Markus Deuling wrote: > * valprint.c (print_hex_chars, print_octal_chars, print_decimal_chars, > print_binary_chars, print_char_chars): Add endianess parameter and > replace gdbarch_byte_order. > (val_print_type_code_int): Introduce gdbarch_byte_order to get at the > endianness. Update call to print_hex_chars. > * valprint.h (print_hex_chars, print_octal_chars, print_decimal_chars, > print_binary_chars, print_char_chars): Add endianess parameter. > * printcmd.c (print_scalar_formatted): Introduce gdbarch_byte_order to > get at the endianness. Update print_*_char calls to use endianness. This is basically OK, except for: > #define START_P \ > - ((gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) ? valaddr : valaddr + len - 1) > + ((endianness == BFD_ENDIAN_BIG) ? valaddr : valaddr + len - 1) > #define NOT_END_P \ > - ((gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) ? (p < valaddr + len) : (p >= valaddr)) > + ((endianness == BFD_ENDIAN_BIG) ? (p < valaddr + len) : (p >= valaddr)) > #define NEXT_P \ > - ((gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) ? p++ : p-- ) > + ((endianness == BFD_ENDIAN_BIG) ? p++ : p-- ) Can we please avoid having macros that implicitly access local variables? As a minor nit, calling those variables "byte_order" instead of "endianness" seems to be more common usage in GDB. Thanks, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com