From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114405 invoked by alias); 28 May 2018 13:18: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 114393 invoked by uid 89); 28 May 2018 13:18:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=hooks, 7.2, forever X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 28 May 2018 13:18:34 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id w4SDISK2013058 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 28 May 2018 09:18:32 -0400 Received: by simark.ca (Postfix, from userid 112) id EDF621F21D; Mon, 28 May 2018 09:18:27 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 5ABC61E4F7; Mon, 28 May 2018 09:18:25 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 28 May 2018 16:10:00 -0000 From: Simon Marchi To: Tom Tromey Cc: gdb-patches@sourceware.org, Simon Marchi Subject: Re: [RFC PATCH] Read pseudo registers from frame instead of regcache In-Reply-To: <87r2lxzrvx.fsf@tromey.com> References: <20180526002406.18166-1-simon.marchi@polymtl.ca> <87r2lxzrvx.fsf@tromey.com> Message-ID: <255f6a7ccf53928bc0fb2ac5a94fa234@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.6 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 28 May 2018 13:18:28 +0000 X-IsSubscribed: yes X-SW-Source: 2018-05/txt/msg00735.txt.bz2 On 2018-05-26 23:42, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> The problem: Reading pseudo registers from an upper stack frame > does not > Simon> work. The raw registers needed to compose the pseudo registers > are > Simon> always read from the current thread's regcache, which is > effectively > Simon> frame #0's registers. > [...] > Simon> The gdbarch hooks > > Simon> - pseudo_register_read > Simon> - pseudo_register_read_value > Simon> - pseudo_register_write > > Simon> receive a regcache as a parameter, as a way to get the values of > the raw > Simon> registers required to compute the pseudo register value. > However, the > Simon> regcache object always contains the current register values, not > the > Simon> values unwound to the frame we're interested in. > > I don't know this area very well, so apologies if this is really off > target; but I am wondering why not just make a regcache for the desired > frame and pass that to the gdbarch hooks? That sounds like a good idea, at least to avoid changing the gdbarch interface. The current regcache always fetches raw registers using target_fetch_registers (which gets the current values of the thread's registers), but we could have another kind of regcache that instead gets raw register values by unwinding from the previous frame. > Another thing I am curious about is how far back this bug goes. Like, > if it were introduced in one of the last few releases, then it might be > worth bisecting to find out what happened. The oldest version of GDB with which I could print $ebx is 7.2 (did pseudo registers not exist before?), and it exhibits the same problem. So I would think that the problem exists since "forever". Simon