From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26563 invoked by alias); 14 May 2002 14:41:23 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 26493 invoked from network); 14 May 2002 14:41:19 -0000 Received: from unknown (HELO localhost.redhat.com) (24.112.240.27) by sources.redhat.com with SMTP; 14 May 2002 14:41:19 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id C56353DCD; Tue, 14 May 2002 10:41:25 -0400 (EDT) Message-ID: <3CE12215.1020308@cygnus.com> Date: Tue, 14 May 2002 07:41:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0rc1) Gecko/20020429 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Richard.Earnshaw@arm.com Cc: gdb@sources.redhat.com Subject: Re: frame_register_read() References: <200205141019.LAA14302@cam-mail2.cambridge.arm.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-05/txt/msg00149.txt.bz2 > Andrew, > > frame_register_read() contains the comment > > /* FIXME: cagney/2002-04-10: This test is just bogus. It is no > indication of the validity of the register. The value could > easily be found (on the stack) even though the corresponding > register isn't available. */ > if (register_cached (regnum) < 0) > return 0; /* register value not available */ > > But in regcache.c we have > > /* REGISTER_VALID is 0 if the register needs to be fetched, > 1 if it has been fetched, and > -1 if the register value was not available. > "Not available" means don't try to fetch it again. */ > > So why is the code in frame_register_read incorrect? It's simply testing > that the register exists for this target. If it doesn't exist, then how > can it be recovered from the stack? Introspect (tracepoints, target snapshots) do this. If a specific snapshot doesn't contain a register then the register is unavailable. The corresponding hardware still has the register so its value can be found on the stack. > I guess it is possible that the check should be moved into > default_get_saved_register, for the case where we are trying to fetch the > register directly from the regcache, but either the target has this > register, or it doesn't. Andrew