From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31497 invoked by alias); 17 Jul 2014 23:11:15 -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 31324 invoked by uid 89); 17 Jul 2014 23:11:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 17 Jul 2014 23:11:08 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1X7upM-0007GP-Q2 from Maciej_Rozycki@mentor.com ; Thu, 17 Jul 2014 16:11:04 -0700 Received: from SVR-IES-FEM-02.mgc.mentorg.com ([137.202.0.106]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 17 Jul 2014 16:11:03 -0700 Received: from localhost (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server (TLS) id 14.2.247.3; Fri, 18 Jul 2014 00:10:57 +0100 Date: Fri, 18 Jul 2014 08:07:00 -0000 From: "Maciej W. Rozycki" To: Pedro Alves CC: Gary Benson , , Tom Tromey , Doug Evans Subject: Re: [PATCH 03/15 v2] Make gdbserver CORE_ADDR unsigned In-Reply-To: <53C7FCB1.4060904@redhat.com> Message-ID: References: <1405520243-17282-1-git-send-email-gbenson@redhat.com> <1405520243-17282-4-git-send-email-gbenson@redhat.com> <53C7FCB1.4060904@redhat.com> User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-SW-Source: 2014-07/txt/msg00488.txt.bz2 On Thu, 17 Jul 2014, Pedro Alves wrote: > The only issue that I think might come out of this is > that on MIPS, addresses are signed, so pointers are sign > extended. But we can definitely handle whatever fallout this > may cause, if any, when we see it. Clearly if GDB's native > targets can handle that, so should gdbserver's, and in any > case the issue should be pretty localized. Just pointing it > out FYI, to keep an eye out for it. Also SH64 AFAICT, it defines `elf_backend_sign_extend_vma' to true in bfd/elf32-sh64.c. We have the following comment in gdb/mips-tdep.c: /* MIPS believes that the PC has a sign extended value. Perhaps the all registers should be sign extended for simplicity? */ which is of course true in that we need to sign-extend all integer registers (that includes GPRs and CP0 registers; maybe some control registers as well); where applicable that is, i.e. debugging a strict 32-bit ABI on 64-bit hardware. Then on the other hand the values in these registers should already have been truncated to 32 bits and then sign-extended before they have been written in the first place. Overall it's tricky, hardware does not always enforce proper sign-extension required by the ABI, e.g. an o32 kernel-mode program is free to set GPRs or the PC to a value outside the range supported by the ABI (the Linux kernel sometimes takes advantage of this possibility), and we have no way I believe to make the user aware of this happening, while that might be The Bug they're after. Maciej