From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10633 invoked by alias); 5 Mar 2018 22:35:58 -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 10616 invoked by uid 89); 5 Mar 2018 22:35:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 05 Mar 2018 22:35:56 +0000 Received: by simark.ca (Postfix, from userid 112) id F3AD61E66B; Mon, 5 Mar 2018 17:35:54 -0500 (EST) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id C9D031E584; Mon, 5 Mar 2018 17:35:53 -0500 (EST) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 05 Mar 2018 22:35:00 -0000 From: Simon Marchi To: Andrew Burgess Cc: gdb-patches@sourceware.org, Eli Zaretskii Subject: Re: [PATCHv4 2/2] gdb: Initial baremetal riscv support In-Reply-To: <20180305104543.GA2612@embecosm.com> References: <430dd07a2ed6520ad17108eb156935ec86cec826.1520021226.git.andrew.burgess@embecosm.com> <3e083125-4a39-04ee-45cc-0152ced1e259@simark.ca> <20180305104543.GA2612@embecosm.com> Message-ID: <0ed7c3b8244b601b2f80f75316620192@simark.ca> X-Sender: simark@simark.ca User-Agent: Roundcube Webmail/1.3.4 X-SW-Source: 2018-03/txt/msg00127.txt.bz2 On 2018-03-05 05:45, Andrew Burgess wrote: > Simon, > > Thanks for the continued feedback. The only changes in this revision > are in the new test. I believe I've addressed all of the points you > made: > > - Test file renamed. > - General cleanup, redundant code removed. > - Use of clean_restart where appropriate. > - Use of 'fail' after 'runto_main'. > - Use of get_valueof where appropriate. > - Use of gdb_assert where appropriate. > - The integer only set is also included now. > > One interesting change that cropped up with this change is that I now > run the tests _after_ having the inferior program call a function that > uses the FPU. The reason is that on one machine I was seeing test > failures in some cases. > > The reason I believe is due to lazy enabling of the FPU on x86-64 > targets. I think that what happens is this: > > 1. Program starts, FPU is disabled. Contents of $fctrl and $fstat > registers is random garbage. > 2. User makes an inferior call from GDB, GDB stores complete > register state. > 3. Inferior function uses the FPU, the kernel enables the FPU and > places some sane defaults into the $fctrl and $fstat registers. > 4. Inferior function completes and control returns to GDB, GDB > restores the contents of the $fctrl and $fstat registers > (original random garbage) however, the FPU is now enabled. > 5. Use calls another inferior function from GDB, the FPU is now > already enabled but has random garbage in its control registers, > this sometimes results in a SIGFPU exception. > > I then noticed that the gdb.base/structs.exp test also fails for me on > the "problem" machine. > > What I don't know is why this issue is limited to one particular > machine, I'm guessing its something special about the OS/GCC/libraries > but I've not tracked it down yet. > > Still, I thought it was interesting enough to mention, but I don't > think it needs to block this patch from moving forward. Ok, I don't know more about the FPU than you do, and your explanation seems reasonable. The patch LGTM. Thanks! Simon