From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20264 invoked by alias); 11 Feb 2016 15:51:36 -0000 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 Received: (qmail 20173 invoked by uid 89); 11 Feb 2016 15:51:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=bite X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 11 Feb 2016 15:51:33 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id BB94F3CA143; Thu, 11 Feb 2016 15:51:31 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1BFpUxP032272; Thu, 11 Feb 2016 10:51:31 -0500 Message-ID: <56BCAE02.7030803@redhat.com> Date: Thu, 11 Feb 2016 15:51:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Yao Qi CC: gdb-patches@sourceware.org Subject: Re: [PATCH] Clear *VAL in regcache_raw_read_unsigned References: <1455029644-6197-1-git-send-email-yao.qi@linaro.org> <86egckqztq.fsf@gmail.com> <56BB6ADB.6070909@redhat.com> <86a8n8qxyp.fsf@gmail.com> <56BB7512.2030507@redhat.com> <8660xvr1wr.fsf@gmail.com> <56BC829B.8060102@redhat.com> <864mdfp9b3.fsf@gmail.com> In-Reply-To: <864mdfp9b3.fsf@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-02/txt/msg00357.txt.bz2 On 02/11/2016 03:15 PM, Yao Qi wrote: > I think this is better than 'make gdbserver use extract_unsigned_integer', > which looks overkill to me. I think it's only going to bite us back in the future. >From the perspective of potentially making it easier to share more code between gdb and gdbserver, I'd prefer that. Would you object it? > >> >> Or maybe better, just byte the bullet and make gdbserver use >> extract_unsigned_integer, like gdb. >> >> The problem with that is that gdbserver can't currently use 'enum bfd_endian', >> which IIRC, was already an issue in the get-next-pcs stuff. I've attached a > > get-next-pcs stuff needs endianness in GDB side. In GDBserver, > endianness is not needed. The get-next-pcs stuff does have endianness bits, but it works around the lack of 'enum bfd_endian' by hacking it through an int instead: void arm_get_next_pcs_ctor (struct arm_get_next_pcs *self, struct arm_get_next_pcs_ops *ops, int byte_order, int byte_order_for_code, int has_thumb2_breakpoint, struct regcache *regcache) { $ grep byte_order * arm-get-next-pcs.c: int byte_order, arm-get-next-pcs.c: int byte_order_for_code, arm-get-next-pcs.c: self->byte_order = byte_order; arm-get-next-pcs.c: self->byte_order_for_code = byte_order_for_code; arm-get-next-pcs.c: int byte_order_for_code = self->byte_order_for_code; arm-get-next-pcs.c: insn1 = self->ops->read_mem_uint (loc, 2, byte_order_for_code); arm-get-next-pcs.c: insn2 = self->ops->read_mem_uint (loc, 2, byte_order_for_code); arm-get-next-pcs.c: insn1 = self->ops->read_mem_uint (loc, 2,byte_order_for_code); arm-get-next-pcs.c: insn2 = self->ops->read_mem_uint (loc, 2, byte_order_for_code); arm-get-next-pcs.c: int byte_order_for_code = self->byte_order_for_code; arm-get-next-pcs.c: insn = self->ops->read_mem_uint (loc, 4, byte_order_for_code); arm-get-next-pcs.c: insn = self->ops->read_mem_uint (loc, 4, byte_order_for_code); arm-get-next-pcs.c: int byte_order = self->byte_order; arm-get-next-pcs.c: int byte_order_for_code = self->byte_order_for_code; arm-get-next-pcs.c: inst1 = self->ops->read_mem_uint (pc, 2, byte_order_for_code); arm-get-next-pcs.c: inst1 = self->ops->read_mem_uint (pc, 2,byte_order_for_code); arm-get-next-pcs.c: inst1 = self->ops->read_mem_uint (pc, 2, byte_order_for_code); arm-get-next-pcs.c: inst1 = self->ops->read_mem_uint (pc, 2, byte_order_for_code); arm-get-next-pcs.c: nextpc = self->ops->read_mem_uint (sp + offset, 4, byte_order); arm-get-next-pcs.c: inst2 = self->ops->read_mem_uint (pc + 2, 2, byte_order_for_code); arm-get-next-pcs.c: nextpc = self->ops->read_mem_uint (addr + offset, 4, byte_order); arm-get-next-pcs.c: = self->ops->read_mem_uint (base, 4, byte_order); arm-get-next-pcs.c: length = 2 * self->ops->read_mem_uint (table + offset, 1, byte_order); arm-get-next-pcs.c: length = 2 * self->ops->read_mem_uint (table + offset, 2, byte_order); arm-get-next-pcs.c: int byte_order = self->byte_order; arm-get-next-pcs.c: int byte_order_for_code = self->byte_order_for_code; arm-get-next-pcs.c: this_instr = self->ops->read_mem_uint (pc, 4, byte_order_for_code); arm-get-next-pcs.c: 4, byte_order); arm-get-next-pcs.c: 4, byte_order); arm-get-next-pcs.h: ULONGEST (*read_mem_uint) (CORE_ADDR memaddr, int len, int byte_order); arm-get-next-pcs.h: int byte_order; arm-get-next-pcs.h: int byte_order_for_code; arm-get-next-pcs.h: int byte_order, arm-get-next-pcs.h: int byte_order_for_code, > >> patch series that handles that by moving bfd_endian to a separate header. >> I've pushed it to the users/palves/gdbserver-extract-unsigned-integer branch >> as well. >> >> If you agree with this, I'll run the bfd_endian patch by the binutils folks. > > Since the endianness of GDBserver is always identical to the endianness > of the program, I am not sure sharing extract_unsigned_integer between > GDB and GDBserver is necessary. Thanks, Pedro Alves