From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18507 invoked by alias); 19 May 2005 14:46:57 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 8640 invoked from network); 19 May 2005 14:40:20 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 19 May 2005 14:40:19 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j4JEeJqS007736 for ; Thu, 19 May 2005 10:40:19 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j4JEeEO11537; Thu, 19 May 2005 10:40:14 -0400 Received: from [172.16.14.151] (to-dhcp51.toronto.redhat.com [172.16.14.151]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id j4JEeDj2031926; Thu, 19 May 2005 10:40:13 -0400 Message-ID: <428CA4A1.8020408@gnu.org> Date: Thu, 19 May 2005 16:41:00 -0000 From: Andrew Cagney User-Agent: Mozilla Thunderbird 1.0.2-1 (X11/20050323) MIME-Version: 1.0 To: Joel Brobecker CC: gdb-patches@sources.redhat.com Subject: Re: Question: Checking register value in buffer References: <20050519020443.GP1462@adacore.com> In-Reply-To: <20050519020443.GP1462@adacore.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005-05/txt/msg00472.txt.bz2 Joel Brobecker wrote: > Hello, > > I'm wondering if there is a usual way for what I'm trying to do. > Basically, I have fetched a 64bit floating point register on alpha > using: Have you looked at doublest.[hc]? > regcache_cooked_read (current_regcache, (insn >> 21) & 0x1f, reg); > > where reg is a ``char reg[8]''. > > Now, I'd like to perform the following tests: > > zero (reg & 0x7fff_ffff_ffff_ffff) == 0 > sign (reg & 0x8000_0000_0000_0000) != 0 > > Right now, I'm juggling with each byte of the buffer, and doing checks > like this: > > fp_register_zero_p (char *buf) > { > return ((buf[1] & 0x0f) == 0 && buf[2] == 0 && buf[3] == 0 > && buf[4] == 0 && buf[5] == 0 && buf[6] == 0 && buf[7] == 0); > > I thought about something like: > > LONGEST rav = extract_signed_integer (buf, 8) > > and then do the test using integer arithmetics. But then I'm not guarantied > that LONGEST is at least 64bit long, am I. > > How are these sort of checks usually done in GDB? > > Thanks,